1 /* Copyright (C) 2012  Olga Yakovleva <yakovleva.o.v@gmail.com> */
2 
3 /* This program is free software: you can redistribute it and/or modify */
4 /* it under the terms of the GNU Lesser General Public License as published by */
5 /* the Free Software Foundation, either version 2.1 of the License, or */
6 /* (at your option) any later version. */
7 
8 /* This program is distributed in the hope that it will be useful, */
9 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
10 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the */
11 /* GNU Lesser General Public License for more details. */
12 
13 /* You should have received a copy of the GNU Lesser General Public License */
14 /* along with this program.  If not, see <http://www.gnu.org/licenses/>. */
15 
16 #ifndef RHVOICE_UNICODE_HPP
17 #define RHVOICE_UNICODE_HPP
18 
19 #include "utf8.h"
20 
21 namespace RHVoice
22 {
23   namespace unicode
24   {
25     struct category_t
26     {
27       char major_class,subclass;
28     };
29 
operator ==(const category_t & c1,const category_t & c2)30     inline bool operator==(const category_t& c1,const category_t& c2)
31     {
32       return ((c1.major_class==c2.major_class)&&(c1.subclass==c2.subclass));
33     }
34 
operator !=(const category_t & c1,const category_t & c2)35     inline bool operator!=(const category_t& c1,const category_t& c2)
36     {
37       return !(c1==c2);
38     }
39 
40     extern const category_t category_Cc;
41     extern const category_t category_Cf;
42     extern const category_t category_Co;
43     extern const category_t category_Cs;
44     extern const category_t category_Ll;
45     extern const category_t category_Lm;
46     extern const category_t category_Lo;
47     extern const category_t category_Lt;
48     extern const category_t category_Lu;
49     extern const category_t category_Mc;
50     extern const category_t category_Me;
51     extern const category_t category_Mn;
52     extern const category_t category_Nd;
53     extern const category_t category_Nl;
54     extern const category_t category_No;
55     extern const category_t category_Pc;
56     extern const category_t category_Pd;
57     extern const category_t category_Pe;
58     extern const category_t category_Pf;
59     extern const category_t category_Pi;
60     extern const category_t category_Po;
61     extern const category_t category_Ps;
62     extern const category_t category_Sc;
63     extern const category_t category_Sk;
64     extern const category_t category_Sm;
65     extern const category_t category_So;
66     extern const category_t category_Zl;
67     extern const category_t category_Zp;
68     extern const category_t category_Zs;
69 
70     category_t category(utf8::uint32_t c);
71 
72     utf8::uint32_t toupper(utf8::uint32_t c);
73     utf8::uint32_t tolower(utf8::uint32_t c);
74 
75     enum property_t
76       {
77         property_white_space=1,
78         property_dash=2,
79         property_quotation_mark=4,
80         property_lowercase=8,
81         property_uppercase=16,
82         property_alphabetic=32,
83         property_terminal_punctuation=64,
84         property_sterm=128
85       };
86 
87     unsigned int properties(utf8::uint32_t c);
88   }
89 }
90 #endif
91