00001
00021 #ifndef INC_MI32_UCCHAR_H
00022 #define INC_MI32_UCCHAR_H
00023
00024 #ifndef INC_MI32_STDDEFNS_H
00025 #include <mi32/stddefns.h>
00026 #endif
00027
00028 #ifdef MISYSTEMDLL
00029 #define LIBEXPORT MI_DLLEXPORT
00030 #else
00031 #define LIBEXPORT MI_DLLIMPORT
00032 #endif
00033
00036
00046 enum UCCAT {
00047 UCCAT_Cn = 0,
00048 UCCAT_Lu = 1,
00049 UCCAT_Ll = 2,
00050 UCCAT_Lt = 3,
00051 UCCAT_Lm = 4,
00052 UCCAT_Lo = 5,
00053 UCCAT_Mn = 6,
00054 UCCAT_Mc = 7,
00055 UCCAT_Me = 8,
00056 UCCAT_Nd = 9,
00057 UCCAT_Nl = 10,
00058 UCCAT_No = 11,
00059 UCCAT_Zs = 12,
00060 UCCAT_Zl = 13,
00061 UCCAT_Zp = 14,
00062 UCCAT_Cc = 15,
00063 UCCAT_Cf = 16,
00064 UCCAT_Cs = 17,
00065 UCCAT_Co = 18,
00066 UCCAT_Pc = 20,
00067 UCCAT_Pd = 21,
00068 UCCAT_Ps = 22,
00069 UCCAT_Pe = 23,
00070 UCCAT_Pi = 24,
00071 UCCAT_Pf = 25,
00072 UCCAT_Po = 26,
00073 UCCAT_Sm = 27,
00074 UCCAT_Sc = 28,
00075 UCCAT_Sk = 29,
00076 UCCAT_So = 30
00077 };
00078
00080 enum UCCATFLAGS {
00081 UCCATFLAG_Cn = (1 << UCCAT_Cn),
00082 UCCATFLAG_Lu = (1 << UCCAT_Lu),
00083 UCCATFLAG_Ll = (1 << UCCAT_Ll),
00084 UCCATFLAG_Lt = (1 << UCCAT_Lt),
00085 UCCATFLAG_Lm = (1 << UCCAT_Lm),
00086 UCCATFLAG_Lo = (1 << UCCAT_Lo),
00087 UCCATFLAG_Mn = (1 << UCCAT_Mn),
00088 UCCATFLAG_Mc = (1 << UCCAT_Mc),
00089 UCCATFLAG_Me = (1 << UCCAT_Me),
00090 UCCATFLAG_Nd = (1 << UCCAT_Nd),
00091 UCCATFLAG_Nl = (1 << UCCAT_Nl),
00092 UCCATFLAG_No = (1 << UCCAT_No),
00093 UCCATFLAG_Zs = (1 << UCCAT_Zs),
00094 UCCATFLAG_Zl = (1 << UCCAT_Zl),
00095 UCCATFLAG_Zp = (1 << UCCAT_Zp),
00096 UCCATFLAG_Cc = (1 << UCCAT_Cc),
00097 UCCATFLAG_Cf = (1 << UCCAT_Cf),
00098 UCCATFLAG_Cs = (1 << UCCAT_Cs),
00099 UCCATFLAG_Co = (1 << UCCAT_Co),
00100 UCCATFLAG_Pc = (1 << UCCAT_Pc),
00101 UCCATFLAG_Pd = (1 << UCCAT_Pd),
00102 UCCATFLAG_Ps = (1 << UCCAT_Ps),
00103 UCCATFLAG_Pe = (1 << UCCAT_Pe),
00104 UCCATFLAG_Pi = (1 << UCCAT_Pi),
00105 UCCATFLAG_Pf = (1 << UCCAT_Pf),
00106 UCCATFLAG_Po = (1 << UCCAT_Po),
00107 UCCATFLAG_Sm = (1 << UCCAT_Sm),
00108 UCCATFLAG_Sc = (1 << UCCAT_Sc),
00109 UCCATFLAG_Sk = (1 << UCCAT_Sk),
00110 UCCATFLAG_So = (1 << UCCAT_So),
00111 UCCATFLAG_Mi = (1 << 31)
00112 };
00113 #ifndef GENERATING_DOXYGEN_OUTPUT
00114 DEFINE_ENUM_OP_BITWISE(UCCATFLAGS)
00115 #endif
00116
00120 enum BIDITAG {
00121 BIDITAG_L = 0,
00122 BIDITAG_LRE = 1,
00123 BIDITAG_LRO = 2,
00124 BIDITAG_R = 3,
00125 BIDITAG_AL = 4,
00126 BIDITAG_RLE = 5,
00127 BIDITAG_RLO = 6,
00128 BIDITAG_PDF = 7,
00129 BIDITAG_EN = 8,
00130 BIDITAG_ES = 9,
00131 BIDITAG_ET = 10,
00132 BIDITAG_AN = 11,
00133 BIDITAG_CS = 12,
00134 BIDITAG_NSM = 13,
00135 BIDITAG_BN = 14,
00136 BIDITAG_B = 15,
00137 BIDITAG_WS = 16,
00138 BIDITAG_ON = 17
00139 };
00140
00142 enum BIDIFLAGS {
00143 BIDIFLAG_L = (1 << BIDITAG_L),
00144 BIDIFLAG_LRE = (1 << BIDITAG_LRE),
00145 BIDIFLAG_LRO = (1 << BIDITAG_LRO),
00146 BIDIFLAG_R = (1 << BIDITAG_R),
00147 BIDIFLAG_AL = (1 << BIDITAG_AL),
00148 BIDIFLAG_RLE = (1 << BIDITAG_RLE),
00149 BIDIFLAG_RLO = (1 << BIDITAG_RLO),
00150 BIDIFLAG_PDF = (1 << BIDITAG_PDF),
00151 BIDIFLAG_EN = (1 << BIDITAG_EN),
00152 BIDIFLAG_ES = (1 << BIDITAG_ES),
00153 BIDIFLAG_ET = (1 << BIDITAG_ET),
00154 BIDIFLAG_AN = (1 << BIDITAG_AN),
00155 BIDIFLAG_CS = (1 << BIDITAG_CS),
00156 BIDIFLAG_NSM = (1 << BIDITAG_NSM),
00157 BIDIFLAG_BN = (1 << BIDITAG_BN),
00158 BIDIFLAG_B = (1 << BIDITAG_B),
00159 BIDIFLAG_WS = (1 << BIDITAG_WS),
00160 BIDIFLAG_ON = (1 << BIDITAG_ON)
00161 };
00162
00163 #ifndef GENERATING_DOXYGEN_OUTPUT
00164 DEFINE_ENUM_OP_BITWISE(BIDIFLAGS)
00165 #endif
00166
00167
00174 LIBEXPORT bool ucisprop (
00175 MIUNICODE c,
00176 UINT32 uccatflags
00177 );
00178
00179 LIBEXPORT bool ucisdecompbidiprop(
00180 MIUNICODE c,
00181 UINT32 decompflags
00182 );
00183
00184 LIBEXPORT bool ucisbidiprop (
00185 MIUNICODE c,
00186 UINT32 bidiflags
00187 );
00188
00189 LIBEXPORT MIUNICODE uctolower (
00190 MIUNICODE c
00191 );
00192
00193 LIBEXPORT MIUNICODE uctoupper (
00194 MIUNICODE c
00195 );
00196
00198 inline bool ucisalnum (MIUNICODE c) {
00199 return ucisprop(c, UCCATFLAG_Lu | UCCATFLAG_Ll | UCCATFLAG_Lm | UCCATFLAG_Lo | UCCATFLAG_Lt | UCCATFLAG_Nd);
00200 }
00201
00203 inline bool ucisalpha (MIUNICODE c) {
00204 return ucisprop(c, UCCATFLAG_Lu | UCCATFLAG_Ll | UCCATFLAG_Lm | UCCATFLAG_Lo | UCCATFLAG_Lt);
00205 }
00206
00208 inline bool uciscntrl (MIUNICODE c) {
00209 return ucisprop(c, UCCATFLAG_Cc | UCCATFLAG_Cf);
00210 }
00211
00213 inline bool ucisdigit0to9 (MIUNICODE c) {
00214 return (c >= (MIUNICODE)'0' && c <= (MIUNICODE)'9');
00215 }
00216
00218 inline bool ucisdigit2 (MIUNICODE c) {
00219 return ucisprop(c, UCCATFLAG_Nd);
00220 }
00221
00223 inline bool ucisspace (MIUNICODE c) {
00224
00225 if ((c >= 0x09 && c <= 0x0D) || c == 0x20) return (true);
00226 return ucisprop(c, UCCATFLAG_Zs);
00227 }
00228
00230 inline bool ucisblank (MIUNICODE c) {
00231 return ucisprop(c, UCCATFLAG_Zs);
00232 }
00233
00234 inline bool ucispunct (MIUNICODE c) {
00235 return ucisprop(c, UCCATFLAG_Pc | UCCATFLAG_Pd | UCCATFLAG_Ps | UCCATFLAG_Pe | UCCATFLAG_Po | UCCATFLAG_Pi | UCCATFLAG_Pf | UCCATFLAG_Po);
00236 }
00237
00238 inline bool ucisupper (MIUNICODE c) {
00239 return ucisprop(c, UCCATFLAG_Lu);
00240 }
00241
00242 inline bool ucislower (MIUNICODE c) {
00243 return ucisprop(c, UCCATFLAG_Ll);
00244 }
00245
00246 inline bool ucistitle (MIUNICODE c) {
00247 return ucisprop(c, UCCATFLAG_Lt);
00248 }
00249
00250 inline bool ucisisocntrl (MIUNICODE c) {
00251 return ucisprop(c, UCCATFLAG_Cc);
00252 }
00253
00254 inline bool ucisfmtcntrl (MIUNICODE c) {
00255 return ucisprop(c, UCCATFLAG_Cf);
00256 }
00257
00258 inline bool ucissymbol (MIUNICODE c) {
00259 return ucisprop(c, UCCATFLAG_Sm | UCCATFLAG_Sc | UCCATFLAG_So | UCCATFLAG_Sk);
00260 }
00261
00263 inline bool ucisnumber (MIUNICODE c) {
00264 return ucisprop(c, UCCATFLAG_Nd | UCCATFLAG_No | UCCATFLAG_Nl);
00265 }
00266
00268 inline bool ucisnonspacing (MIUNICODE c) {
00269 return ucisprop(c, UCCATFLAG_Mn);
00270 }
00271
00273 inline bool ucisopenpunct (MIUNICODE c) {
00274 return ucisprop(c, UCCATFLAG_Ps);
00275 }
00276
00278 inline bool ucisclosepunct (MIUNICODE c) {
00279 return ucisprop(c, UCCATFLAG_Pe);
00280 }
00281
00283 inline bool ucisinitialpunct (MIUNICODE c) {
00284 return ucisprop(c, UCCATFLAG_Pi);
00285 }
00286
00288 inline bool ucisfinalpunct (MIUNICODE c) {
00289 return ucisprop(c, UCCATFLAG_Pf);
00290 }
00291
00293 inline bool ucisrtl (MIUNICODE c) {
00294 return ucisbidiprop(c, BIDIFLAG_R | BIDIFLAG_AL);
00295 }
00296
00298 inline bool ucisltr (MIUNICODE c) {
00299 return ucisbidiprop(c, BIDIFLAG_L);
00300 }
00301
00303 inline bool ucisstrong (MIUNICODE c) {
00304 return ucisbidiprop(c, BIDIFLAG_L | BIDIFLAG_R | BIDIFLAG_AL);
00305 }
00306
00308 inline bool ucisweak (MIUNICODE c) {
00309 return ucisbidiprop(c, BIDIFLAG_EN | BIDIFLAG_ES | BIDIFLAG_ET | BIDIFLAG_AN | BIDIFLAG_CS);
00310 }
00311
00313 inline bool ucisneutral (MIUNICODE c) {
00314 return ucisbidiprop(c, BIDIFLAG_WS | BIDIFLAG_ON);
00315 }
00316
00317
00319 inline bool ucismark (MIUNICODE c) {
00320 return ucisprop(c, UCCATFLAG_Mn | UCCATFLAG_Mc | UCCATFLAG_Me);
00321 }
00322
00324 inline bool ucismodif (MIUNICODE c) {
00325 return ucisprop(c, UCCATFLAG_Lm);
00326 }
00327
00329 inline bool ucisconnect (MIUNICODE c) {
00330 return ucisprop(c, UCCATFLAG_Pc);
00331 }
00332
00334 inline bool ucisdash (MIUNICODE c) {
00335 return ucisprop(c, UCCATFLAG_Pd);
00336 }
00337
00339 inline bool ucismath (MIUNICODE c) {
00340 return ucisprop(c, UCCATFLAG_Sm);
00341 }
00342
00344 inline bool uciscurrency (MIUNICODE c) {
00345 return ucisprop(c, UCCATFLAG_Sc);
00346 }
00347
00349 inline bool ucismodifsymbol (MIUNICODE c) {
00350 return ucisprop(c, UCCATFLAG_Sk);
00351 }
00352
00354 inline bool ucisnsmark (MIUNICODE c) {
00355 return ucisprop(c, UCCATFLAG_Mn);
00356 }
00357
00359 inline bool ucisspmark (MIUNICODE c) {
00360 return ucisprop(c, UCCATFLAG_Mc);
00361 }
00362
00364 inline bool ucisenclosing (MIUNICODE c) {
00365 return ucisprop(c, UCCATFLAG_Me);
00366 }
00367
00369 inline bool ucislsep (MIUNICODE c) {
00370 return ucisprop(c, UCCATFLAG_Zl);
00371 }
00372
00374 inline bool ucispsep (MIUNICODE c) {
00375 return ucisprop(c, UCCATFLAG_Zp);
00376 }
00377
00379 inline bool ucishan (MIUNICODE c) {
00380 return ((c >= 0x4e00 && c <= 0x9fff) || (c >= 0xf900 && c <= 0xfaff));
00381 }
00382
00384 inline bool ucishangul (MIUNICODE c) {
00385 return (c >= 0xac00 && c <= 0xd7ff);
00386 }
00387
00389
00390 #undef LIBEXPORT
00391
00392 #endif // INC_MI32_UCCHAR_H