added Info.plist
[TestXSLT.git] / libsablot / src / engine / utf8.h
1 /* 
2  * The contents of this file are subject to the Mozilla Public
3  * License Version 1.1 (the "License"); you may not use this file
4  * except in compliance with the License. You may obtain a copy of
5  * the License at http://www.mozilla.org/MPL/
6  * 
7  * Software distributed under the License is distributed on an "AS
8  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9  * implied. See the License for the specific language governing
10  * rights and limitations under the License.
11  * 
12  * The Original Code is the Sablotron XSLT Processor.
13  * 
14  * The Initial Developer of the Original Code is Ginger Alliance Ltd.
15  * Portions created by Ginger Alliance are Copyright (C) 2000-2002
16  * Ginger Alliance Ltd. All Rights Reserved.
17  * 
18  * Contributor(s):
19  * 
20  * Alternatively, the contents of this file may be used under the
21  * terms of the GNU General Public License Version 2 or later (the
22  * "GPL"), in which case the provisions of the GPL are applicable 
23  * instead of those above.  If you wish to allow use of your 
24  * version of this file only under the terms of the GPL and not to
25  * allow others to use your version of this file under the MPL,
26  * indicate your decision by deleting the provisions above and
27  * replace them with the notice and other provisions required by
28  * the GPL.  If you do not delete the provisions above, a recipient
29  * may use your version of this file under either the MPL or the
30  * GPL.
31  */
32
33 //
34 //      utf8.h
35 //
36
37 #if !defined(Utf8HIncl)
38 #define Utf8HIncl
39
40 // GP: clean
41
42 #include "base.h"
43
44 #define SMALL_BUFFER_SIZE 32
45
46 //extern  int     utf8SingleCharLength(const char* text);
47 extern  int     utf8StrLength (const char* text);
48 extern  int     utf8Strchr(const char* text, const char* character);
49 extern  char*   utf8StrIndex(char* text, int index);
50
51 extern  unsigned long 
52                 utf8CharCode(const char *text);
53
54 extern  int     utf8GetChar(char *dest, const char *src);
55 extern  char*   utf8xfrm(const Str &src);
56 extern  int     utf8FromCharCode(char *dest, unsigned long code);
57
58 extern  Bool    utf8IsDigit(unsigned long c);
59 extern  Bool    utf8IsBaseChar(unsigned long c);
60 extern  Bool    utf8IsLetter(unsigned long c);
61 extern  Bool    utf8IsNameChar(unsigned long c);
62 extern  Bool    utf8IsIdeographic(unsigned long c);
63 extern  Bool    utf8IsExtender(unsigned long c);
64 extern  Bool    utf8IsCombiningChar(unsigned long c);
65
66 extern  int     utf8ToUtf16(wchar_t *dest, const char *src);
67
68 //speed optimization
69 inline int utf8SingleCharLength (const char* text)
70 {
71   if (!(*text & 0x80)) return 1;
72   if (!(*text & 0x40)) return 0;
73   for (int len = 2; len < 7; len++)
74       if (!(*text & (0x80 >> len))) return len;
75   return 0;
76 }
77
78 #endif