upgrade to glibmm 2.16
[ardour.git] / libs / glibmm2 / glib / glibmm / unicode.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GLIBMM_UNICODE_H
4 #define _GLIBMM_UNICODE_H
5
6
7 /* $Id: unicode.hg,v 1.2 2003/08/20 10:31:23 murrayc Exp $ */
8
9 /* Copyright (C) 2002 The gtkmm Development Team
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library; if not, write to the Free
23  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25
26
27 #include <glib.h>
28
29 // Not used, but we want to get rid of possible <ctype.h> macros.
30 #include <cctype>
31
32 #undef isalnum
33 #undef isalpha
34 #undef iscntrl
35 #undef isdigit
36 #undef isgraph
37 #undef islower
38 #undef isprint
39 #undef ispunct
40 #undef isspace
41 #undef isupper
42 #undef isxdigit
43 #undef istitle
44 #undef isdefined
45 #undef iswide
46 #undef toupper
47 #undef tolower
48 #undef totitle
49
50
51 namespace Glib
52 {
53
54 /** @addtogroup glibmmEnums Enums and Flags */
55
56 /**
57  * @ingroup glibmmEnums
58  */
59 enum UnicodeType
60 {
61   UNICODE_CONTROL,
62   UNICODE_FORMAT,
63   UNICODE_UNASSIGNED,
64   UNICODE_PRIVATE_USE,
65   UNICODE_SURROGATE,
66   UNICODE_LOWERCASE_LETTER,
67   UNICODE_MODIFIER_LETTER,
68   UNICODE_OTHER_LETTER,
69   UNICODE_TITLECASE_LETTER,
70   UNICODE_UPPERCASE_LETTER,
71   UNICODE_COMBINING_MARK,
72   UNICODE_ENCLOSING_MARK,
73   UNICODE_NON_SPACING_MARK,
74   UNICODE_DECIMAL_NUMBER,
75   UNICODE_LETTER_NUMBER,
76   UNICODE_OTHER_NUMBER,
77   UNICODE_CONNECT_PUNCTUATION,
78   UNICODE_DASH_PUNCTUATION,
79   UNICODE_CLOSE_PUNCTUATION,
80   UNICODE_FINAL_PUNCTUATION,
81   UNICODE_INITIAL_PUNCTUATION,
82   UNICODE_OTHER_PUNCTUATION,
83   UNICODE_OPEN_PUNCTUATION,
84   UNICODE_CURRENCY_SYMBOL,
85   UNICODE_MODIFIER_SYMBOL,
86   UNICODE_MATH_SYMBOL,
87   UNICODE_OTHER_SYMBOL,
88   UNICODE_LINE_SEPARATOR,
89   UNICODE_PARAGRAPH_SEPARATOR,
90   UNICODE_SPACE_SEPARATOR
91 };
92
93
94 /**
95  * @ingroup glibmmEnums
96  */
97 enum UnicodeBreakType
98 {
99   UNICODE_BREAK_MANDATORY,
100   UNICODE_BREAK_CARRIAGE_RETURN,
101   UNICODE_BREAK_LINE_FEED,
102   UNICODE_BREAK_COMBINING_MARK,
103   UNICODE_BREAK_SURROGATE,
104   UNICODE_BREAK_ZERO_WIDTH_SPACE,
105   UNICODE_BREAK_INSEPARABLE,
106   UNICODE_BREAK_NON_BREAKING_GLUE,
107   UNICODE_BREAK_CONTINGENT,
108   UNICODE_BREAK_SPACE,
109   UNICODE_BREAK_AFTER,
110   UNICODE_BREAK_BEFORE,
111   UNICODE_BREAK_BEFORE_AND_AFTER,
112   UNICODE_BREAK_HYPHEN,
113   UNICODE_BREAK_NON_STARTER,
114   UNICODE_BREAK_OPEN_PUNCTUATION,
115   UNICODE_BREAK_CLOSE_PUNCTUATION,
116   UNICODE_BREAK_QUOTATION,
117   UNICODE_BREAK_EXCLAMATION,
118   UNICODE_BREAK_IDEOGRAPHIC,
119   UNICODE_BREAK_NUMERIC,
120   UNICODE_BREAK_INFIX_SEPARATOR,
121   UNICODE_BREAK_SYMBOL,
122   UNICODE_BREAK_ALPHABETIC,
123   UNICODE_BREAK_PREFIX,
124   UNICODE_BREAK_POSTFIX,
125   UNICODE_BREAK_COMPLEX_CONTEXT,
126   UNICODE_BREAK_AMBIGUOUS,
127   UNICODE_BREAK_UNKNOWN,
128   UNICODE_BREAK_NEXT_LINE,
129   UNICODE_BREAK_WORD_JOINER,
130   UNICODE_BREAK_HANGUL_L_JAMO,
131   UNICODE_BREAK_HANGUL_V_JAMO,
132   UNICODE_BREAK_HANGUL_T_JAMO,
133   UNICODE_BREAK_HANGUL_LV_SYLLABLE,
134   UNICODE_BREAK_HANGUL_LVT_SYLLABLE
135 };
136
137
138 /**
139  * @ingroup glibmmEnums
140  * @par Bitwise operators:
141  * <tt>%AsciiType operator|(AsciiType, AsciiType)</tt><br>
142  * <tt>%AsciiType operator&(AsciiType, AsciiType)</tt><br>
143  * <tt>%AsciiType operator^(AsciiType, AsciiType)</tt><br>
144  * <tt>%AsciiType operator~(AsciiType)</tt><br>
145  * <tt>%AsciiType& operator|=(AsciiType&, AsciiType)</tt><br>
146  * <tt>%AsciiType& operator&=(AsciiType&, AsciiType)</tt><br>
147  * <tt>%AsciiType& operator^=(AsciiType&, AsciiType)</tt><br>
148  */
149 enum AsciiType
150 {
151   ASCII_ALNUM = 1 << 0,
152   ASCII_ALPHA = 1 << 1,
153   ASCII_CNTRL = 1 << 2,
154   ASCII_DIGIT = 1 << 3,
155   ASCII_GRAPH = 1 << 4,
156   ASCII_LOWER = 1 << 5,
157   ASCII_PRINT = 1 << 6,
158   ASCII_PUNCT = 1 << 7,
159   ASCII_SPACE = 1 << 8,
160   ASCII_UPPER = 1 << 9,
161   ASCII_XDIGIT = 1 << 10
162 };
163
164 /** @ingroup glibmmEnums */
165 inline AsciiType operator|(AsciiType lhs, AsciiType rhs)
166   { return static_cast<AsciiType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
167
168 /** @ingroup glibmmEnums */
169 inline AsciiType operator&(AsciiType lhs, AsciiType rhs)
170   { return static_cast<AsciiType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
171
172 /** @ingroup glibmmEnums */
173 inline AsciiType operator^(AsciiType lhs, AsciiType rhs)
174   { return static_cast<AsciiType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
175
176 /** @ingroup glibmmEnums */
177 inline AsciiType operator~(AsciiType flags)
178   { return static_cast<AsciiType>(~static_cast<unsigned>(flags)); }
179
180 /** @ingroup glibmmEnums */
181 inline AsciiType& operator|=(AsciiType& lhs, AsciiType rhs)
182   { return (lhs = static_cast<AsciiType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
183
184 /** @ingroup glibmmEnums */
185 inline AsciiType& operator&=(AsciiType& lhs, AsciiType rhs)
186   { return (lhs = static_cast<AsciiType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
187
188 /** @ingroup glibmmEnums */
189 inline AsciiType& operator^=(AsciiType& lhs, AsciiType rhs)
190   { return (lhs = static_cast<AsciiType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
191
192
193 /**
194  * @ingroup glibmmEnums
195  */
196 enum NormalizeMode
197 {
198   NORMALIZE_DEFAULT,
199   NORMALIZE_NFD,
200   NORMALIZE_DEFAULT_COMPOSE,
201   NORMALIZE_NFC = NORMALIZE_DEFAULT_COMPOSE,
202   NORMALIZE_ALL,
203   NORMALIZE_NFKD = NORMALIZE_ALL,
204   NORMALIZE_ALL_COMPOSE,
205   NORMALIZE_NFKC = NORMALIZE_ALL_COMPOSE
206 };
207
208
209 /** @defgroup Unicode Unicode Manipulation
210  * Functions operating on Unicode characters and UTF-8 strings.
211  * @{
212  */
213
214 namespace Unicode
215 {
216
217 inline bool validate(gunichar uc)
218   { return (g_unichar_validate(uc) != 0); }
219 inline bool isalnum(gunichar uc)
220   { return (g_unichar_isalnum(uc) != 0); }
221 inline bool isalpha(gunichar uc)
222   { return (g_unichar_isalpha(uc) != 0); }
223 inline bool iscntrl(gunichar uc)
224   { return (g_unichar_iscntrl(uc) != 0); }
225 inline bool isdigit(gunichar uc)
226   { return (g_unichar_isdigit(uc) != 0); }
227 inline bool isgraph(gunichar uc)
228   { return (g_unichar_isgraph(uc) != 0); }
229 inline bool islower(gunichar uc)
230   { return (g_unichar_islower(uc) != 0); }
231 inline bool isprint(gunichar uc)
232   { return (g_unichar_isprint(uc) != 0); }
233 inline bool ispunct(gunichar uc)
234   { return (g_unichar_ispunct(uc) != 0); }
235 inline bool isspace(gunichar uc)
236   { return (g_unichar_isspace(uc) != 0); }
237 inline bool isupper(gunichar uc)
238   { return (g_unichar_isupper(uc) != 0); }
239 inline bool isxdigit(gunichar uc)
240   { return (g_unichar_isxdigit(uc) != 0); }
241 inline bool istitle(gunichar uc)
242   { return (g_unichar_istitle(uc) != 0); }
243 inline bool isdefined(gunichar uc)
244   { return (g_unichar_isdefined(uc) != 0); }
245 inline bool iswide(gunichar uc)
246   { return (g_unichar_iswide(uc) != 0); }
247
248 inline gunichar toupper(gunichar uc)
249   { return g_unichar_toupper(uc); }
250 inline gunichar tolower(gunichar uc)
251   { return g_unichar_tolower(uc); }
252 inline gunichar totitle(gunichar uc)
253   { return g_unichar_totitle(uc); }
254
255 inline int digit_value(gunichar uc)
256   { return g_unichar_digit_value(uc); }
257 inline int xdigit_value(gunichar uc)
258   { return g_unichar_xdigit_value(uc); }
259
260 inline Glib::UnicodeType type(gunichar uc)
261   { return static_cast<Glib::UnicodeType>(static_cast<int>(g_unichar_type(uc))); }
262
263 inline Glib::UnicodeBreakType break_type(gunichar uc)
264   { return static_cast<Glib::UnicodeBreakType>(static_cast<int>(g_unichar_break_type(uc))); }
265
266 } // namespace Unicode
267
268
269 namespace Ascii
270 {
271
272 inline bool isalnum(char c)
273   { return g_ascii_isalnum(c); }
274 inline bool isalpha(char c)
275   { return g_ascii_isalpha(c); }
276 inline bool iscntrl(char c)
277   { return g_ascii_iscntrl(c); }
278 inline bool isdigit(char c)
279   { return g_ascii_isdigit(c); }
280 inline bool isgraph(char c)
281   { return g_ascii_isgraph(c); }
282 inline bool islower(char c)
283   { return g_ascii_islower(c); }
284 inline bool isprint(char c)
285   { return g_ascii_isprint(c); }
286 inline bool ispunct(char c)
287   { return g_ascii_ispunct(c); }
288 inline bool isspace(char c)
289   { return g_ascii_isspace(c); }
290 inline bool isupper(char c)
291   { return g_ascii_isupper(c); }
292 inline bool isxdigit(char c)
293   { return g_ascii_isxdigit(c); }
294
295 inline char tolower(char c)
296   { return g_ascii_tolower(c); }
297 inline char toupper(char c)
298   { return g_ascii_toupper(c); }
299
300 inline int digit_value(char c)
301   { return g_ascii_digit_value(c); }
302 inline int xdigit_value(char c)
303   { return g_ascii_xdigit_value(c); }
304
305 } // namespace Ascii
306
307
308 /** @} group Unicode */
309
310 } // namespace Glib
311
312
313 #endif /* _GLIBMM_UNICODE_H */
314