MyGUI: MyGUI_UString.h Source File

MyGUI 3.4.3

MyGUI_UString.h
Go to the documentation of this file.
1// Modified from OpenGUI under lenient license
2// Original copyright details and licensing below:
3// OpenGUI (http://opengui.sourceforge.net)
4// This source code is released under the BSD License
5
6// Permission is given to the MyGUI project to use the contents of file within its
7// source and binary applications, as well as any derivative works, in accordance
8// with the terms of any license under which MyGUI is or will be distributed.
9//
10// MyGUI may relicense its copy of this file, as well as any OpenGUI released updates
11// to this file, under any terms that it deems fit, and is not required to maintain
12// the original BSD licensing terms of this file, however OpenGUI retains the right
13// to present its copy of this file under the terms of any license under which
14// OpenGUI is distributed.
15//
16// MyGUI is not required to release to OpenGUI any future changes that it makes to
17// this file, and understands and agrees that any such changes that are released
18// back to OpenGUI will become available under the terms of any license under which
19// OpenGUI is distributed.
20//
21// For brevity, this permission text may be removed from this file if desired.
22// The original record kept within the SourceForge (http://sourceforge.net/) tracker
23// is sufficient.
24//
25// - Eric Shorkey (zero/zeroskill) <opengui@rightbracket.com> [January 20th, 2007]
26
27#ifndef MYGUI_U_STRING_H_
28#define MYGUI_U_STRING_H_
29
30
31#include "MyGUI_Prerequest.h"
32#include "MyGUI_Types.h"
33
34// these are explained later
35#include <iterator>
36#include <string>
37#include <string_view>
38#include <stdexcept>
39
40namespace MyGUI
41{
42
43 /* READ THIS NOTICE BEFORE USING IN YOUR OWN APPLICATIONS
44 =NOTICE=
45 This class is not a complete Unicode solution. It purposefully does not
46 provide certain functionality, such as proper lexical sorting for
47 Unicode values. It does provide comparison operators for the sole purpose
48 of using UString as an index with std::map and other operator< sorted
49 containers, but it should NOT be relied upon for meaningful lexical
50 operations, such as alphabetical sorts. If you need this type of
51 functionality, look into using ICU instead (http://icu.sourceforge.net/).
52
53 =REQUIREMENTS=
54 There are a few requirements for proper operation. They are fairly small,
55 and shouldn't restrict usage on any reasonable target.
56 * Compiler must support unsigned 16-bit integer types
57 * Compiler must support signed 32-bit integer types
58 * wchar_t must be either UTF-16 or UTF-32 encoding, and specified as such
59 using the WCHAR_UTF16 macro as outlined below.
60 * You must include <iterator>, <string>, and <wchar>. Probably more, but
61 these are the most obvious.
62
63 =REQUIRED PREPROCESSOR MACROS=
64 This class requires two preprocessor macros to be defined in order to
65 work as advertised.
66 INT32 - must be mapped to a signed 32 bit integer (ex. #define INT32 int)
67 UINT16 - must be mapped to an unsigned 16 bit integer (ex. #define UINT32 unsigned short)
68
69 Additionally, a third macro should be defined to control the evaluation of wchar_t:
70 WCHAR_UTF16 - should be defined when wchar_t represents UTF-16 code points,
71 such as in Windows. Otherwise it is assumed that wchar_t is a 32-bit
72 integer representing UTF-32 code points.
73 */
74
75 // THIS IS A VERY BRIEF AUTO DETECTION. YOU MAY NEED TO TWEAK THIS
76#ifdef __STDC_ISO_10646__
77// for any compiler that provides this, wchar_t is guaranteed to hold any Unicode value with a single code point (32-bit or larger)
78// so we can safely skip the rest of the testing
79#else // #ifdef __STDC_ISO_10646__
80 #if defined(__WIN32__) || defined(_WIN32)
81 #define WCHAR_UTF16 // All currently known Windows platforms utilize UTF-16 encoding in wchar_t
82 #else // #if defined( __WIN32__ ) || defined( _WIN32 )
83 #if WCHAR_MAX <= 0xFFFF // this is a last resort fall back test; WCHAR_MAX is defined in <wchar.h>
84 #define WCHAR_UTF16 // best we can tell, wchar_t is not larger than 16-bit
85 #endif // #if WCHAR_MAX <= 0xFFFF
86 #endif // #if defined( __WIN32__ ) || defined( _WIN32 )
87#endif // #ifdef __STDC_ISO_10646__
88
89
90// MYGUI_IS_NATIVE_WCHAR_T means that wchar_t isn't a typedef of
91// uint16_t or uint32_t.
92#if MYGUI_COMPILER == MYGUI_COMPILER_MSVC
93
94 // Don't define wchar_t related functions since it'll duplicate
95 // with UString::code_point related functions when compile
96 // without /Zc:wchar_t, because in this case both of them are
97 // a typedef of uint16_t.
98 #if defined(_NATIVE_WCHAR_T_DEFINED)
99 #define MYGUI_IS_NATIVE_WCHAR_T 1
100 #else
101 #define MYGUI_IS_NATIVE_WCHAR_T 0
102 #endif
103#else // MYGUI_COMPILER != MYGUI_COMPILER_MSVC
104
105 // Assumed wchar_t is natively for other compilers
106 #define MYGUI_IS_NATIVE_WCHAR_T 1
107
108#endif // MYGUI_COMPILER == MYGUI_COMPILER_MSVC
109
110
111#if MYGUI_COMPILER == MYGUI_COMPILER_MSVC
112 // disable: warning C4275: non dll-interface class '***' used as base for dll-interface clas '***'
113 #pragma warning(push)
114 #pragma warning(disable : 4275)
115#endif
116
118
143 class MYGUI_EXPORT UString
144 {
145 // constants used in UTF-8 conversions
146 static const unsigned char _lead1 = 0xC0; //110xxxxx
147 static const unsigned char _lead1_mask = 0x1F; //00011111
148 static const unsigned char _lead2 = 0xE0; //1110xxxx
149 static const unsigned char _lead2_mask = 0x0F; //00001111
150 static const unsigned char _lead3 = 0xF0; //11110xxx
151 static const unsigned char _lead3_mask = 0x07; //00000111
152 static const unsigned char _lead4 = 0xF8; //111110xx
153 static const unsigned char _lead4_mask = 0x03; //00000011
154 static const unsigned char _lead5 = 0xFC; //1111110x
155 static const unsigned char _lead5_mask = 0x01; //00000001
156 static const unsigned char _cont = 0x80; //10xxxxxx
157 static const unsigned char _cont_mask = 0x3F; //00111111
158
159 public:
161 using size_type = size_t;
163 static const size_type npos = std::numeric_limits<size_t>::max();
164
166 using unicode_char = uint32;
167
169 using code_point = uint16;
170
172 using value_type = code_point;
173
174 using dstring = std::basic_string<code_point>; // data string
175
177 using utf32string = std::basic_string<unicode_char>;
178
180 class MYGUI_EXPORT invalid_data : public std::runtime_error
181 {
182 public:
184 explicit invalid_data(const std::string& _message) :
185 std::runtime_error(_message)
186 {
187 /* The thing is, Bob, it's not that I'm lazy, it's that I just don't care. */
188 }
189 };
190
191 //#########################################################################
193 class MYGUI_EXPORT _base_iterator
194 {
195 friend class UString;
196
197 protected:
198 using difference_type = ptrdiff_t;
199
200 void _seekFwd(size_type c);
201 void _seekRev(size_type c);
202 void _become(const _base_iterator& i);
203 bool _test_begin() const;
204 bool _test_end() const;
205 size_type _get_index() const;
206 void _jump_to(size_type index);
207
208 unicode_char _getCharacter() const;
209 int _setCharacter(unicode_char uc);
210
211 void _moveNext();
212 void _movePrev();
213
214 dstring::iterator mIter;
215 UString* mString{nullptr};
216 };
217
218 //#########################################################################
219 // FORWARD ITERATORS
220 //#########################################################################
221 class _const_fwd_iterator; // forward declaration
222
224 class MYGUI_EXPORT _fwd_iterator : public _base_iterator
225 {
226 public:
228 _fwd_iterator& operator++();
230 _fwd_iterator operator++(int);
231
233 _fwd_iterator& operator--();
235 _fwd_iterator operator--(int);
236
238 _fwd_iterator operator+(difference_type n);
240 _fwd_iterator operator-(difference_type n);
241
243 _fwd_iterator& operator+=(difference_type n);
245 _fwd_iterator& operator-=(difference_type n);
246
248 value_type& operator*() const;
249
251 value_type& operator[](difference_type n) const;
252
254 _fwd_iterator& moveNext();
256 _fwd_iterator& movePrev();
258 unicode_char getCharacter() const;
260 int setCharacter(unicode_char uc);
261 };
262
263
264 //#########################################################################
266 class MYGUI_EXPORT _const_fwd_iterator : public _base_iterator
267 {
268 public:
269 _const_fwd_iterator();
270
271 _const_fwd_iterator(const _fwd_iterator& i);
272
274 _const_fwd_iterator& operator++();
276 _const_fwd_iterator operator++(int);
277
279 _const_fwd_iterator& operator--();
281 _const_fwd_iterator operator--(int);
282
284 _const_fwd_iterator operator+(difference_type n);
286 _const_fwd_iterator operator-(difference_type n);
287
289 _const_fwd_iterator& operator+=(difference_type n);
291 _const_fwd_iterator& operator-=(difference_type n);
292
294 const value_type& operator*() const;
295
297 const value_type& operator[](difference_type n) const;
298
300 _const_fwd_iterator& moveNext();
302 _const_fwd_iterator& movePrev();
304 unicode_char getCharacter() const;
305
307 friend size_type operator-(const _const_fwd_iterator& left, const _const_fwd_iterator& right);
309 friend bool operator==(const _const_fwd_iterator& left, const _const_fwd_iterator& right);
311 friend bool operator!=(const _const_fwd_iterator& left, const _const_fwd_iterator& right);
313 friend bool operator<(const _const_fwd_iterator& left, const _const_fwd_iterator& right);
315 friend bool operator<=(const _const_fwd_iterator& left, const _const_fwd_iterator& right);
317 friend bool operator>(const _const_fwd_iterator& left, const _const_fwd_iterator& right);
319 friend bool operator>=(const _const_fwd_iterator& left, const _const_fwd_iterator& right);
320 };
321
322 //#########################################################################
323 // REVERSE ITERATORS
324 //#########################################################################
325 class _const_rev_iterator; // forward declaration
327 class MYGUI_EXPORT _rev_iterator : public _base_iterator
328 {
329 public:
331 _rev_iterator& operator++();
333 _rev_iterator operator++(int);
334
336 _rev_iterator& operator--();
338 _rev_iterator operator--(int);
339
341 _rev_iterator operator+(difference_type n);
343 _rev_iterator operator-(difference_type n);
344
346 _rev_iterator& operator+=(difference_type n);
348 _rev_iterator& operator-=(difference_type n);
349
351 value_type& operator*() const;
352
354 value_type& operator[](difference_type n) const;
355 };
356 //#########################################################################
358 class MYGUI_EXPORT _const_rev_iterator : public _base_iterator
359 {
360 public:
361 _const_rev_iterator();
362
363 _const_rev_iterator(const _rev_iterator& i);
365 _const_rev_iterator& operator++();
367 _const_rev_iterator operator++(int);
368
370 _const_rev_iterator& operator--();
372 _const_rev_iterator operator--(int);
373
375 _const_rev_iterator operator+(difference_type n);
377 _const_rev_iterator operator-(difference_type n);
378
380 _const_rev_iterator& operator+=(difference_type n);
382 _const_rev_iterator& operator-=(difference_type n);
383
385 const value_type& operator*() const;
386
388 const value_type& operator[](difference_type n) const;
389
391 friend size_type operator-(const _const_rev_iterator& left, const _const_rev_iterator& right);
393 friend bool operator==(const _const_rev_iterator& left, const _const_rev_iterator& right);
395 friend bool operator!=(const _const_rev_iterator& left, const _const_rev_iterator& right);
397 friend bool operator<(const _const_rev_iterator& left, const _const_rev_iterator& right);
399 friend bool operator<=(const _const_rev_iterator& left, const _const_rev_iterator& right);
401 friend bool operator>(const _const_rev_iterator& left, const _const_rev_iterator& right);
403 friend bool operator>=(const _const_rev_iterator& left, const _const_rev_iterator& right);
404 };
405 //#########################################################################
406
407 using iterator = _fwd_iterator;
408 using reverse_iterator = _rev_iterator;
409 using const_iterator = _const_fwd_iterator;
410 using const_reverse_iterator = _const_rev_iterator;
411
412
414
415
416 UString();
418 UString(const UString& copy);
420 UString(size_type length, const code_point& ch);
422 UString(const code_point* str);
424 UString(const code_point* str, size_type length);
426 UString(const UString& str, size_type index, size_type length);
427#if MYGUI_IS_NATIVE_WCHAR_T
429 UString(const wchar_t* w_str);
431 UString(const wchar_t* w_str, size_type length);
432#endif
434 UString(const std::wstring& wstr);
436 UString(const char* c_str);
438 UString(const char* c_str, size_type length);
440 UString(const std::string& str);
441
442 explicit UString(const utf32string& str);
443
444 template<size_type num>
445 UString(const char (&str)[num]) :
446 UString(str, num)
447 {
448 }
449
450 explicit UString(std::string_view str) :
451 UString(str.data(), str.size())
452 {
453 }
454
455 ~UString();
457
459
461
462
463 size_type size() const;
465 size_type length() const;
467
468 size_type length_Characters() const;
470 size_type max_size() const;
472 void reserve(size_type size);
474 void resize(size_type num, const code_point& val = 0);
476 void swap(UString& from);
478 bool empty() const;
480 const code_point* c_str() const;
482 const code_point* data() const;
484 size_type capacity() const;
486 void clear();
488
489 UString substr(size_type index, size_type num = npos) const;
491 void push_back(unicode_char val);
492#if MYGUI_IS_NATIVE_WCHAR_T
494 void push_back(wchar_t val);
495#endif
497
499 void push_back(code_point val);
501
502 void push_back(char val);
504 bool inString(unicode_char ch) const;
506
508
510
511
512 const std::string& asUTF8() const;
514 const char* asUTF8_c_str() const;
516 const utf32string& asUTF32() const;
518 const unicode_char* asUTF32_c_str() const;
520 const std::wstring& asWStr() const;
522 const wchar_t* asWStr_c_str() const;
524
526
528
529
530 code_point& at(size_type loc);
532 const code_point& at(size_type loc) const;
534
538 unicode_char getChar(size_type loc) const;
540
548 int setChar(size_type loc, unicode_char ch);
550
552
554
555
556 iterator begin();
558 const_iterator begin() const;
560 iterator end();
562 const_iterator end() const;
564 reverse_iterator rbegin();
566 const_reverse_iterator rbegin() const;
568 reverse_iterator rend();
570 const_reverse_iterator rend() const;
572
574
576
577
578 UString& assign(iterator start, iterator end);
580 UString& assign(const UString& str);
582 UString& assign(const code_point* str);
584 UString& assign(const code_point* str, size_type num);
586 UString& assign(const UString& str, size_type index, size_type len);
588 UString& assign(size_type num, const code_point& ch);
590 UString& assign(const std::wstring& wstr);
591#if MYGUI_IS_NATIVE_WCHAR_T
593 UString& assign(const wchar_t* w_str);
595 UString& assign(const wchar_t* w_str, size_type num);
596#endif
598 UString& assign(std::string_view str)
599 {
600 return assign(str.data(), str.size());
601 }
602
603 UString& assign(const utf32string& str);
605 UString& assign(const char* c_str, size_type num);
607
609
611
612
613 UString& append(const UString& str);
615 UString& append(const code_point* str);
617 UString& append(const UString& str, size_type index, size_type len);
619 UString& append(const code_point* str, size_type num);
621 UString& append(size_type num, code_point ch);
623 UString& append(iterator start, iterator end);
624#if MYGUI_IS_NATIVE_WCHAR_T
626 UString& append(const wchar_t* w_str, size_type num);
628 UString& append(size_type num, wchar_t ch);
629#endif
631 UString& append(const char* c_str, size_type num);
633 UString& append(size_type num, char ch);
635 UString& append(size_type num, unicode_char ch);
637
639
641
642
643 iterator insert(iterator i, const code_point& ch);
645 UString& insert(size_type index, const UString& str);
647 UString& insert(size_type index, const code_point* str)
648 {
649 mData.insert(index, str);
650 return *this;
651 }
652
653 UString& insert(size_type index1, const UString& str, size_type index2, size_type num);
655 void insert(iterator i, iterator start, iterator end);
657 UString& insert(size_type index, const code_point* str, size_type num);
658#if MYGUI_IS_NATIVE_WCHAR_T
660 UString& insert(size_type index, const wchar_t* w_str, size_type num);
661#endif
663 UString& insert(size_type index, const char* c_str, size_type num);
665 UString& insert(size_type index, size_type num, code_point ch);
666#if MYGUI_IS_NATIVE_WCHAR_T
668 UString& insert(size_type index, size_type num, wchar_t ch);
669#endif
671 UString& insert(size_type index, size_type num, char ch);
673 UString& insert(size_type index, size_type num, unicode_char ch);
675 void insert(iterator i, size_type num, const code_point& ch);
676#if MYGUI_IS_NATIVE_WCHAR_T
678 void insert(iterator i, size_type num, const wchar_t& ch);
679#endif
681 void insert(iterator i, size_type num, const char& ch);
683 void insert(iterator i, size_type num, const unicode_char& ch);
685
687
689
690
691 iterator erase(iterator loc);
693 iterator erase(iterator start, iterator end);
695 UString& erase(size_type index = 0, size_type num = npos);
697
699
701
702
703 UString& replace(size_type index1, size_type num1, const UString& str);
705 UString& replace(size_type index1, size_type num1, const UString& str, size_type num2);
707 UString& replace(size_type index1, size_type num1, const UString& str, size_type index2, size_type num2);
709 UString& replace(iterator start, iterator end, const UString& str, size_type num = npos);
711 UString& replace(size_type index, size_type num1, size_type num2, code_point ch);
713 UString& replace(iterator start, iterator end, size_type num, code_point ch);
715
717
719
720
721 int compare(const UString& str) const;
723 int compare(const code_point* str) const;
725 int compare(size_type index, size_type length, const UString& str) const;
727 int compare(size_type index, size_type length, const UString& str, size_type index2, size_type length2) const;
729 int compare(size_type index, size_type length, const code_point* str, size_type length2) const;
730#if MYGUI_IS_NATIVE_WCHAR_T
732 int compare(size_type index, size_type length, const wchar_t* w_str, size_type length2) const;
733#endif
735 int compare(size_type index, size_type length, const char* c_str, size_type length2) const;
737
739
741
742
744 size_type find(const UString& str, size_type index = 0) const;
746
747 size_type find(const code_point* cp_str, size_type index, size_type length) const;
749
750 size_type find(const char* c_str, size_type index, size_type length) const;
751#if MYGUI_IS_NATIVE_WCHAR_T
753
754 size_type find(const wchar_t* w_str, size_type index, size_type length) const;
755#endif
757
758 size_type find(char ch, size_type index = 0) const;
760
761 size_type find(code_point ch, size_type index = 0) const;
762#if MYGUI_IS_NATIVE_WCHAR_T
764
765 size_type find(wchar_t ch, size_type index = 0) const;
766#endif
768
769 size_type find(unicode_char ch, size_type index = 0) const;
770
772 size_type rfind(const UString& str, size_type index = 0) const;
774 size_type rfind(const code_point* cp_str, size_type index, size_type num) const;
776 size_type rfind(const char* c_str, size_type index, size_type num) const;
777#if MYGUI_IS_NATIVE_WCHAR_T
779 size_type rfind(const wchar_t* w_str, size_type index, size_type num) const;
780#endif
782 size_type rfind(char ch, size_type index = 0) const;
784 size_type rfind(code_point ch, size_type index) const;
785#if MYGUI_IS_NATIVE_WCHAR_T
787 size_type rfind(wchar_t ch, size_type index = 0) const;
788#endif
790 size_type rfind(unicode_char ch, size_type index = 0) const;
792
794
796
797
798 size_type find_first_of(const UString& str, size_type index = 0, size_type num = npos) const;
800 size_type find_first_of(code_point ch, size_type index = 0) const;
802 size_type find_first_of(char ch, size_type index = 0) const;
803#if MYGUI_IS_NATIVE_WCHAR_T
805 size_type find_first_of(wchar_t ch, size_type index = 0) const;
806#endif
808 size_type find_first_of(unicode_char ch, size_type index = 0) const;
809
811 size_type find_first_not_of(const UString& str, size_type index = 0, size_type num = npos) const;
813 size_type find_first_not_of(code_point ch, size_type index = 0) const;
815 size_type find_first_not_of(char ch, size_type index = 0) const;
816#if MYGUI_IS_NATIVE_WCHAR_T
818 size_type find_first_not_of(wchar_t ch, size_type index = 0) const;
819#endif
821 size_type find_first_not_of(unicode_char ch, size_type index = 0) const;
822
824 size_type find_last_of(const UString& str, size_type index = npos, size_type num = npos) const;
826 size_type find_last_of(code_point ch, size_type index = npos) const;
828 size_type find_last_of(char ch, size_type index = npos) const
829 {
830 return find_last_of(static_cast<code_point>(ch), index);
831 }
832#if MYGUI_IS_NATIVE_WCHAR_T
834 size_type find_last_of(wchar_t ch, size_type index = npos) const;
835#endif
837 size_type find_last_of(unicode_char ch, size_type index = npos) const;
838
840 size_type find_last_not_of(const UString& str, size_type index = npos, size_type num = npos) const;
842 size_type find_last_not_of(code_point ch, size_type index = npos) const;
844 size_type find_last_not_of(char ch, size_type index = npos) const;
845#if MYGUI_IS_NATIVE_WCHAR_T
847 size_type find_last_not_of(wchar_t ch, size_type index = npos) const;
848#endif
850 size_type find_last_not_of(unicode_char ch, size_type index = npos) const;
852
854
856
857
858 bool operator<(const UString& right) const;
860 bool operator<=(const UString& right) const;
862 bool operator>(const UString& right) const;
864 bool operator>=(const UString& right) const;
866 bool operator==(const UString& right) const;
868 bool operator!=(const UString& right) const;
870 UString& operator=(const UString& s);
872 UString& operator=(code_point ch);
874 UString& operator=(char ch);
875#if MYGUI_IS_NATIVE_WCHAR_T
877 UString& operator=(wchar_t ch);
878#endif
880 UString& operator=(unicode_char ch);
882 code_point& operator[](size_type index);
884 const code_point& operator[](size_type index) const;
886
888
890
891
892 operator std::string() const;
894 operator std::wstring() const;
896 operator std::string_view() const
897 {
898 return asUTF8();
899 }
900
901
903
905
906
907 static bool _utf16_independent_char(code_point cp);
909 static bool _utf16_surrogate_lead(code_point cp);
911 static bool _utf16_surrogate_follow(code_point cp);
913 static size_t _utf16_char_length(code_point cp);
915 static size_t _utf16_char_length(unicode_char uc);
917
921 static size_t _utf16_to_utf32(const code_point in_cp[2], unicode_char& out_uc);
923
928 static size_t _utf32_to_utf16(const unicode_char& in_uc, code_point out_cp[2]);
930
932
934
935
936 static bool _utf8_start_char(unsigned char cp);
938 static size_t _utf8_char_length(unsigned char cp);
940 static size_t _utf8_char_length(unicode_char uc);
941
943 static size_t _utf8_to_utf32(const unsigned char in_cp[6], unicode_char& out_uc);
945 static size_t _utf32_to_utf8(const unicode_char& in_uc, unsigned char out_cp[6]);
946
948 static size_type _verifyUTF8(const unsigned char* c_str);
950 static size_type _verifyUTF8(std::string_view str)
951 {
952 return _verifyUTF8(str.data(), str.size());
953 }
954
955 static size_type _verifyUTF8(const char* c_str, size_type num);
957
958 private:
959 dstring mData;
960
962 enum BufferType
963 {
964 bt_none,
965 bt_string,
966 bt_wstring,
967 bt_utf32string
968 };
969
971 void _init();
972
974 // Scratch buffer
976 void _cleanBuffer() const;
977
979 void _getBufferStr() const;
981 void _getBufferWStr() const;
983 void _getBufferUTF32Str() const;
984
985 void _load_buffer_UTF8() const;
986 void _load_buffer_WStr() const;
987 void _load_buffer_UTF32() const;
988
989 mutable BufferType m_bufferType; // identifies the data type held in m_buffer
990 mutable size_t m_bufferSize; // size of the CString buffer
991
992 // multi-purpose buffer used everywhere we need a throw-away buffer
993 union
994 {
995 mutable void* mVoidBuffer;
996 mutable std::string* mStrBuffer;
997 mutable std::wstring* mWStrBuffer;
998 mutable utf32string* mUTF32StrBuffer;
999 } m_buffer;
1000 };
1001
1003 inline UString operator+(const UString& s1, const UString& s2)
1004 {
1005 return UString(s1).append(s2);
1006 }
1007
1008 inline UString operator+(const UString& s1, UString::code_point c)
1009 {
1010 return UString(s1).append(1, c);
1011 }
1012
1013 inline UString operator+(const UString& s1, UString::unicode_char c)
1014 {
1015 return UString(s1).append(1, c);
1016 }
1017
1018 inline UString operator+(const UString& s1, char c)
1019 {
1020 return UString(s1).append(1, c);
1021 }
1022#if MYGUI_IS_NATIVE_WCHAR_T
1024 inline UString operator+(const UString& s1, wchar_t c)
1025 {
1026 return UString(s1).append(1, c);
1027 }
1028#endif
1030 inline UString operator+(UString::code_point c, const UString& s2)
1031 {
1032 return UString().append(1, c).append(s2);
1033 }
1034
1035 inline UString operator+(UString::unicode_char c, const UString& s2)
1036 {
1037 return UString().append(1, c).append(s2);
1038 }
1039
1040 inline UString operator+(char c, const UString& s2)
1041 {
1042 return UString().append(1, c).append(s2);
1043 }
1044#if MYGUI_IS_NATIVE_WCHAR_T
1046 inline UString operator+(wchar_t c, const UString& s2)
1047 {
1048 return UString().append(1, c).append(s2);
1049 }
1050#endif
1051
1052 // (const) forward iterator common operators
1053 inline UString::size_type operator-(
1054 const UString::_const_fwd_iterator& left,
1055 const UString::_const_fwd_iterator& right)
1056 {
1057 return (left.mIter - right.mIter);
1058 }
1059 inline bool operator==(const UString::_const_fwd_iterator& left, const UString::_const_fwd_iterator& right)
1060 {
1061 return left.mIter == right.mIter;
1062 }
1063 inline bool operator!=(const UString::_const_fwd_iterator& left, const UString::_const_fwd_iterator& right)
1064 {
1065 return left.mIter != right.mIter;
1066 }
1067 inline bool operator<(const UString::_const_fwd_iterator& left, const UString::_const_fwd_iterator& right)
1068 {
1069 return left.mIter < right.mIter;
1070 }
1071 inline bool operator<=(const UString::_const_fwd_iterator& left, const UString::_const_fwd_iterator& right)
1072 {
1073 return left.mIter <= right.mIter;
1074 }
1075 inline bool operator>(const UString::_const_fwd_iterator& left, const UString::_const_fwd_iterator& right)
1076 {
1077 return left.mIter > right.mIter;
1078 }
1079 inline bool operator>=(const UString::_const_fwd_iterator& left, const UString::_const_fwd_iterator& right)
1080 {
1081 return left.mIter >= right.mIter;
1082 }
1083
1084 // (const) reverse iterator common operators
1085 // NB: many of these operations are evaluated in reverse because this is a reverse iterator wrapping a forward iterator
1086 inline UString::size_type operator-(
1087 const UString::_const_rev_iterator& left,
1088 const UString::_const_rev_iterator& right)
1089 {
1090 return (right.mIter - left.mIter);
1091 }
1092 inline bool operator==(const UString::_const_rev_iterator& left, const UString::_const_rev_iterator& right)
1093 {
1094 return left.mIter == right.mIter;
1095 }
1096 inline bool operator!=(const UString::_const_rev_iterator& left, const UString::_const_rev_iterator& right)
1097 {
1098 return left.mIter != right.mIter;
1099 }
1100 inline bool operator<(const UString::_const_rev_iterator& left, const UString::_const_rev_iterator& right)
1101 {
1102 return right.mIter < left.mIter;
1103 }
1104 inline bool operator<=(const UString::_const_rev_iterator& left, const UString::_const_rev_iterator& right)
1105 {
1106 return right.mIter <= left.mIter;
1107 }
1108 inline bool operator>(const UString::_const_rev_iterator& left, const UString::_const_rev_iterator& right)
1109 {
1110 return right.mIter > left.mIter;
1111 }
1112 inline bool operator>=(const UString::_const_rev_iterator& left, const UString::_const_rev_iterator& right)
1113 {
1114 return right.mIter >= left.mIter;
1115 }
1116
1118 inline std::ostream& operator<<(std::ostream& os, const UString& s)
1119 {
1120 return os << s.asUTF8();
1121 }
1122
1124 inline std::wostream& operator<<(std::wostream& os, const UString& s)
1125 {
1126 return os << s.asWStr();
1127 }
1128
1129#if MYGUI_COMPILER == MYGUI_COMPILER_MSVC
1130 #pragma warning(pop)
1131#endif
1132
1133} // namespace MyGUI
1134
1135#endif // __MYGUI_U_STRING_H__
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI_Types.h
MyGUI::UString::_base_iterator
base iterator class for UString
Definition MyGUI_UString.h:194
MyGUI::UString::_base_iterator::_movePrev
void _movePrev()
Definition MyGUI_UString.cpp:83
MyGUI::UString::_base_iterator::difference_type
ptrdiff_t difference_type
Definition MyGUI_UString.h:198
MyGUI::UString::_base_iterator::UString
friend class UString
Definition MyGUI_UString.h:195
MyGUI::UString::_base_iterator::_setCharacter
int _setCharacter(unicode_char uc)
Definition MyGUI_UString.cpp:56
MyGUI::UString::_base_iterator::_get_index
size_type _get_index() const
Definition MyGUI_UString.cpp:40
MyGUI::UString::_base_iterator::_become
void _become(const _base_iterator &i)
Definition MyGUI_UString.cpp:24
MyGUI::UString::_base_iterator::mIter
dstring::iterator mIter
Definition MyGUI_UString.h:214
MyGUI::UString::_base_iterator::_seekRev
void _seekRev(size_type c)
Definition MyGUI_UString.cpp:19
MyGUI::UString::_base_iterator::_test_begin
bool _test_begin() const
Definition MyGUI_UString.cpp:30
MyGUI::UString::_base_iterator::_test_end
bool _test_end() const
Definition MyGUI_UString.cpp:35
MyGUI::UString::_base_iterator::_jump_to
void _jump_to(size_type index)
Definition MyGUI_UString.cpp:45
MyGUI::UString::_base_iterator::mString
UString * mString
Definition MyGUI_UString.h:215
MyGUI::UString::_base_iterator::_seekFwd
void _seekFwd(size_type c)
Definition MyGUI_UString.cpp:14
MyGUI::UString::_base_iterator::_moveNext
void _moveNext()
Definition MyGUI_UString.cpp:64
MyGUI::UString::_base_iterator::_getCharacter
unicode_char _getCharacter() const
Definition MyGUI_UString.cpp:50
MyGUI::UString::_const_fwd_iterator
const forward iterator for UString
Definition MyGUI_UString.h:267
MyGUI::UString::_const_fwd_iterator::operator<=
friend bool operator<=(const _const_fwd_iterator &left, const _const_fwd_iterator &right)
less than or equal
Definition MyGUI_UString.h:1071
MyGUI::UString::_const_fwd_iterator::operator>=
friend bool operator>=(const _const_fwd_iterator &left, const _const_fwd_iterator &right)
greater than or equal
Definition MyGUI_UString.h:1079
MyGUI::UString::_const_fwd_iterator::operator!=
friend bool operator!=(const _const_fwd_iterator &left, const _const_fwd_iterator &right)
inequality operator
Definition MyGUI_UString.h:1063
MyGUI::UString::_const_fwd_iterator::operator<
friend bool operator<(const _const_fwd_iterator &left, const _const_fwd_iterator &right)
less than
Definition MyGUI_UString.h:1067
MyGUI::UString::_const_fwd_iterator::_const_fwd_iterator
_const_fwd_iterator()
MyGUI::UString::_const_fwd_iterator::operator+=
_const_fwd_iterator & operator+=(difference_type n)
addition assignment operator
Definition MyGUI_UString.cpp:258
MyGUI::UString::_const_fwd_iterator::operator++
_const_fwd_iterator & operator++()
pre-increment
Definition MyGUI_UString.cpp:212
MyGUI::UString::_const_fwd_iterator::operator-
_const_fwd_iterator operator-(difference_type n)
subtraction operator
Definition MyGUI_UString.cpp:248
MyGUI::UString::_const_fwd_iterator::operator-=
_const_fwd_iterator & operator-=(difference_type n)
subtraction assignment operator
Definition MyGUI_UString.cpp:267
MyGUI::UString::_const_fwd_iterator::moveNext
_const_fwd_iterator & moveNext()
advances to the next Unicode character, honoring surrogate pairs in the UTF-16 stream
Definition MyGUI_UString.cpp:288
MyGUI::UString::_const_fwd_iterator::operator[]
const value_type & operator[](difference_type n) const
dereference at offset operator
Definition MyGUI_UString.cpp:281
MyGUI::UString::_const_fwd_iterator::operator--
_const_fwd_iterator & operator--()
pre-decrement
Definition MyGUI_UString.cpp:225
MyGUI::UString::_const_fwd_iterator::operator==
friend bool operator==(const _const_fwd_iterator &left, const _const_fwd_iterator &right)
equality operator
Definition MyGUI_UString.h:1059
MyGUI::UString::_const_fwd_iterator::operator+
_const_fwd_iterator operator+(difference_type n)
addition operator
Definition MyGUI_UString.cpp:238
MyGUI::UString::_const_fwd_iterator::operator>
friend bool operator>(const _const_fwd_iterator &left, const _const_fwd_iterator &right)
greater than
Definition MyGUI_UString.h:1075
MyGUI::UString::_const_fwd_iterator::movePrev
_const_fwd_iterator & movePrev()
rewinds to the previous Unicode character, honoring surrogate pairs in the UTF-16 stream
Definition MyGUI_UString.cpp:294
MyGUI::UString::_const_fwd_iterator::getCharacter
unicode_char getCharacter() const
Returns the Unicode value of the character at the current position (decodes surrogate pairs if needed...
Definition MyGUI_UString.cpp:300
MyGUI::UString::_const_fwd_iterator::operator*
const value_type & operator*() const
dereference operator
Definition MyGUI_UString.cpp:276
MyGUI::UString::_const_rev_iterator
const reverse iterator for UString
Definition MyGUI_UString.h:359
MyGUI::UString::_const_rev_iterator::operator-
_const_rev_iterator operator-(difference_type n)
subtraction operator
Definition MyGUI_UString.cpp:429
MyGUI::UString::_const_rev_iterator::operator+
_const_rev_iterator operator+(difference_type n)
addition operator
Definition MyGUI_UString.cpp:419
MyGUI::UString::_const_rev_iterator::operator!=
friend bool operator!=(const _const_rev_iterator &left, const _const_rev_iterator &right)
inequality operator
Definition MyGUI_UString.h:1096
MyGUI::UString::_const_rev_iterator::operator++
_const_rev_iterator & operator++()
pre-increment
Definition MyGUI_UString.cpp:393
MyGUI::UString::_const_rev_iterator::operator+=
_const_rev_iterator & operator+=(difference_type n)
addition assignment operator
Definition MyGUI_UString.cpp:439
MyGUI::UString::_const_rev_iterator::operator>=
friend bool operator>=(const _const_rev_iterator &left, const _const_rev_iterator &right)
greater than or equal
Definition MyGUI_UString.h:1112
MyGUI::UString::_const_rev_iterator::operator<=
friend bool operator<=(const _const_rev_iterator &left, const _const_rev_iterator &right)
less than or equal
Definition MyGUI_UString.h:1104
MyGUI::UString::_const_rev_iterator::_const_rev_iterator
_const_rev_iterator()
MyGUI::UString::_const_rev_iterator::operator==
friend bool operator==(const _const_rev_iterator &left, const _const_rev_iterator &right)
equality operator
Definition MyGUI_UString.h:1092
MyGUI::UString::_const_rev_iterator::operator[]
const value_type & operator[](difference_type n) const
dereference at offset operator
Definition MyGUI_UString.cpp:462
MyGUI::UString::_const_rev_iterator::operator<
friend bool operator<(const _const_rev_iterator &left, const _const_rev_iterator &right)
less than
Definition MyGUI_UString.h:1100
MyGUI::UString::_const_rev_iterator::operator>
friend bool operator>(const _const_rev_iterator &left, const _const_rev_iterator &right)
greater than
Definition MyGUI_UString.h:1108
MyGUI::UString::_const_rev_iterator::operator--
_const_rev_iterator & operator--()
pre-decrement
Definition MyGUI_UString.cpp:406
MyGUI::UString::_const_rev_iterator::operator*
const value_type & operator*() const
dereference operator
Definition MyGUI_UString.cpp:457
MyGUI::UString::_const_rev_iterator::operator-=
_const_rev_iterator & operator-=(difference_type n)
subtraction assignment operator
Definition MyGUI_UString.cpp:448
MyGUI::UString::_fwd_iterator
forward iterator for UString
Definition MyGUI_UString.h:225
MyGUI::UString::_fwd_iterator::getCharacter
unicode_char getCharacter() const
Returns the Unicode value of the character at the current position (decodes surrogate pairs if needed...
Definition MyGUI_UString.cpp:192
MyGUI::UString::_fwd_iterator::operator++
_fwd_iterator & operator++()
pre-increment
Definition MyGUI_UString.cpp:104
MyGUI::UString::_fwd_iterator::operator-
_fwd_iterator operator-(difference_type n)
subtraction operator
Definition MyGUI_UString.cpp:140
MyGUI::UString::_fwd_iterator::setCharacter
int setCharacter(unicode_char uc)
Sets the Unicode value of the character at the current position (adding a surrogate pair if needed); ...
Definition MyGUI_UString.cpp:197
MyGUI::UString::_fwd_iterator::moveNext
_fwd_iterator & moveNext()
advances to the next Unicode character, honoring surrogate pairs in the UTF-16 stream
Definition MyGUI_UString.cpp:180
MyGUI::UString::_fwd_iterator::movePrev
_fwd_iterator & movePrev()
rewinds to the previous Unicode character, honoring surrogate pairs in the UTF-16 stream
Definition MyGUI_UString.cpp:186
MyGUI::UString::_fwd_iterator::operator+=
_fwd_iterator & operator+=(difference_type n)
addition assignment operator
Definition MyGUI_UString.cpp:150
MyGUI::UString::_fwd_iterator::operator-=
_fwd_iterator & operator-=(difference_type n)
subtraction assignment operator
Definition MyGUI_UString.cpp:159
MyGUI::UString::_fwd_iterator::operator+
_fwd_iterator operator+(difference_type n)
addition operator
Definition MyGUI_UString.cpp:130
MyGUI::UString::_fwd_iterator::operator*
value_type & operator*() const
dereference operator
Definition MyGUI_UString.cpp:168
MyGUI::UString::_fwd_iterator::operator--
_fwd_iterator & operator--()
pre-decrement
Definition MyGUI_UString.cpp:117
MyGUI::UString::_fwd_iterator::operator[]
value_type & operator[](difference_type n) const
dereference at offset operator
Definition MyGUI_UString.cpp:173
MyGUI::UString::_rev_iterator
forward iterator for UString
Definition MyGUI_UString.h:328
MyGUI::UString::_rev_iterator::operator+=
_rev_iterator & operator+=(difference_type n)
addition assignment operator
Definition MyGUI_UString.cpp:354
MyGUI::UString::_rev_iterator::operator--
_rev_iterator & operator--()
pre-decrement
Definition MyGUI_UString.cpp:321
MyGUI::UString::_rev_iterator::operator*
value_type & operator*() const
dereference operator
Definition MyGUI_UString.cpp:372
MyGUI::UString::_rev_iterator::operator++
_rev_iterator & operator++()
pre-increment
Definition MyGUI_UString.cpp:308
MyGUI::UString::_rev_iterator::operator-
_rev_iterator operator-(difference_type n)
subtraction operator
Definition MyGUI_UString.cpp:344
MyGUI::UString::_rev_iterator::operator-=
_rev_iterator & operator-=(difference_type n)
subtraction assignment operator
Definition MyGUI_UString.cpp:363
MyGUI::UString::_rev_iterator::operator[]
value_type & operator[](difference_type n) const
dereference at offset operator
Definition MyGUI_UString.cpp:377
MyGUI::UString::_rev_iterator::operator+
_rev_iterator operator+(difference_type n)
addition operator
Definition MyGUI_UString.cpp:334
MyGUI::UString::invalid_data::invalid_data
invalid_data(const std::string &_message)
constructor takes a string message that can be later retrieved by the what() function
Definition MyGUI_UString.h:184
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition MyGUI_UString.h:144
MyGUI::UString::mStrBuffer
std::string * mStrBuffer
Definition MyGUI_UString.h:996
MyGUI::UString::rend
reverse_iterator rend()
returns a reverse iterator just past the beginning of the string
Definition MyGUI_UString.cpp:815
MyGUI::UString::operator+
UString operator+(UString::code_point c, const UString &s2)
string addition operator
Definition MyGUI_UString.h:1030
MyGUI::UString::_verifyUTF8
static size_type _verifyUTF8(const unsigned char *c_str)
verifies a UTF-8 stream, returning the total number of Unicode characters found
Definition MyGUI_UString.cpp:1840
MyGUI::UString::length
size_type length() const
Returns the number of code points in the current string.
Definition MyGUI_UString.cpp:561
MyGUI::UString::insert
iterator insert(iterator i, const code_point &ch)
inserts ch before the code point denoted by i
Definition MyGUI_UString.cpp:1042
MyGUI::UString::asWStr_c_str
const wchar_t * asWStr_c_str() const
returns the current string in the native form of a nul-terminated wchar_t array
Definition MyGUI_UString.cpp:703
MyGUI::UString::operator>
bool operator>(const UString &right) const
greater than operator
Definition MyGUI_UString.cpp:1590
MyGUI::UString::find
size_type find(wchar_t ch, size_type index=0) const
returns the index of the first occurrence ch within the current string, starting at index; returns US...
MyGUI::UString::size
size_type size() const
Returns the number of code points in the current string.
Definition MyGUI_UString.cpp:556
MyGUI::UString::data
const code_point * data() const
returns a pointer to the first character in the current string
Definition MyGUI_UString.cpp:609
MyGUI::UString::UString
UString()
default constructor, creates an empty string
Definition MyGUI_UString.cpp:472
MyGUI::UString::compare
int compare(size_type index, size_type length, const wchar_t *w_str, size_type length2) const
compare a substring of str to a substring of the current string, where the substring of str begins at...
MyGUI::UString::asUTF8_c_str
const char * asUTF8_c_str() const
returns the current string in UTF-8 form as a nul-terminated char array
Definition MyGUI_UString.cpp:679
MyGUI::UString::_verifyUTF8
static size_type _verifyUTF8(std::string_view str)
verifies a UTF-8 stream, returning the total number of Unicode characters found
Definition MyGUI_UString.h:950
MyGUI::UString::operator==
bool operator==(const UString &right) const
equality operator
Definition MyGUI_UString.cpp:1600
MyGUI::UString::operator!=
bool operator!=(const UString &right) const
inequality operator
Definition MyGUI_UString.cpp:1605
MyGUI::UString::assign
UString & assign(const wchar_t *w_str)
assign w_str to the current string
MyGUI::UString::asUTF32_c_str
const unicode_char * asUTF32_c_str() const
returns the current string in UTF-32 form as a nul-terminated unicode_char array
Definition MyGUI_UString.cpp:691
MyGUI::UString::find
size_type find(const UString &str, size_type index=0) const
returns the index of the first occurrence of str within the current string, starting at index; return...
Definition MyGUI_UString.cpp:1268
MyGUI::UString::operator>=
bool operator>=(const UString &right) const
greater than or equal operator
Definition MyGUI_UString.cpp:1595
MyGUI::UString::rfind
size_type rfind(const UString &str, size_type index=0) const
returns the location of the first occurrence of str in the current string, doing a reverse search fro...
Definition MyGUI_UString.cpp:1317
MyGUI::UString::assign
UString & assign(std::string_view str)
assign str to the current string (str is treated as a UTF-8 stream)
Definition MyGUI_UString.h:598
MyGUI::UString::const_reverse_iterator
_const_rev_iterator const_reverse_iterator
const reverse iterator
Definition MyGUI_UString.h:410
MyGUI::UString::assign
UString & assign(const wchar_t *w_str, size_type num)
assign the first num characters of w_str to the current string
MyGUI::UString::insert
UString & insert(size_type index, const code_point *str)
inserts str into the current string, at location index
Definition MyGUI_UString.h:647
MyGUI::UString::operator+
UString operator+(const UString &s1, UString::unicode_char c)
string addition operator
Definition MyGUI_UString.h:1013
MyGUI::UString::mWStrBuffer
std::wstring * mWStrBuffer
Definition MyGUI_UString.h:997
MyGUI::UString::operator+
UString operator+(wchar_t c, const UString &s2)
string addition operator
Definition MyGUI_UString.h:1046
MyGUI::UString::asUTF32
const utf32string & asUTF32() const
returns the current string in UTF-32 form within a utf32string
Definition MyGUI_UString.cpp:685
MyGUI::UString::setChar
int setChar(size_type loc, unicode_char ch)
sets the value of the character at loc to the Unicode value ch (UTF-32)
Definition MyGUI_UString.cpp:737
MyGUI::UString::insert
UString & insert(size_type index, size_type num, wchar_t ch)
inserts num copies of ch into the current string, at location index
MyGUI::UString::assign
UString & assign(iterator start, iterator end)
gives the current string the values from start to end
Definition MyGUI_UString.cpp:831
MyGUI::UString::find_last_of
size_type find_last_of(char ch, size_type index=npos) const
returns the index of the first occurrence of ch in the current string, doing a reverse search from in...
Definition MyGUI_UString.h:828
MyGUI::UString::compare
int compare(const UString &str) const
compare str to the current string
Definition MyGUI_UString.cpp:1228
MyGUI::UString::value_type
code_point value_type
value type typedef for use in iterators
Definition MyGUI_UString.h:172
MyGUI::UString::operator<=
bool operator<=(const UString &right) const
less than or equal operator
Definition MyGUI_UString.cpp:1554
MyGUI::UString::find_first_of
size_type find_first_of(wchar_t ch, size_type index=0) const
returns the index of the first occurrence of ch in the current string, starting the search at index; ...
MyGUI::UString::rfind
size_type rfind(wchar_t ch, size_type index=0) const
returns the location of the first occurrence of ch in the current string, doing a reverse search from...
MyGUI::UString::utf32string
std::basic_string< unicode_char > utf32string
string type used for returning UTF-32 formatted data
Definition MyGUI_UString.h:177
MyGUI::UString::operator+
UString operator+(UString::unicode_char c, const UString &s2)
string addition operator
Definition MyGUI_UString.h:1035
MyGUI::UString::operator<<
std::ostream & operator<<(std::ostream &os, const UString &s)
std::ostream write operator
Definition MyGUI_UString.h:1118
MyGUI::UString::UString
UString(std::string_view str)
Definition MyGUI_UString.h:450
MyGUI::UString::append
UString & append(size_type num, wchar_t ch)
appends num repetitions of ch on to the end of the current string
MyGUI::UString::find_first_of
size_type find_first_of(const UString &str, size_type index=0, size_type num=npos) const
Returns the index of the first character within the current string that matches any character in str,...
Definition MyGUI_UString.cpp:1366
MyGUI::UString::rfind
size_type rfind(const wchar_t *w_str, size_type index, size_type num) const
returns the location of the first occurrence of str in the current string, doing a reverse search fro...
MyGUI::UString::operator+
UString operator+(const UString &s1, char c)
string addition operator
Definition MyGUI_UString.h:1018
MyGUI::UString::operator+
UString operator+(const UString &s1, const UString &s2)
string addition operator
Definition MyGUI_UString.h:1003
MyGUI::UString::find_first_not_of
size_type find_first_not_of(wchar_t ch, size_type index=0) const
returns the index of the first character within the current string that does not match ch,...
MyGUI::UString::insert
UString & insert(size_type index, const wchar_t *w_str, size_type num)
inserts num code points of str into the current string, at location index
MyGUI::UString::erase
iterator erase(iterator loc)
removes the code point pointed to by loc, returning an iterator to the next character
Definition MyGUI_UString.cpp:1161
MyGUI::UString::dstring
std::basic_string< code_point > dstring
Definition MyGUI_UString.h:174
MyGUI::UString::operator<
bool operator<(const UString &right) const
less than operator
Definition MyGUI_UString.cpp:1549
MyGUI::UString::UString
UString(const wchar_t *w_str, size_type length)
duplicate of w_str, length characters long
MyGUI::UString::mVoidBuffer
void * mVoidBuffer
Definition MyGUI_UString.h:995
MyGUI::UString::code_point
uint16 code_point
a single UTF-16 code point
Definition MyGUI_UString.h:169
MyGUI::UString::find_last_of
size_type find_last_of(const UString &str, size_type index=npos, size_type num=npos) const
returns the index of the first character within the current string that matches any character in str,...
Definition MyGUI_UString.cpp:1450
MyGUI::UString::end
iterator end()
returns an iterator just past the end of the string
Definition MyGUI_UString.cpp:783
MyGUI::UString::getChar
unicode_char getChar(size_type loc) const
returns the data point loc evaluated as a UTF-32 value
Definition MyGUI_UString.cpp:719
MyGUI::UString::npos
static const size_type npos
the usual constant representing: not found, no limit, etc
Definition MyGUI_UString.h:163
MyGUI::UString::unicode_char
uint32 unicode_char
a single 32-bit Unicode character
Definition MyGUI_UString.h:166
MyGUI::UString::operator=
UString & operator=(const UString &s)
assignment operator, implicitly casts all compatible types
Definition MyGUI_UString.cpp:1559
MyGUI::UString::insert
void insert(iterator i, size_type num, const wchar_t &ch)
inserts num copies of ch into the current string, before the code point denoted by i
MyGUI::UString::iterator
_fwd_iterator iterator
iterator
Definition MyGUI_UString.h:407
MyGUI::UString::asWStr
const std::wstring & asWStr() const
returns the current string in the native form of std::wstring
Definition MyGUI_UString.cpp:697
MyGUI::UString::mUTF32StrBuffer
utf32string * mUTF32StrBuffer
Definition MyGUI_UString.h:998
MyGUI::UString::operator=
UString & operator=(wchar_t ch)
assignment operator
MyGUI::UString::inString
bool inString(unicode_char ch) const
returns true if the given Unicode character ch is in this string
Definition MyGUI_UString.cpp:661
MyGUI::UString::operator[]
code_point & operator[](size_type index)
code point dereference operator
Definition MyGUI_UString.cpp:1610
MyGUI::UString::find_last_of
size_type find_last_of(wchar_t ch, size_type index=npos) const
returns the index of the first occurrence of ch in the current string, doing a reverse search from in...
MyGUI::UString::find_first_not_of
size_type find_first_not_of(const UString &str, size_type index=0, size_type num=npos) const
returns the index of the first character within the current string that does not match any character ...
Definition MyGUI_UString.cpp:1407
MyGUI::UString::push_back
void push_back(wchar_t val)
appends val to the end of the string
MyGUI::UString::find
size_type find(const wchar_t *w_str, size_type index, size_type length) const
returns the index of the first occurrence of str within the current string and within length code poi...
MyGUI::UString::append
UString & append(const UString &str)
appends str on to the end of the current string
Definition MyGUI_UString.cpp:960
MyGUI::UString::c_str
const code_point * c_str() const
returns a pointer to the first character in the current string
Definition MyGUI_UString.cpp:604
MyGUI::UString::at
code_point & at(size_type loc)
returns a reference to the element in the string at index loc
Definition MyGUI_UString.cpp:709
MyGUI::UString::const_iterator
_const_fwd_iterator const_iterator
const iterator
Definition MyGUI_UString.h:409
MyGUI::UString::append
UString & append(const wchar_t *w_str, size_type num)
appends num characters of str on to the end of the current string
MyGUI::UString::rbegin
reverse_iterator rbegin()
returns a reverse iterator to the last element of the string
Definition MyGUI_UString.cpp:799
MyGUI::UString::size_type
size_t size_type
size type used to indicate string size and character positions within the string
Definition MyGUI_UString.h:161
MyGUI::UString::replace
UString & replace(size_type index1, size_type num1, const UString &str)
replaces up to num1 code points of the current string (starting at index1) with str
Definition MyGUI_UString.cpp:1186
MyGUI::UString::asUTF8
const std::string & asUTF8() const
returns the current string in UTF-8 form within a std::string
Definition MyGUI_UString.cpp:673
MyGUI::UString::push_back
void push_back(unicode_char val)
appends val to the end of the string
Definition MyGUI_UString.cpp:633
MyGUI::UString::operator+
UString operator+(const UString &s1, UString::code_point c)
string addition operator
Definition MyGUI_UString.h:1008
MyGUI::UString::find_last_not_of
size_type find_last_not_of(wchar_t ch, size_type index=npos) const
returns the index of the last occurrence of a character that does not match ch in the current string,...
MyGUI::UString::UString
UString(const char(&str)[num])
Definition MyGUI_UString.h:445
MyGUI::UString::operator+
UString operator+(const UString &s1, wchar_t c)
string addition operator
Definition MyGUI_UString.h:1024
MyGUI::UString::operator<<
std::wostream & operator<<(std::wostream &os, const UString &s)
std::wostream write operator
Definition MyGUI_UString.h:1124
MyGUI::UString::begin
iterator begin()
returns an iterator to the first element of the string
Definition MyGUI_UString.cpp:767
MyGUI::UString::find_last_not_of
size_type find_last_not_of(const UString &str, size_type index=npos, size_type num=npos) const
returns the index of the last character within the current string that does not match any character i...
Definition MyGUI_UString.cpp:1496
MyGUI::UString::operator+
UString operator+(char c, const UString &s2)
string addition operator
Definition MyGUI_UString.h:1040
MyGUI::UString::reverse_iterator
_rev_iterator reverse_iterator
reverse iterator
Definition MyGUI_UString.h:408
MyGUI::UString::UString
UString(const wchar_t *w_str)
duplicate of nul-terminated wchar_t array
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::uint32
uint32_t uint32
Definition MyGUI_Types.h:48
MyGUI::operator-
UString::size_type operator-(const UString::_const_fwd_iterator &left, const UString::_const_fwd_iterator &right)
Definition MyGUI_UString.h:1053
MyGUI::operator<=
bool operator<=(const UString::_const_fwd_iterator &left, const UString::_const_fwd_iterator &right)
Definition MyGUI_UString.h:1071
MyGUI::operator==
bool operator==(const UString::_const_fwd_iterator &left, const UString::_const_fwd_iterator &right)
Definition MyGUI_UString.h:1059
MyGUI::operator>=
bool operator>=(const UString::_const_fwd_iterator &left, const UString::_const_fwd_iterator &right)
Definition MyGUI_UString.h:1079
MyGUI::uint16
uint16_t uint16
Definition MyGUI_Types.h:47
MyGUI::operator>
bool operator>(const UString::_const_fwd_iterator &left, const UString::_const_fwd_iterator &right)
Definition MyGUI_UString.h:1075
MyGUI::operator!=
bool operator!=(const UString::_const_fwd_iterator &left, const UString::_const_fwd_iterator &right)
Definition MyGUI_UString.h:1063
MyGUI::len
float len(float x, float y)
Definition MyGUI_PolygonalSkin.cpp:22
MyGUI::operator<
bool operator<(const UString::_const_fwd_iterator &left, const UString::_const_fwd_iterator &right)
Definition MyGUI_UString.h:1067