00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef UTF8STRING_INCLUDED
00036 #define UTF8STRING_INCLUDED
00037
00038 #include "ScriptCodes.h"
00039 #include <string>
00040
00041 typedef unsigned long UTF32;
00042 typedef unsigned short UTF16;
00043 typedef unsigned char UTF8;
00044
00045 #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
00046 #define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
00047
00048
00049
00050
00051 #define UNI_SUR_HIGH_START (UTF32)0xD800
00052 #define UNI_SUR_HIGH_END (UTF32)0xDBFF
00053 #define UNI_SUR_LOW_START (UTF32)0xDC00
00054 #define UNI_SUR_LOW_END (UTF32)0xDFFF
00055
00056 class UTF8String : public std::string {
00057
00058
00059 private:
00060
00061 const char *_UTF32ValueToUTF8( UTF32 UTF32Value );
00062
00063 public:
00064
00065
00066 UTF8String();
00067
00068 UTF8String(const std::string &s);
00069 UTF8String(const UTF8String &s);
00070
00071 unsigned int unicodeValueCount() const;
00072
00073
00074 UTF8String unicodeSubString(unsigned int stt,unsigned int howManyCharacters=0) const;
00075
00076
00077 UTF8String operator[](unsigned int pos) const;
00078
00079 UTF32 unicodeValueAtPosition(unsigned int pos=0) const;
00080
00081
00082
00083 bool isRTL(void) const;
00084
00085
00086
00087 bool isIndic(void) const;
00088
00089
00090
00091
00092 bool isArabic(void) const;
00093
00094
00095
00096
00097
00098
00099 SCRIPTCODE getScriptCode(void);
00100
00101
00102 std::basic_string<UTF32> UTF32String() const;
00103
00104
00105
00106
00107 UTF8String& append( const std::basic_string<UTF32> &UTF32String );
00108 UTF8String& append( const std::basic_string<UTF16> &UTF16String );
00109
00110 UTF8String& operator+=( const std::basic_string<UTF32> &UTF32String );
00111 UTF8String& operator+=( const std::basic_string<UTF16> &UTF16String );
00112
00113 UTF8String& operator=( const std::basic_string<UTF32> &UTF32String );
00114 UTF8String& operator=( const std::basic_string<UTF16> &UTF16String );
00115
00116
00117
00118
00119
00120
00121
00122
00123 UTF8String( const std::basic_string<UTF32> &UTF32String );
00124 UTF8String( const std::basic_string<UTF16> &UTF16String );
00125
00126 };
00127
00128 #endif
00129