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