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