00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00049 #ifndef __vtkUnicodeString_h
00050 #define __vtkUnicodeString_h
00051
00052 #include <vtkSystemIncludes.h>
00053 #include <vtkstd/string>
00054 #include <vtkstd/vector>
00055
00056 class vtkUnicodeString;
00057
00058 typedef vtkTypeUInt32 vtkUnicodeStringValueType;
00059
00060
00061
00062
00063
00064
00065
00066 #define vtkSuperExtraExtendedTemplateMacro(call) \
00067 vtkExtraExtendedTemplateMacro(call); \
00068 vtkTemplateMacroCase(VTK_UNICODE_STRING, vtkUnicodeString, call)
00069
00070 class VTK_COMMON_EXPORT vtkUnicodeString
00071 {
00072 public:
00073 typedef vtkUnicodeStringValueType value_type;
00074 typedef vtkstd::string::size_type size_type;
00075
00076 class VTK_COMMON_EXPORT const_iterator
00077 {
00078 public:
00079 typedef vtkstd::bidirectional_iterator_tag iterator_category;
00080 typedef vtkUnicodeStringValueType value_type;
00081 typedef vtkstd::string::difference_type difference_type;
00082 typedef value_type* pointer;
00083 typedef value_type& reference;
00084
00085 const_iterator();
00086
00087 value_type operator*() const;
00088 bool operator==(const const_iterator&) const;
00089 bool operator!=(const const_iterator&) const;
00090 const_iterator& operator++();
00091 const_iterator operator++(int);
00092 const_iterator& operator--();
00093 const_iterator operator--(int);
00094
00095 private:
00096 const_iterator(vtkstd::string::const_iterator);
00097 friend class vtkUnicodeString;
00098 vtkstd::string::const_iterator Position;
00099 };
00100
00102
00103 vtkUnicodeString();
00104
00105
00106 vtkUnicodeString(const vtkUnicodeString&);
00107
00108
00109
00110 vtkUnicodeString(size_type count, value_type character);
00111
00112
00113 vtkUnicodeString(const_iterator begin, const_iterator end);
00115
00117
00119 static bool is_utf8(const char*);
00120 static bool is_utf8(const vtkstd::string&);
00122
00124
00126 static vtkUnicodeString from_utf8(const char*);
00127
00128 static vtkUnicodeString from_utf8(const char* begin, const char* end);
00129
00130 static vtkUnicodeString from_utf8(const vtkstd::string&);
00131
00132
00133 static vtkUnicodeString from_utf16(const vtkTypeUInt16*);
00135
00137 vtkUnicodeString& operator=(const vtkUnicodeString&);
00138
00140
00142 const_iterator begin() const;
00143
00144
00145 const_iterator end() const;
00147
00149
00152 value_type at(size_type offset) const;
00153
00154
00155
00156 value_type operator[](size_type offset) const;
00158
00160
00162 const char* utf8_str() const;
00163
00164
00165
00166 void utf8_str(vtkstd::string& result) const;
00167
00168
00169 vtkstd::vector<vtkTypeUInt16> utf16_str() const;
00170
00171
00172
00173 void utf16_str(vtkstd::vector<vtkTypeUInt16>& result) const;
00175
00177
00178 size_type byte_count() const;
00179
00180
00181 size_type character_count() const;
00182
00183
00184 bool empty() const;
00186
00188 static const size_type npos;
00189
00191
00192 vtkUnicodeString& operator+=(value_type);
00193
00194
00195 vtkUnicodeString& operator+=(const vtkUnicodeString& rhs);
00197
00199 void push_back(value_type);
00200
00202
00203 void append(const vtkUnicodeString& value);
00204 void append(size_type count, value_type character);
00205 void append(const_iterator begin, const_iterator end);
00207
00209
00210 void assign(const vtkUnicodeString& value);
00211 void assign(size_type count, value_type character);
00212 void assign(const_iterator begin, const_iterator end);
00214
00216 void clear();
00217
00224 vtkUnicodeString fold_case() const;
00225
00231 int compare(const vtkUnicodeString&) const;
00232
00235 vtkUnicodeString substr(size_type offset = 0, size_type count = npos) const;
00236
00238 void swap(vtkUnicodeString&);
00239
00240 private:
00241 vtkstd::string Storage;
00242 class back_insert_iterator;
00243 };
00244
00245 VTK_COMMON_EXPORT bool operator==(const vtkUnicodeString& lhs, const vtkUnicodeString& rhs);
00246 VTK_COMMON_EXPORT bool operator!=(const vtkUnicodeString& lhs, const vtkUnicodeString& rhs);
00247 VTK_COMMON_EXPORT bool operator<(const vtkUnicodeString& lhs, const vtkUnicodeString& rhs);
00248 VTK_COMMON_EXPORT bool operator<=(const vtkUnicodeString& lhs, const vtkUnicodeString& rhs);
00249 VTK_COMMON_EXPORT bool operator>=(const vtkUnicodeString& lhs, const vtkUnicodeString& rhs);
00250 VTK_COMMON_EXPORT bool operator>(const vtkUnicodeString& lhs, const vtkUnicodeString& rhs);
00251
00252 #endif
00253