32 #include "CEGUI/Base.h"
47 #if CEGUI_STRING_CLASS == CEGUI_STRING_CLASS_UNICODE
52 #define CEGUI_STR_QUICKBUFF_SIZE 32
62 class CEGUIEXPORT String :
63 public AllocatedObject<String>
69 typedef utf32 value_type;
70 typedef size_t size_type;
71 typedef std::ptrdiff_t difference_type;
72 typedef utf32& reference;
73 typedef const utf32& const_reference;
74 typedef utf32* pointer;
75 typedef const utf32* const_pointer;
77 static const size_type npos;
86 mutable utf8* d_encodedbuff;
90 utf32 d_quickbuff[CEGUI_STR_QUICKBUFF_SIZE];
98 class iterator :
public std::iterator<std::random_access_iterator_tag, utf32>
102 explicit iterator(utf32*
const ptr) : d_ptr(ptr) {}
104 utf32& operator*()
const
109 utf32* operator->()
const
133 String::iterator operator--(
int)
135 String::iterator temp = *
this;
140 String::iterator& operator+=(difference_type offset)
146 String::iterator
operator+(difference_type offset)
const
148 String::iterator temp = *
this;
149 return temp += offset;
152 String::iterator& operator-=(difference_type offset)
154 return *
this += -offset;
157 String::iterator operator-(difference_type offset)
const
159 String::iterator temp = *
this;
160 return temp -= offset;
163 utf32& operator[](difference_type offset)
const
165 return *(*
this + offset);
168 friend difference_type operator-(
const String::iterator& lhs,
169 const String::iterator& rhs)
170 {
return lhs.d_ptr - rhs.d_ptr; }
172 friend String::iterator
operator+(difference_type offset,
const String::iterator& iter)
173 {
return iter + offset; }
175 friend bool operator==(
const String::iterator& lhs,
176 const String::iterator& rhs)
177 {
return lhs.d_ptr == rhs.d_ptr; }
179 friend bool operator!=(
const String::iterator& lhs,
180 const String::iterator& rhs)
181 {
return lhs.d_ptr != rhs.d_ptr; }
183 friend bool operator<(
const String::iterator& lhs,
184 const String::iterator& rhs)
185 {
return lhs.d_ptr < rhs.d_ptr; }
187 friend bool operator>(
const String::iterator& lhs,
188 const String::iterator& rhs)
189 {
return lhs.d_ptr > rhs.d_ptr; }
191 friend bool operator<=(
const String::iterator& lhs,
192 const String::iterator& rhs)
193 {
return lhs.d_ptr <= rhs.d_ptr; }
195 friend bool operator>=(
const String::iterator& lhs,
196 const String::iterator& rhs)
197 {
return lhs.d_ptr >= rhs.d_ptr; }
203 class const_iterator :
public std::iterator<std::random_access_iterator_tag, const utf32>
206 const_iterator() : d_ptr(0) {}
207 explicit const_iterator(
const utf32*
const ptr) : d_ptr(ptr) {}
208 const_iterator(
const String::iterator& iter) : d_ptr(iter.d_ptr) {}
210 const utf32& operator*()
const
215 const utf32* operator->()
const
220 String::const_iterator& operator++()
239 String::const_iterator operator--(
int)
241 String::const_iterator temp = *
this;
246 String::const_iterator& operator+=(difference_type offset)
252 String::const_iterator
operator+(difference_type offset)
const
254 String::const_iterator temp = *
this;
255 return temp += offset;
258 String::const_iterator& operator-=(difference_type offset)
260 return *
this += -offset;
263 String::const_iterator operator-(difference_type offset)
const
265 String::const_iterator temp = *
this;
266 return temp -= offset;
269 const utf32& operator[](difference_type offset)
const
271 return *(*
this + offset);
274 String::const_iterator& operator=(
const String::iterator& iter)
280 friend String::const_iterator
operator+(difference_type offset,
const String::const_iterator& iter)
281 {
return iter + offset; }
283 friend difference_type operator-(
const String::const_iterator& lhs,
284 const String::const_iterator& rhs)
285 {
return lhs.d_ptr - rhs.d_ptr; }
287 friend bool operator==(
const String::const_iterator& lhs,
288 const String::const_iterator& rhs)
289 {
return lhs.d_ptr == rhs.d_ptr; }
291 friend bool operator!=(
const String::const_iterator& lhs,
292 const String::const_iterator& rhs)
293 {
return lhs.d_ptr != rhs.d_ptr; }
295 friend bool operator<(
const String::const_iterator& lhs,
296 const String::const_iterator& rhs)
297 {
return lhs.d_ptr < rhs.d_ptr; }
299 friend bool operator>(
const String::const_iterator& lhs,
300 const String::const_iterator& rhs)
301 {
return lhs.d_ptr > rhs.d_ptr; }
303 friend bool operator<=(
const String::const_iterator& lhs,
304 const String::const_iterator& rhs)
305 {
return lhs.d_ptr <= rhs.d_ptr; }
307 friend bool operator>=(
const String::const_iterator& lhs,
308 const String::const_iterator& rhs)
309 {
return lhs.d_ptr >= rhs.d_ptr; }
318 #if defined(_MSC_VER) && ((_MSC_VER <= 1200) || ((_MSC_VER <= 1300) && defined(_STLPORT_VERSION)))
319 typedef std::reverse_iterator<const_iterator, const_pointer, const_reference, difference_type> const_reverse_iterator;
321 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
328 #if defined(_MSC_VER) && ((_MSC_VER <= 1200) || ((_MSC_VER <= 1300) && defined(_STLPORT_VERSION)))
329 typedef std::reverse_iterator<iterator, pointer, reference, difference_type> reverse_iterator;
331 typedef std::reverse_iterator<iterator> reverse_iterator;
366 String(
const String& str)
389 String(
const String& str, size_type str_idx, size_type str_num = npos)
392 assign(str, str_idx, str_num);
414 String(
const std::string& std_str)
442 String(
const std::string& std_str, size_type str_idx, size_type str_num = npos)
445 assign(std_str, str_idx, str_num);
470 String(
const utf8* utf8_str)
502 String(
const utf8* utf8_str, size_type chars_len)
505 assign(utf8_str, chars_len);
526 String(size_type num, utf32 code_point)
529 assign(num, code_point);
549 String(const_iterator iter_beg, const_iterator iter_end)
552 append(iter_beg, iter_end);
571 String(
const char* cstr)
592 String(
const char* chars, size_type chars_len)
595 assign(chars, chars_len);
609 size_type size(
void)
const
621 size_type length(
void)
const
633 bool empty(
void)
const
635 return (d_cplength == 0);
647 size_type max_size(
void)
const
649 return (((size_type)-1) /
sizeof(utf32));
667 return d_reserve - 1;
685 void reserve(size_type num = 0)
711 int compare(
const String& str)
const
713 return compare(0, d_cplength, str);
745 int compare(size_type idx, size_type len,
const String& str, size_type str_idx = 0, size_type str_len = npos)
const
747 if ((d_cplength < idx) || (str.d_cplength < str_idx))
748 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
750 if ((len == npos) || (idx + len > d_cplength))
751 len = d_cplength - idx;
753 if ((str_len == npos) || (str_idx + str_len > str.d_cplength))
754 str_len = str.d_cplength - str_idx;
756 int val = (len == 0) ? 0 : utf32_comp_utf32(&ptr()[idx], &str.ptr()[str_idx], (len < str_len) ? len : str_len);
758 return (val != 0) ? ((val < 0) ? -1 : 1) : (len < str_len) ? -1 : (len == str_len) ? 0 : 1;
781 int compare(
const std::string& std_str)
const
783 return compare(0, d_cplength, std_str);
820 int compare(size_type idx, size_type len,
const std::string& std_str, size_type str_idx = 0, size_type str_len = npos)
const
822 if (d_cplength < idx)
823 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
825 if (std_str.size() < str_idx)
826 CEGUI_THROW(std::out_of_range(
"Index is out of range for std::string"));
828 if ((len == npos) || (idx + len > d_cplength))
829 len = d_cplength - idx;
831 if ((str_len == npos) || (str_idx + str_len > std_str.size()))
832 str_len = (size_type)std_str.size() - str_idx;
834 int val = (len == 0) ? 0 : utf32_comp_char(&ptr()[idx], &std_str.c_str()[str_idx], (len < str_len) ? len : str_len);
836 return (val != 0) ? ((val < 0) ? -1 : 1) : (len < str_len) ? -1 : (len == str_len) ? 0 : 1;
861 int compare(
const utf8* utf8_str)
const
863 return compare(0, d_cplength, utf8_str, encoded_size(utf8_str));
896 int compare(size_type idx, size_type len,
const utf8* utf8_str)
const
898 return compare(idx, len, utf8_str, encoded_size(utf8_str));
934 int compare(size_type idx, size_type len,
const utf8* utf8_str, size_type str_cplen)
const
936 if (d_cplength < idx)
937 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
939 if (str_cplen == npos)
940 CEGUI_THROW(std::length_error(
"Length for utf8 encoded string can not be 'npos'"));
942 if ((len == npos) || (idx + len > d_cplength))
943 len = d_cplength - idx;
945 int val = (len == 0) ? 0 : utf32_comp_utf8(&ptr()[idx], utf8_str, (len < str_cplen) ? len : str_cplen);
947 return (val != 0) ? ((val < 0) ? -1 : 1) : (len < str_cplen) ? -1 : (len == str_cplen) ? 0 : 1;
966 int compare(
const char* cstr)
const
968 return compare(0, d_cplength, cstr, strlen(cstr));
995 int compare(size_type idx, size_type len,
const char* cstr)
const
997 return compare(idx, len, cstr, strlen(cstr));
1028 int compare(size_type idx, size_type len,
const char* chars, size_type chars_len)
const
1030 if (d_cplength < idx)
1031 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
1033 if (chars_len == npos)
1034 CEGUI_THROW(std::length_error(
"Length for char array can not be 'npos'"));
1036 if ((len == npos) || (idx + len > d_cplength))
1037 len = d_cplength - idx;
1039 int val = (len == 0) ? 0 : utf32_comp_char(&ptr()[idx], chars, (len < chars_len) ? len : chars_len);
1041 return (val != 0) ? ((val < 0) ? -1 : 1) : (len < chars_len) ? -1 : (len == chars_len) ? 0 : 1;
1064 return (ptr()[idx]);
1081 value_type operator[](size_type idx)
const
1098 reference at(size_type idx)
1100 if (d_cplength <= idx)
1101 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
1118 const_reference at(size_type idx)
const
1120 if (d_cplength <= idx)
1121 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
1143 const char* c_str(
void)
const
1145 return (
const char*)build_utf8_buff();
1161 const utf8* data(
void)
const
1163 return build_utf8_buff();
1172 return (d_reserve > CEGUI_STR_QUICKBUFF_SIZE) ? d_buffer : d_quickbuff;
1179 const utf32* ptr(
void)
const
1181 return (d_reserve > CEGUI_STR_QUICKBUFF_SIZE) ? d_buffer : d_quickbuff;
1206 size_type copy(utf8* buf, size_type len = npos, size_type idx = 0)
const
1208 if (d_cplength < idx)
1209 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
1214 return encode(&ptr()[idx], buf, npos, len);
1236 size_type utf8_stream_len(size_type num = npos, size_type idx = 0)
const
1238 using namespace std;
1240 if (d_cplength < idx)
1241 CEGUI_THROW(out_of_range(
"Index was out of range for CEGUI::String object"));
1243 size_type maxlen = d_cplength - idx;
1245 return encoded_size(&ptr()[idx], ceguimin(num, maxlen));
1261 String& operator=(
const String& str)
1284 String& assign(
const String& str, size_type str_idx = 0, size_type str_num = npos)
1286 if (str.d_cplength < str_idx)
1287 CEGUI_THROW(std::out_of_range(
"Index was out of range for CEGUI::String object"));
1289 if ((str_num == npos) || (str_num > str.d_cplength - str_idx))
1290 str_num = str.d_cplength - str_idx;
1294 memcpy(ptr(), &str.ptr()[str_idx], str_num *
sizeof(utf32));
1315 String& operator=(
const std::string& std_str)
1317 return assign(std_str);
1343 String& assign(
const std::string& std_str, size_type str_idx = 0, size_type str_num = npos)
1345 if (std_str.size() < str_idx)
1346 CEGUI_THROW(std::out_of_range(
"Index was out of range for std::string object"));
1348 if ((str_num == npos) || (str_num > (size_type)std_str.size() - str_idx))
1349 str_num = (size_type)std_str.size() - str_idx;
1356 ((*this)[str_num]) = static_cast<utf32>(static_cast<unsigned char>(std_str[str_num + str_idx]));
1380 String& operator=(
const utf8* utf8_str)
1382 return assign(utf8_str, utf_length(utf8_str));
1403 String& assign(
const utf8* utf8_str)
1405 return assign(utf8_str, utf_length(utf8_str));
1429 String& assign(
const utf8* utf8_str, size_type str_num)
1431 if (str_num == npos)
1432 CEGUI_THROW(std::length_error(
"Length for utf8 encoded string can not be 'npos'"));
1434 size_type enc_sze = encoded_size(utf8_str, str_num);
1437 encode(utf8_str, ptr(), d_reserve, str_num);
1452 String& operator=(utf32 code_point)
1454 return assign(1, code_point);
1472 String& assign(size_type num, utf32 code_point)
1475 CEGUI_THROW(std::length_error(
"Code point count can not be 'npos'"));
1500 String& operator=(
const char* cstr)
1502 return assign(cstr, strlen(cstr));
1520 return assign(cstr, strlen(cstr));
1539 String& assign(
const char* chars, size_type chars_len)
1544 for (size_type i = 0; i < chars_len; ++i)
1546 *pt++ = static_cast<utf32>(static_cast<unsigned char>(*chars++));
1564 void swap(String& str)
1566 size_type temp_len = d_cplength;
1567 d_cplength = str.d_cplength;
1568 str.d_cplength = temp_len;
1570 size_type temp_res = d_reserve;
1571 d_reserve = str.d_reserve;
1572 str.d_reserve = temp_res;
1574 utf32* temp_buf = d_buffer;
1575 d_buffer = str.d_buffer;
1576 str.d_buffer = temp_buf;
1579 if (temp_res <= CEGUI_STR_QUICKBUFF_SIZE)
1581 utf32 temp_qbf[CEGUI_STR_QUICKBUFF_SIZE];
1583 memcpy(temp_qbf, d_quickbuff, CEGUI_STR_QUICKBUFF_SIZE *
sizeof(utf32));
1584 memcpy(d_quickbuff, str.d_quickbuff, CEGUI_STR_QUICKBUFF_SIZE *
sizeof(utf32));
1585 memcpy(str.d_quickbuff, temp_qbf, CEGUI_STR_QUICKBUFF_SIZE *
sizeof(utf32));
1605 String& operator+=(
const String& str)
1629 String& append(
const String& str, size_type str_idx = 0, size_type str_num = npos)
1631 if (str.d_cplength < str_idx)
1632 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
1634 if ((str_num == npos) || (str_num > str.d_cplength - str_idx))
1635 str_num = str.d_cplength - str_idx;
1637 grow(d_cplength + str_num);
1638 memcpy(&ptr()[d_cplength], &str.ptr()[str_idx], str_num *
sizeof(utf32));
1639 setlen(d_cplength + str_num);
1660 String& operator+=(
const std::string& std_str)
1662 return append(std_str);
1688 String& append(
const std::string& std_str, size_type str_idx = 0, size_type str_num = npos)
1690 if (std_str.size() < str_idx)
1691 CEGUI_THROW(std::out_of_range(
"Index is out of range for std::string"));
1693 if ((str_num == npos) || (str_num > (size_type)std_str.size() - str_idx))
1694 str_num = (size_type)std_str.size() - str_idx;
1696 size_type newsze = d_cplength + str_num;
1699 utf32* pt = &ptr()[newsze-1];
1702 *pt-- = static_cast<utf32>(static_cast<unsigned char>(std_str[str_num]));
1727 String& operator+=(
const utf8* utf8_str)
1729 return append(utf8_str, utf_length(utf8_str));
1750 String& append(
const utf8* utf8_str)
1752 return append(utf8_str, utf_length(utf8_str));
1777 String& append(
const utf8* utf8_str, size_type len)
1780 CEGUI_THROW(std::length_error(
"Length for utf8 encoded string can not be 'npos'"));
1782 size_type encsz = encoded_size(utf8_str, len);
1783 size_type newsz = d_cplength + encsz;
1786 encode(utf8_str, &ptr()[d_cplength], encsz, len);
1805 String& operator+=(utf32 code_point)
1807 return append(1, code_point);
1825 String& append(size_type num, utf32 code_point)
1828 CEGUI_THROW(std::length_error(
"Code point count can not be 'npos'"));
1830 size_type newsz = d_cplength + num;
1833 utf32* p = &ptr()[d_cplength];
1855 void push_back(utf32 code_point)
1857 append(1, code_point);
1875 String& append(const_iterator iter_beg, const_iterator iter_end)
1877 return replace(end(), end(), iter_beg, iter_end);
1895 return append(cstr, strlen(cstr));
1913 return append(cstr, strlen(cstr));
1932 String& append(
const char* chars, size_type chars_len)
1934 if (chars_len == npos)
1935 CEGUI_THROW(std::length_error(
"Length for char array can not be 'npos'"));
1937 size_type newsz = d_cplength + chars_len;
1941 utf32* pt = &ptr()[newsz-1];
1944 *pt-- = static_cast<utf32>(static_cast<unsigned char>(chars[chars_len]));
1973 return insert(idx, str, 0, npos);
1998 String& insert(size_type idx,
const String& str, size_type str_idx, size_type str_num)
2000 if ((d_cplength < idx) || (str.d_cplength < str_idx))
2001 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
2003 if ((str_num == npos) || (str_num > str.d_cplength - str_idx))
2004 str_num = str.d_cplength - str_idx;
2006 size_type newsz = d_cplength + str_num;
2008 memmove(&ptr()[idx + str_num], &ptr()[idx], (d_cplength - idx) *
sizeof(utf32));
2009 memcpy(&ptr()[idx], &str.
ptr()[str_idx], str_num *
sizeof(utf32));
2035 String& insert(size_type idx,
const std::string& std_str)
2037 return insert(idx, std_str, 0, npos);
2066 String& insert(size_type idx,
const std::string& std_str, size_type str_idx, size_type str_num)
2068 if (d_cplength < idx)
2069 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
2071 if (std_str.size() < str_idx)
2072 CEGUI_THROW(std::out_of_range(
"Index is out of range for std::string"));
2074 if ((str_num == npos) || (str_num > (size_type)std_str.size() - str_idx))
2075 str_num = (size_type)std_str.size() - str_idx;
2077 size_type newsz = d_cplength + str_num;
2080 memmove(&ptr()[idx + str_num], &ptr()[idx], (d_cplength - idx) *
sizeof(utf32));
2082 utf32* pt = &ptr()[idx + str_num - 1];
2085 *pt-- = static_cast<utf32>(static_cast<unsigned char>(std_str[str_idx + str_num]));
2114 String& insert(size_type idx,
const utf8* utf8_str)
2116 return insert(idx, utf8_str, utf_length(utf8_str));
2144 String& insert(size_type idx,
const utf8* utf8_str, size_type len)
2146 if (d_cplength < idx)
2147 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
2150 CEGUI_THROW(std::length_error(
"Length of utf8 encoded string can not be 'npos'"));
2152 size_type encsz = encoded_size(utf8_str, len);
2153 size_type newsz = d_cplength + encsz;
2156 memmove(&ptr()[idx + encsz], &ptr()[idx], (d_cplength - idx) *
sizeof(utf32));
2157 encode(utf8_str, &ptr()[idx], encsz, len);
2184 if (d_cplength < idx)
2185 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
2188 CEGUI_THROW(std::length_error(
"Code point count can not be 'npos'"));
2193 memmove(&ptr()[idx + num], &ptr()[idx], (d_cplength - idx) *
sizeof(utf32));
2195 utf32* pt = &ptr()[idx + num - 1];
2223 void insert(iterator pos, size_type num, utf32 code_point)
2225 insert(safe_iter_dif(pos, begin()), num, code_point);
2243 iterator insert(iterator pos, utf32 code_point)
2245 insert(pos, 1, code_point);
2267 void insert(iterator iter_pos, const_iterator iter_beg, const_iterator iter_end)
2269 replace(iter_pos, iter_pos, iter_beg, iter_end);
2289 String& insert(size_type idx,
const char* cstr)
2291 return insert(idx, cstr, strlen(cstr));
2314 String& insert(size_type idx,
const char* chars, size_type chars_len)
2316 if (d_cplength < idx)
2317 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
2319 if (chars_len == npos)
2320 CEGUI_THROW(std::length_error(
"Length of char array can not be 'npos'"));
2322 size_type newsz = d_cplength + chars_len;
2325 memmove(&ptr()[idx + chars_len], &ptr()[idx], (d_cplength - idx) *
sizeof(utf32));
2327 utf32* pt = &ptr()[idx + chars_len - 1];
2330 *pt-- = static_cast<utf32>(static_cast<unsigned char>(chars[chars_len]));
2381 return erase(idx, 1);
2399 String& erase(size_type idx, size_type len)
2405 if (d_cplength <= idx)
2406 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
2409 len = d_cplength - idx;
2411 size_type newsz = d_cplength - len;
2413 memmove(&ptr()[idx], &ptr()[idx + len], (d_cplength - idx - len) *
sizeof(utf32));
2430 return erase(safe_iter_dif(pos, begin()), 1);
2448 return erase(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg));
2466 void resize(size_type num)
2468 resize(num, utf32());
2486 void resize(size_type num, utf32 code_point)
2488 if (num < d_cplength)
2494 append(num - d_cplength, code_point);
2521 String& replace(size_type idx, size_type len,
const String& str)
2523 return replace(idx, len, str, 0, npos);
2547 String& replace(iterator iter_beg, iterator iter_end,
const String& str)
2549 return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), str, 0, npos);
2577 String& replace(size_type idx, size_type len,
const String& str, size_type str_idx, size_type str_num)
2579 if ((d_cplength < idx) || (str.d_cplength < str_idx))
2580 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
2582 if (((str_idx + str_num) > str.d_cplength) || (str_num == npos))
2583 str_num = str.d_cplength - str_idx;
2585 if (((len + idx) > d_cplength) || (len == npos))
2586 len = d_cplength - idx;
2588 size_type newsz = d_cplength + str_num - len;
2592 if ((idx + len) < d_cplength)
2593 memmove(&ptr()[idx + str_num], &ptr()[len + idx], (d_cplength - idx - len) *
sizeof(utf32));
2595 memcpy(&ptr()[idx], &str.ptr()[str_idx], str_num *
sizeof(utf32));
2625 String& replace(size_type idx, size_type len,
const std::string& std_str)
2627 return replace(idx, len, std_str, 0, npos);
2655 String& replace(iterator iter_beg, iterator iter_end,
const std::string& std_str)
2657 return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), std_str, 0, npos);
2689 String& replace(size_type idx, size_type len,
const std::string& std_str, size_type str_idx, size_type str_num)
2691 if (d_cplength < idx)
2692 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
2694 if (std_str.size() < str_idx)
2695 CEGUI_THROW(std::out_of_range(
"Index is out of range for std::string"));
2697 if (((str_idx + str_num) > std_str.size()) || (str_num == npos))
2698 str_num = (size_type)std_str.size() - str_idx;
2700 if (((len + idx) > d_cplength) || (len == npos))
2701 len = d_cplength - idx;
2703 size_type newsz = d_cplength + str_num - len;
2707 if ((idx + len) < d_cplength)
2708 memmove(&ptr()[idx + str_num], &ptr()[len + idx], (d_cplength - idx - len) *
sizeof(utf32));
2710 utf32* pt = &ptr()[idx + str_num - 1];
2713 *pt-- = static_cast<utf32>(static_cast<unsigned char>(std_str[str_idx + str_num]));
2746 String& replace(size_type idx, size_type len,
const utf8* utf8_str)
2748 return replace(idx, len, utf8_str, utf_length(utf8_str));
2778 String& replace(iterator iter_beg, iterator iter_end,
const utf8* utf8_str)
2780 return replace(iter_beg, iter_end, utf8_str, utf_length(utf8_str));
2811 String& replace(size_type idx, size_type len,
const utf8* utf8_str, size_type str_len)
2813 if (d_cplength < idx)
2814 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
2816 if (str_len == npos)
2817 CEGUI_THROW(std::length_error(
"Length for utf8 encoded string can not be 'npos'"));
2819 if (((len + idx) > d_cplength) || (len == npos))
2820 len = d_cplength - idx;
2822 size_type encsz = encoded_size(utf8_str, str_len);
2823 size_type newsz = d_cplength + encsz - len;
2827 if ((idx + len) < d_cplength)
2828 memmove(&ptr()[idx + encsz], &ptr()[len + idx], (d_cplength - idx - len) *
sizeof(utf32));
2830 encode(utf8_str, &ptr()[idx], encsz, str_len);
2866 String& replace(iterator iter_beg, iterator iter_end,
const utf8* utf8_str, size_type str_len)
2868 return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), utf8_str, str_len);
2893 String& replace(size_type idx, size_type len, size_type num, utf32 code_point)
2895 if (d_cplength < idx)
2896 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
2899 CEGUI_THROW(std::length_error(
"Code point count can not be 'npos'"));
2901 if (((len + idx) > d_cplength) || (len == npos))
2902 len = d_cplength - idx;
2904 size_type newsz = d_cplength + num - len;
2908 if ((idx + len) < d_cplength)
2909 memmove(&ptr()[idx + num], &ptr()[len + idx], (d_cplength - idx - len) *
sizeof(utf32));
2911 utf32* pt = &ptr()[idx + num - 1];
2945 String& replace(iterator iter_beg, iterator iter_end, size_type num, utf32 code_point)
2947 return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), num, code_point);
2975 String& replace(iterator iter_beg, iterator iter_end, const_iterator iter_newBeg, const_iterator iter_newEnd)
2977 if (iter_newBeg == iter_newEnd)
2979 erase(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg));
2983 size_type str_len = safe_iter_dif(iter_newEnd, iter_newBeg);
2984 size_type idx = safe_iter_dif(iter_beg, begin());
2985 size_type len = safe_iter_dif(iter_end, iter_beg);
2987 if ((len + idx) > d_cplength)
2988 len = d_cplength - idx;
2990 size_type newsz = d_cplength + str_len - len;
2994 if ((idx + len) < d_cplength)
2995 memmove(&ptr()[idx + str_len], &ptr()[len + idx], (d_cplength - idx - len) *
sizeof(utf32));
2997 memcpy(&ptr()[idx], iter_newBeg.d_ptr, str_len *
sizeof(utf32));
3024 String& replace(size_type idx, size_type len,
const char* cstr)
3026 return replace(idx, len, cstr, strlen(cstr));
3051 String& replace(iterator iter_beg, iterator iter_end,
const char* cstr)
3053 return replace(iter_beg, iter_end, cstr, strlen(cstr));
3079 String& replace(size_type idx, size_type len,
const char* chars, size_type chars_len)
3081 if (d_cplength < idx)
3082 CEGUI_THROW(std::out_of_range(
"Index is out of range for CEGUI::String"));
3084 if (chars_len == npos)
3085 CEGUI_THROW(std::length_error(
"Length for the char array can not be 'npos'"));
3087 if (((len + idx) > d_cplength) || (len == npos))
3088 len = d_cplength - idx;
3090 size_type newsz = d_cplength + chars_len - len;
3094 if ((idx + len) < d_cplength)
3095 memmove(&ptr()[idx + chars_len], &ptr()[len + idx], (d_cplength - idx - len) *
sizeof(utf32));
3097 utf32* pt = &ptr()[idx + chars_len - 1];
3100 *pt-- = static_cast<utf32>(static_cast<unsigned char>(chars[chars_len]));
3131 String& replace(iterator iter_beg, iterator iter_end,
const char* chars, size_type chars_len)
3133 return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), chars, chars_len);
3154 size_type find(utf32 code_point, size_type idx = 0)
const
3156 if (idx < d_cplength)
3158 const utf32* pt = &ptr()[idx];
3160 while (idx < d_cplength)
3162 if (*pt++ == code_point)
3189 if (idx >= d_cplength)
3190 idx = d_cplength - 1;
3194 const utf32* pt = &ptr()[idx];
3198 if (*pt-- == code_point)
3201 }
while (idx-- != 0);
3225 size_type find(
const String& str, size_type idx = 0)
const
3227 if ((str.d_cplength == 0) && (idx < d_cplength))
3230 if (idx < d_cplength)
3233 while (d_cplength - idx >= str.d_cplength)
3235 if (0 == compare(idx, str.d_cplength, str))
3260 size_type rfind(
const String& str, size_type idx = npos)
const
3262 if (str.d_cplength == 0)
3263 return (idx < d_cplength) ? idx : d_cplength;
3265 if (str.d_cplength <= d_cplength)
3267 if (idx > (d_cplength - str.d_cplength))
3268 idx = d_cplength - str.d_cplength;
3272 if (0 == compare(idx, str.d_cplength, str))
3275 }
while (idx-- != 0);
3300 size_type find(
const std::string& std_str, size_type idx = 0)
const
3302 std::string::size_type sze = std_str.size();
3304 if ((sze == 0) && (idx < d_cplength))
3307 if (idx < d_cplength)
3310 while (d_cplength - idx >= sze)
3312 if (0 == compare(idx, (size_type)sze, std_str))
3341 size_type rfind(
const std::string& std_str, size_type idx = npos)
const
3343 std::string::size_type sze = std_str.size();
3346 return (idx < d_cplength) ? idx : d_cplength;
3348 if (sze <= d_cplength)
3350 if (idx > (d_cplength - sze))
3351 idx = d_cplength - sze;
3355 if (0 == compare(idx, (size_type)sze, std_str))
3358 }
while (idx-- != 0);
3387 size_type find(
const utf8* utf8_str, size_type idx = 0)
const
3389 return find(utf8_str, idx, utf_length(utf8_str));
3414 size_type rfind(
const utf8* utf8_str, size_type idx = npos)
const
3416 return rfind(utf8_str, idx, utf_length(utf8_str));
3444 size_type find(
const utf8* utf8_str, size_type idx, size_type str_len)
const
3446 if (str_len == npos)
3447 CEGUI_THROW(std::length_error(
"Length for utf8 encoded string can not be 'npos'"));
3449 size_type sze = encoded_size(utf8_str, str_len);
3451 if ((sze == 0) && (idx < d_cplength))
3454 if (idx < d_cplength)
3457 while (d_cplength - idx >= sze)
3459 if (0 == compare(idx, sze, utf8_str, sze))
3495 size_type rfind(
const utf8* utf8_str, size_type idx, size_type str_len)
const
3497 if (str_len == npos)
3498 CEGUI_THROW(std::length_error(
"Length for utf8 encoded string can not be 'npos'"));
3500 size_type sze = encoded_size(utf8_str, str_len);
3503 return (idx < d_cplength) ? idx : d_cplength;
3505 if (sze <= d_cplength)
3507 if (idx > (d_cplength - sze))
3508 idx = d_cplength - sze;
3512 if (0 == compare(idx, sze, utf8_str, sze))
3515 }
while (idx-- != 0);
3539 size_type find(
const char* cstr, size_type idx = 0)
const
3541 return find(cstr, idx, strlen(cstr));
3561 size_type rfind(
const char* cstr, size_type idx = npos)
const
3563 return rfind(cstr, idx, strlen(cstr));
3586 size_type find(
const char* chars, size_type idx, size_type chars_len)
const
3588 if (chars_len == npos)
3589 CEGUI_THROW(std::length_error(
"Length for char array can not be 'npos'"));
3591 if ((chars_len == 0) && (idx < d_cplength))
3594 if (idx < d_cplength)
3597 while (d_cplength - idx >= chars_len)
3599 if (0 == compare(idx, chars_len, chars, chars_len))
3630 size_type rfind(
const char* chars, size_type idx, size_type chars_len)
const
3632 if (chars_len == npos)
3633 CEGUI_THROW(std::length_error(
"Length for char array can not be 'npos'"));
3636 return (idx < d_cplength) ? idx : d_cplength;
3638 if (chars_len <= d_cplength)
3640 if (idx > (d_cplength - chars_len))
3641 idx = d_cplength - chars_len;
3645 if (0 == compare(idx, chars_len, chars, chars_len))
3648 }
while (idx-- != 0);
3673 size_type find_first_of(
const String& str, size_type idx = 0)
const
3675 if (idx < d_cplength)
3677 const utf32* pt = &ptr()[idx];
3681 if (npos != str.find(*pt++))
3684 }
while (++idx != d_cplength);
3705 size_type find_first_not_of(
const String& str, size_type idx = 0)
const
3707 if (idx < d_cplength)
3709 const utf32* pt = &ptr()[idx];
3713 if (npos == str.find(*pt++))
3716 }
while (++idx != d_cplength);
3744 if (idx < d_cplength)
3746 const utf32* pt = &ptr()[idx];
3750 if (npos != find_codepoint(std_str, *pt++))
3753 }
while (++idx != d_cplength);
3778 size_type find_first_not_of(
const std::string& std_str, size_type idx = 0)
const
3780 if (idx < d_cplength)
3782 const utf32* pt = &ptr()[idx];
3786 if (npos == find_codepoint(std_str, *pt++))
3789 }
while (++idx != d_cplength);
3821 return find_first_of(utf8_str, idx, utf_length(utf8_str));
3846 size_type find_first_not_of(
const utf8* utf8_str, size_type idx = 0)
const
3848 return find_first_not_of(utf8_str, idx, utf_length(utf8_str));
3876 size_type find_first_of(
const utf8* utf8_str, size_type idx, size_type str_len)
const
3878 if (str_len == npos)
3879 CEGUI_THROW(std::length_error(
"Length for utf8 encoded string can not be 'npos'"));
3881 if (idx < d_cplength)
3883 size_type encsze = encoded_size(utf8_str, str_len);
3885 const utf32* pt = &ptr()[idx];
3889 if (npos != find_codepoint(utf8_str, encsze, *pt++))
3892 }
while (++idx != d_cplength);
3924 size_type find_first_not_of(
const utf8* utf8_str, size_type idx, size_type str_len)
const
3926 if (str_len == npos)
3927 CEGUI_THROW(std::length_error(
"Length for utf8 encoded string can not be 'npos'"));
3929 if (idx < d_cplength)
3931 size_type encsze = encoded_size(utf8_str, str_len);
3933 const utf32* pt = &ptr()[idx];
3937 if (npos == find_codepoint(utf8_str, encsze, *pt++))
3940 }
while (++idx != d_cplength);
3962 size_type find_first_of(utf32 code_point, size_type idx = 0)
const
3964 return find(code_point, idx);
3983 size_type find_first_not_of(utf32 code_point, size_type idx = 0)
const
3985 if (idx < d_cplength)
3989 if ((*
this)[idx] != code_point)
3992 }
while(idx++ < d_cplength);
4016 size_type find_first_of(
const char* cstr, size_type idx = 0)
const
4018 return find_first_of(cstr, idx, strlen(cstr));
4038 size_type find_first_not_of(
const char* cstr, size_type idx = 0)
const
4040 return find_first_not_of(cstr, idx, strlen(cstr));
4063 size_type find_first_of(
const char* chars, size_type idx, size_type chars_len)
const
4065 if (chars_len == npos)
4066 CEGUI_THROW(std::length_error(
"Length for char array can not be 'npos'"));
4068 if (idx < d_cplength)
4070 const utf32* pt = &ptr()[idx];
4074 if (npos != find_codepoint(chars, chars_len, *pt++))
4077 }
while (++idx != d_cplength);
4104 size_type find_first_not_of(
const char* chars, size_type idx, size_type chars_len)
const
4106 if (chars_len == npos)
4107 CEGUI_THROW(std::length_error(
"Length for char array can not be 'npos'"));
4109 if (idx < d_cplength)
4111 const utf32* pt = &ptr()[idx];
4115 if (npos == find_codepoint(chars, chars_len, *pt++))
4118 }
while (++idx != d_cplength);
4143 size_type find_last_of(
const String& str, size_type idx = npos)
const
4147 if (idx >= d_cplength)
4148 idx = d_cplength - 1;
4150 const utf32* pt = &ptr()[idx];
4154 if (npos != str.
find(*pt--))
4157 }
while (idx-- != 0);
4178 size_type find_last_not_of(
const String& str, size_type idx = npos)
const
4182 if (idx >= d_cplength)
4183 idx = d_cplength - 1;
4185 const utf32* pt = &ptr()[idx];
4189 if (npos == str.
find(*pt--))
4192 }
while (idx-- != 0);
4218 size_type find_last_of(
const std::string& std_str, size_type idx = npos)
const
4222 if (idx >= d_cplength)
4223 idx = d_cplength - 1;
4225 const utf32* pt = &ptr()[idx];
4229 if (npos != find_codepoint(std_str, *pt--))
4232 }
while (idx-- != 0);
4257 size_type find_last_not_of(
const std::string& std_str, size_type idx = npos)
const
4261 if (idx >= d_cplength)
4262 idx = d_cplength - 1;
4264 const utf32* pt = &ptr()[idx];
4268 if (npos == find_codepoint(std_str, *pt--))
4271 }
while (idx-- != 0);
4301 size_type find_last_of(
const utf8* utf8_str, size_type idx = npos)
const
4303 return find_last_of(utf8_str, idx, utf_length(utf8_str));
4328 size_type find_last_not_of(
const utf8* utf8_str, size_type idx = npos)
const
4330 return find_last_not_of(utf8_str, idx, utf_length(utf8_str));
4358 size_type find_last_of(
const utf8* utf8_str, size_type idx, size_type str_len)
const
4360 if (str_len == npos)
4361 CEGUI_THROW(std::length_error(
"Length for utf8 encoded string can not be 'npos'"));
4365 if (idx >= d_cplength)
4366 idx = d_cplength - 1;
4368 size_type encsze = encoded_size(utf8_str, str_len);
4370 const utf32* pt = &ptr()[idx];
4374 if (npos != find_codepoint(utf8_str, encsze, *pt--))
4377 }
while (idx-- != 0);
4409 size_type find_last_not_of(
const utf8* utf8_str, size_type idx, size_type str_len)
const
4411 if (str_len == npos)
4412 CEGUI_THROW(std::length_error(
"Length for utf8 encoded string can not be 'npos'"));
4416 if (idx >= d_cplength)
4417 idx = d_cplength - 1;
4419 size_type encsze = encoded_size(utf8_str, str_len);
4421 const utf32* pt = &ptr()[idx];
4425 if (npos == find_codepoint(utf8_str, encsze, *pt--))
4428 }
while (idx-- != 0);
4450 size_type find_last_of(utf32 code_point, size_type idx = npos)
const
4452 return rfind(code_point, idx);
4469 size_type find_last_not_of(utf32 code_point, size_type idx = npos)
const
4473 if (idx >= d_cplength)
4474 idx = d_cplength - 1;
4478 if ((*
this)[idx] != code_point)
4481 }
while(idx-- != 0);
4507 return find_last_of(cstr, idx, strlen(cstr));
4527 size_type find_last_not_of(
const char* cstr, size_type idx = npos)
const
4529 return find_last_not_of(cstr, idx, strlen(cstr));
4552 size_type find_last_of(
const char* chars, size_type idx, size_type chars_len)
const
4554 if (chars_len == npos)
4555 CEGUI_THROW(std::length_error(
"Length for char array can not be 'npos'"));
4559 if (idx >= d_cplength)
4560 idx = d_cplength - 1;
4562 const utf32* pt = &ptr()[idx];
4566 if (npos != find_codepoint(chars, chars_len, *pt--))
4569 }
while (idx-- != 0);
4596 size_type find_last_not_of(
const char* chars, size_type idx, size_type chars_len)
const
4598 if (chars_len == npos)
4599 CEGUI_THROW(std::length_error(
"Length for char array can not be 'npos'"));
4603 if (idx >= d_cplength)
4604 idx = d_cplength - 1;
4606 const utf32* pt = &ptr()[idx];
4610 if (npos == find_codepoint(chars, chars_len, *pt--))
4613 }
while (idx-- != 0);
4639 String substr(size_type idx = 0, size_type len = npos)
const
4641 if (d_cplength < idx)
4642 CEGUI_THROW(std::out_of_range(
"Index is out of range for this CEGUI::String"));
4644 return String(*
this, idx, len);
4669 const_iterator begin(
void)
const
4671 return const_iterator(ptr());
4683 return iterator(&ptr()[d_cplength]);
4693 const_iterator end(
void)
const
4695 return const_iterator(&ptr()[d_cplength]);
4705 reverse_iterator rbegin(
void)
4707 return reverse_iterator(end());
4717 const_reverse_iterator rbegin(
void)
const
4719 return const_reverse_iterator(end());
4729 reverse_iterator rend(
void)
4731 return reverse_iterator(begin());
4741 const_reverse_iterator rend(
void)
const
4743 return const_reverse_iterator(begin());
4764 ptr()[len] = (utf32)(0);
4770 d_reserve = CEGUI_STR_QUICKBUFF_SIZE;
4772 d_encodedbufflen = 0;
4773 d_encodeddatlen = 0;
4779 bool inside(utf32* inptr)
4781 if (inptr < ptr() || ptr() + d_cplength <= inptr)
4788 size_type safe_iter_dif(
const const_iterator& iter1,
const const_iterator& iter2)
const
4790 return (iter1.d_ptr == 0) ? 0 : (iter1 - iter2);
4798 size_type encode(
const utf32* src, utf8* dest, size_type dest_len, size_type src_len = 0)
const
4803 src_len = utf_length(src);
4806 size_type destCapacity = dest_len;
4809 for (uint idx = 0; idx < src_len; ++idx)
4811 utf32 cp = src[idx];
4814 if (destCapacity < encoded_size(cp))
4824 else if (cp < 0x0800)
4826 *dest++ = (utf8)((cp >> 6) | 0xC0);
4827 *dest++ = (utf8)((cp & 0x3F) | 0x80);
4830 else if (cp < 0x10000)
4832 *dest++ = (utf8)((cp >> 12) | 0xE0);
4833 *dest++ = (utf8)(((cp >> 6) & 0x3F) | 0x80);
4834 *dest++ = (utf8)((cp & 0x3F) | 0x80);
4839 *dest++ = (utf8)((cp >> 18) | 0xF0);
4840 *dest++ = (utf8)(((cp >> 12) & 0x3F) | 0x80);
4841 *dest++ = (utf8)(((cp >> 6) & 0x3F) | 0x80);
4842 *dest++ = (utf8)((cp & 0x3F) | 0x80);
4848 return dest_len - destCapacity;
4851 size_type encode(
const utf8* src, utf32* dest, size_type dest_len, size_type src_len = 0)
const
4856 src_len = utf_length(src);
4859 size_type destCapacity = dest_len;
4862 for (uint idx = 0; ((idx < src_len) && (destCapacity > 0));)
4865 utf8 cu = src[idx++];
4873 cp = ((cu & 0x1F) << 6);
4874 cp |= (src[idx++] & 0x3F);
4878 cp = ((cu & 0x0F) << 12);
4879 cp |= ((src[idx++] & 0x3F) << 6);
4880 cp |= (src[idx++] & 0x3F);
4884 cp = ((cu & 0x07) << 18);
4885 cp |= ((src[idx++] & 0x3F) << 12);
4886 cp |= ((src[idx++] & 0x3F) << 6);
4887 cp |= (src[idx++] & 0x3F);
4894 return dest_len - destCapacity;
4898 size_type encoded_size(utf32 code_point)
const
4900 if (code_point < 0x80)
4902 else if (code_point < 0x0800)
4904 else if (code_point < 0x10000)
4911 size_type encoded_size(
const utf32* buf)
const
4913 return encoded_size(buf, utf_length(buf));
4917 size_type encoded_size(
const utf32* buf, size_type len)
const
4919 size_type count = 0;
4923 count += encoded_size(*buf++);
4930 size_type encoded_size(
const utf8* buf)
const
4932 return encoded_size(buf, utf_length(buf));
4936 size_type encoded_size(
const utf8* buf, size_type len)
const
4939 size_type count = 0;
4950 else if (tcp < 0xE0)
4955 else if (tcp < 0xF0)
4976 size_type utf_length(
const utf8* utf8_str)
const
4986 size_type utf_length(
const utf32* utf32_str)
const
4989 while (*utf32_str++)
4996 utf8* build_utf8_buff(
void)
const;
4999 int utf32_comp_utf32(
const utf32* buf1,
const utf32* buf2, size_type cp_count)
const
5004 while ((--cp_count) && (*buf1 == *buf2))
5007 return *buf1 - *buf2;
5011 int utf32_comp_char(
const utf32* buf1,
const char* buf2, size_type cp_count)
const
5016 while ((--cp_count) && (*buf1 == static_cast<utf32>(static_cast<unsigned char>(*buf2))))
5019 return *buf1 - static_cast<utf32>(static_cast<unsigned char>(*buf2));
5023 int utf32_comp_utf8(
const utf32* buf1,
const utf8* buf2, size_type cp_count)
const
5041 cp = ((cu & 0x1F) << 6);
5042 cp |= (*buf2++ & 0x3F);
5046 cp = ((cu & 0x0F) << 12);
5047 cp |= ((*buf2++ & 0x3F) << 6);
5048 cp |= (*buf2++ & 0x3F);
5052 cp = ((cu & 0x07) << 18);
5053 cp |= ((*buf2++ & 0x3F) << 12);
5054 cp |= ((*buf2++ & 0x3F) << 6);
5055 cp |= (*buf2++ & 0x3F);
5058 }
while ((*buf1++ == cp) && (--cp_count));
5060 return (*--buf1) - cp;
5064 size_type find_codepoint(
const std::string& str, utf32 code_point)
const
5066 size_type idx = 0, sze = (size_type)str.size();
5070 if (code_point == static_cast<utf32>(static_cast<unsigned char>(str[idx])))
5080 size_type find_codepoint(
const utf8* str, size_type len, utf32 code_point)
const
5087 while (idx != len) {
5096 cp = ((cu & 0x1F) << 6);
5097 cp |= (*str++ & 0x3F);
5101 cp = ((cu & 0x0F) << 12);
5102 cp |= ((*str++ & 0x3F) << 6);
5103 cp |= (*str++ & 0x3F);
5107 cp = ((cu & 0x07) << 18);
5108 cp |= ((*str++ & 0x3F) << 12);
5109 cp |= ((*str++ & 0x3F) << 6);
5110 cp |= (*str++ & 0x3F);
5113 if (code_point == cp)
5124 size_type find_codepoint(
const char* chars, size_type chars_len, utf32 code_point)
const
5126 for (size_type idx = 0; idx != chars_len; ++idx)
5128 if (code_point == static_cast<utf32>(static_cast<unsigned char>(chars[idx])))
5145 bool CEGUIEXPORT
operator==(
const String& str1,
const String& str2);
5151 bool CEGUIEXPORT
operator==(
const String& str,
const std::string& std_str);
5157 bool CEGUIEXPORT
operator==(
const std::string& std_str,
const String& str);
5163 bool CEGUIEXPORT
operator==(
const String& str,
const utf8* utf8_str);
5169 bool CEGUIEXPORT
operator==(
const utf8* utf8_str,
const String& str);
5175 bool CEGUIEXPORT
operator!=(
const String& str1,
const String& str2);
5181 bool CEGUIEXPORT
operator!=(
const String& str,
const std::string& std_str);
5187 bool CEGUIEXPORT
operator!=(
const std::string& std_str,
const String& str);
5193 bool CEGUIEXPORT
operator!=(
const String& str,
const utf8* utf8_str);
5199 bool CEGUIEXPORT
operator!=(
const utf8* utf8_str,
const String& str);
5205 bool CEGUIEXPORT
operator<(
const String& str1,
const String& str2);
5211 bool CEGUIEXPORT
operator<(
const String& str,
const std::string& std_str);
5217 bool CEGUIEXPORT
operator<(
const std::string& std_str,
const String& str);
5223 bool CEGUIEXPORT
operator<(
const String& str,
const utf8* utf8_str);
5229 bool CEGUIEXPORT
operator<(
const utf8* utf8_str,
const String& str);
5235 bool CEGUIEXPORT
operator>(
const String& str1,
const String& str2);
5241 bool CEGUIEXPORT
operator>(
const String& str,
const std::string& std_str);
5247 bool CEGUIEXPORT
operator>(
const std::string& std_str,
const String& str);
5253 bool CEGUIEXPORT
operator>(
const String& str,
const utf8* utf8_str);
5259 bool CEGUIEXPORT
operator>(
const utf8* utf8_str,
const String& str);
5265 bool CEGUIEXPORT
operator<=(
const String& str1,
const String& str2);
5271 bool CEGUIEXPORT
operator<=(
const String& str,
const std::string& std_str);
5277 bool CEGUIEXPORT
operator<=(
const std::string& std_str,
const String& str);
5283 bool CEGUIEXPORT
operator<=(
const String& str,
const utf8* utf8_str);
5289 bool CEGUIEXPORT
operator<=(
const utf8* utf8_str,
const String& str);
5295 bool CEGUIEXPORT
operator>=(
const String& str1,
const String& str2);
5301 bool CEGUIEXPORT
operator>=(
const String& str,
const std::string& std_str);
5307 bool CEGUIEXPORT
operator>=(
const std::string& std_str,
const String& str);
5313 bool CEGUIEXPORT
operator>=(
const String& str,
const utf8* utf8_str);
5319 bool CEGUIEXPORT
operator>=(
const utf8* utf8_str,
const String& str);
5325 bool CEGUIEXPORT
operator==(
const String& str,
const char* c_str);
5331 bool CEGUIEXPORT
operator==(
const char* c_str,
const String& str);
5337 bool CEGUIEXPORT
operator!=(
const String& str,
const char* c_str);
5343 bool CEGUIEXPORT
operator!=(
const char* c_str,
const String& str);
5349 bool CEGUIEXPORT
operator<(
const String& str,
const char* c_str);
5355 bool CEGUIEXPORT
operator<(
const char* c_str,
const String& str);
5361 bool CEGUIEXPORT
operator>(
const String& str,
const char* c_str);
5367 bool CEGUIEXPORT
operator>(
const char* c_str,
const String& str);
5373 bool CEGUIEXPORT
operator<=(
const String& str,
const char* c_str);
5379 bool CEGUIEXPORT
operator<=(
const char* c_str,
const String& str);
5385 bool CEGUIEXPORT
operator>=(
const String& str,
const char* c_str);
5391 bool CEGUIEXPORT
operator>=(
const char* c_str,
const String& str);
5411 String CEGUIEXPORT
operator+(
const String& str1,
const String& str2);
5428 String CEGUIEXPORT
operator+(
const String& str,
const std::string& std_str);
5445 String CEGUIEXPORT
operator+(
const std::string& std_str,
const String& str);
5462 String CEGUIEXPORT
operator+(
const String& str,
const utf8* utf8_str);
5479 String CEGUIEXPORT
operator+(
const utf8* utf8_str,
const String& str);
5496 String CEGUIEXPORT
operator+(
const String& str, utf32 code_point);
5513 String CEGUIEXPORT
operator+(utf32 code_point,
const String& str);
5530 String CEGUIEXPORT
operator+(
const String& str,
const char* c_str);
5547 String CEGUIEXPORT
operator+(
const char* c_str,
const String& str);
5553 CEGUIEXPORT std::ostream& operator<<(std::ostream& s,
const String& str);
5572 void CEGUIEXPORT
swap(String& str1, String& str2);
5579 struct StringFastLessCompare
5581 bool operator() (
const String& a,
const String& b)
const
5583 const size_t la = a.length();
5584 const size_t lb = b.length();
5586 return (memcmp(a.ptr(), b.ptr(), la *
sizeof(utf32)) < 0);
5597 #if CEGUI_STRING_CLASS == CEGUI_STRING_CLASS_STD
5599 typedef std::string String;
5601 #else // CEGUI_STRING_CLASS_STD_AO
5603 typedef std::basic_string<char, std::char_traits<char>, STLAllocatorWrapper<char, AllocatorConfig<STLAllocator>::Allocator> >
String;
5614 bool operator() (
const String& a,
const String& b)
const
5616 const size_t la = a.
length();
5617 const size_t lb = b.
length();
5625 #if defined(_MSC_VER)
5626 # pragma warning(disable : 4251)
5634 #endif // end of guard _CEGUIString_h_