File: ustring.h

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (284 lines) | stat: -rw-r--r-- 9,361 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/ustring.h
// Purpose:     interface of wxUString
// Author:      Robert Roebling
// Copyright:   (c) Robert Roebling
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxUString

    wxUString is a class representing a Unicode character string where
    each character is stored using a 32-bit value. This is different from
    wxString which may store a character either as a UTF-8 or as a UTF-16
    sequence and different from @c std::string which stores a string
    as a sequence of simple 8-bit characters and also different from
    @c std::wstring which stores the string differently depending on
    the definition of wchar_t.

    The main purpose of wxUString is a to give users a Unicode string
    class that has O(1) access to its content, to be identical on all
    platforms and to be easily convertable to wxString as well as other
    ways to store strings (C string literals, wide character
    string literals, character buffer, etc) by providing several overloads
    and built-in conversions to and from the various string formats.

    wxUString derives from @c std::basic_string<wxChar32> and therefore
    offers the complete API of @c std::string.

    @library{wxbase}
    @category{data}

    @see wxString, @ref overview_string "wxString overview", @ref overview_unicode
    "Unicode overview"
*/


class WXDLLIMPEXP_BASE wxUString: public std::basic_string<wxChar32>
{
public:
    /**
        Default constructor.
    */
    wxUString();
    /**
        Copy constructor.
    */
    wxUString( const wxUString &str );
    /**
        Constructs a string from a 32-bit string literal.
    */
    wxUString( const wxChar32 *str );
    /**
        Constructs a string from 32-bit string buffer.
    */
    wxUString( const wxU32CharBuffer &buf );
    /**
        Constructs a string from C string literal using wxConvLibc to convert it to Unicode.
    */
    wxUString( const char *str );
    /**
        Constructs a string from C string buffer using wxConvLibc to convert it to Unicode.
    */
    wxUString( const wxCharBuffer &buf );
    /**
        Constructs a string from C string literal using @a conv to convert it to Unicode.
    */
    wxUString( const char *str, const wxMBConv &conv );
    /**
        Constructs a string from C string literal using @a conv to convert it to Unicode.
    */
    wxUString( const wxCharBuffer &buf, const wxMBConv &conv );
    /**
        Constructs a string from UTF-16 string literal
    */
    wxUString( const wxChar16 *str );
    /**
        Constructs a string from UTF-16 string buffer
    */
    wxUString( const wxU16CharBuffer &buf );
    /**
        Constructs a string from wxString.
    */
    wxUString( const wxString &str );
    /**
        Constructs a string from using wxConvLibc to convert it to Unicode.
    */
    wxUString( char ch );
    /**
        Constructs a string from a UTF-16 character.
    */
    wxUString( wxChar16 ch );
    /**
        Constructs a string from 32-bit Unicode character.
    */
    wxUString( wxChar32 ch );
    /**
        Constructs a string from wxUniChar (returned by wxString's access operator)
    */
    wxUString( wxUniChar ch );
    /**
        Constructs a string from wxUniCharRef (returned by wxString's access operator)
    */
    wxUString( wxUniCharRef ch );
    /**
        Constructs a string from @a n characters @a ch.
    */
    wxUString( size_t n, char ch );
    /**
        Constructs a string from @a n characters @a ch.
    */
    wxUString( size_t n, wxChar16 ch );
    /**
        Constructs a string from @a n characters @a ch.
    */
    wxUString( size_t n, wxChar32 ch );
    /**
        Constructs a string from @a n characters @a ch.
    */
    wxUString( size_t n, wxUniChar ch );
    /**
        Constructs a string from @a n characters @a ch.
    */
    wxUString( size_t n, wxUniCharRef ch );

    /**
        Static construction of a wxUString from a 7-bit ASCII string
    */
    static wxUString FromAscii( const char *str, size_t n );
    /**
        Static construction of a wxUString from a 7-bit ASCII string
    */
    static wxUString FromAscii( const char *str );
    /**
        Static construction of a wxUString from a UTF-8 encoded string
    */
    static wxUString FromUTF8( const char *str, size_t n );
    /**
        Static construction of a wxUString from a UTF-8 encoded string
    */
    static wxUString FromUTF8( const char *str );
    /**
        Static construction of a wxUString from a UTF-16 encoded string
    */
    static wxUString FromUTF16( const wxChar16 *str, size_t n );
    /**
        Static construction of a wxUString from a UTF-16 encoded string
    */
    static wxUString FromUTF16( const wxChar16 *str );


    /**
       Assignment from a 7-bit ASCII string literal
    */
    wxUString &assignFromAscii( const char *str );
    /**
       Assignment from a 7-bit ASCII string literal
    */
    wxUString &assignFromAscii( const char *str, size_t n );
    /**
       Assignment from a UTF-8 string literal
    */
    wxUString &assignFromUTF8( const char *str );
    /**
       Assignment from a UTF-8 string literal
    */
    wxUString &assignFromUTF8( const char *str, size_t n );
    /**
       Assignment from a UTF-16 string literal
    */
    wxUString &assignFromUTF16( const wxChar16* str );
    /**
       Assignment from a UTF-16 string literal
    */
    wxUString &assignFromUTF16( const wxChar16* str, size_t n );
    /**
       Assignment from a C string literal using wxConvLibc
    */
    wxUString &assignFromCString( const char* str );
    /**
       Assignment from a C string literal using @a conv
    */
    wxUString &assignFromCString( const char* str, const wxMBConv &conv );

    /**
        Conversion to a UTF-8 string
    */
    wxCharBuffer utf8_str() const;
    /**
        Conversion to a UTF-16 string
    */
    wxU16CharBuffer utf16_str() const;

    /**
        Conversion to a wide character string (either UTF-16
        or UCS-4, depending on the size of wchar_t).
    */
    wxWCharBuffer wc_str() const;

    /**
       Implicit conversion to wxString.
    */
    operator wxString() const;

    /**
       wxUString assignment. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single and repeated characters etc.
    */
    wxUString &assign( const wxUString &str );

    /**
       Appending. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single and repeated characters etc.
    */
    wxUString &append( const wxUString &s );

    /**
       Insertion. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single characters etc.
    */
    wxUString &insert( size_t pos, const wxUString &s );

    /**
       Assignment operator. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single characters etc.
    */
    inline wxUString& operator=(const wxUString& s);

    /**
       Concatenation operator. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single characters etc.
    */
    inline wxUString& operator+=(const wxUString& s);

};

    /**
       Concatenation operator. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single characters etc.
    */
inline wxUString operator+(const wxUString &s1, const wxUString &s2);

    /**
       Equality operator. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single characters etc.
    */
inline bool operator==(const wxUString& s1, const wxUString& s2);
    /**
       Inequality operator. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single characters etc.
    */
inline bool operator!=(const wxUString& s1, const wxUString& s2);
    /**
       Comparison operator. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single characters etc.
    */
inline bool operator< (const wxUString& s1, const wxUString& s2);
    /**
       Comparison operator. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single characters etc.
    */
inline bool operator> (const wxUString& s1, const wxUString& s2);
    /**
       Comparison operator. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single characters etc.
    */
inline bool operator<=(const wxUString& s1, const wxUString& s2);
    /**
       Comparison operator. wxUString additionally provides overloads for
       wxString, C string, UTF-16 strings, 32-bit strings, char buffers,
       single characters etc.
    */
inline bool operator>=(const wxUString& s1, const wxUString& s2);