OSDN Git Service

Collect distributable package files in user specified directory.
[mingw/mingw-get.git] / src / pkgdata.h
1 #ifndef PKGDATA_H
2 /*
3  * pkgdata.h
4  *
5  * $Id$
6  *
7  * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
8  * Copyright (C) 2010, 2012, MinGW Project
9  *
10  *
11  * Declarations of the classes and properties used to implement the
12  * package data sheet compilers, for both CLI and GUI clients.
13  *
14  *
15  * This is free software.  Permission is granted to copy, modify and
16  * redistribute this software, under the provisions of the GNU General
17  * Public License, Version 3, (or, at your option, any later version),
18  * as published by the Free Software Foundation; see the file COPYING
19  * for licensing details.
20  *
21  * Note, in particular, that this software is provided "as is", in the
22  * hope that it may prove useful, but WITHOUT WARRANTY OF ANY KIND; not
23  * even an implied WARRANTY OF MERCHANTABILITY, nor of FITNESS FOR ANY
24  * PARTICULAR PURPOSE.  Under no circumstances will the author, or the
25  * MinGW Project, accept liability for any damages, however caused,
26  * arising from the use of this software.
27  *
28  */
29 #define PKGDATA_H  1
30
31 /* Utility classes and definitions for interpreting and formatting
32  * package descriptions, encoded as UTF-8.
33  */
34 typedef unsigned long utf32_t;
35
36 #define UTF32_MAX                       (utf32_t)(0x10FFFFUL)
37 #define UTF32_OVERFLOW                  (utf32_t)(UTF32_MAX + 1UL)
38 #define UTF32_INVALID                   (utf32_t)(0x0FFFDUL)
39
40 class pkgUTF8Parser
41 {
42   /* A class for parsing a UTF-8 string, decomposing it into
43    * non-whitespace substrings, separated by whitespace, which
44    * is interpreted as potential word-wrap points.
45    */
46   public:
47     pkgUTF8Parser( const char* );
48     ~pkgUTF8Parser(){ delete next; }
49
50   protected:
51     class pkgUTF8Parser *next;
52     union { char utf8; wchar_t utf16; utf32_t utf32; } codepoint;
53     const char *text;
54     int length;
55
56     const char *ScanBuffer( const char* );
57     wchar_t GetCodePoint( ... );
58 };
59
60 #endif /* PKGDATA_H: $RCSfile$: end of file */