]> git.saurik.com Git - wxWidgets.git/blame - include/wx/ustring.h
Make m_inDoPropertyChanged and m_inCommitChangesFromEditor bools; Manage m_inDoProper...
[wxWidgets.git] / include / wx / ustring.h
CommitLineData
95691abd 1
9a6d1438
RR
2// Name: wx/ustring.h
3// Purpose: 32-bit string (UCS-4)
4// Author: Robert Roebling
5// Copyright: (c) Robert Roebling
2cce6635 6// RCS-ID: $Id$
9a6d1438
RR
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
6286f3c8
VZ
10#ifndef _WX_USTRING_H_
11#define _WX_USTRING_H_
9a6d1438
RR
12
13#include "wx/defs.h"
14#include "wx/string.h"
15
a029059f
RR
16#include <string>
17
9a6d1438 18#if SIZEOF_WCHAR_T == 2
9a6d1438 19typedef wxWCharBuffer wxU16CharBuffer;
de4983f3 20typedef wxScopedWCharBuffer wxScopedU16CharBuffer;
9a6d1438 21#else
95691abd 22typedef wxCharTypeBuffer<wxChar16> wxU16CharBuffer;
de4983f3 23typedef wxScopedCharTypeBuffer<wxChar16> wxScopedU16CharBuffer;
9a6d1438
RR
24#endif
25
95691abd 26#if SIZEOF_WCHAR_T == 4
9a6d1438 27typedef wxWCharBuffer wxU32CharBuffer;
de4983f3 28typedef wxScopedWCharBuffer wxScopedU32CharBuffer;
95691abd
VS
29#else
30typedef wxCharTypeBuffer<wxChar32> wxU32CharBuffer;
de4983f3 31typedef wxScopedCharTypeBuffer<wxChar32> wxScopedU32CharBuffer;
9a6d1438
RR
32#endif
33
adcc13ac
VZ
34#ifdef __VISUALC__
35 // "non dll-interface class 'std::basic_string<wxChar32>' used as base
36 // interface for dll-interface class 'wxString'" -- this is OK in our case
37 // (and warning is unavoidable anyhow)
fb330c2e 38 #pragma warning(push)
adcc13ac
VZ
39 #pragma warning(disable:4275)
40#endif
95691abd 41
9a6d1438
RR
42class WXDLLIMPEXP_BASE wxUString: public std::basic_string<wxChar32>
43{
cbb003b1 44public:
9a6d1438 45 wxUString() { }
cbb003b1 46
9a6d1438
RR
47 wxUString( const wxChar32 *str ) { assign(str); }
48 wxUString( const wxUString &str ) { assign(str); }
de4983f3 49 wxUString( const wxScopedU32CharBuffer &buf ) { assign(buf); }
cbb003b1 50
9a6d1438 51 wxUString( const char *str ) { assign(str); }
de4983f3 52 wxUString( const wxScopedCharBuffer &buf ) { assign(buf); }
9a6d1438 53 wxUString( const char *str, const wxMBConv &conv ) { assign(str,conv); }
de4983f3 54 wxUString( const wxScopedCharBuffer &buf, const wxMBConv &conv ) { assign(buf,conv); }
9a6d1438
RR
55
56 wxUString( const wxChar16 *str ) { assign(str); }
de4983f3 57 wxUString( const wxScopedU16CharBuffer &buf ) { assign(buf); }
cbb003b1 58
9a6d1438
RR
59 wxUString( const wxCStrData *cstr ) { assign(cstr); }
60 wxUString( const wxString &str ) { assign(str); }
cbb003b1 61
9a6d1438
RR
62 wxUString( char ch ) { assign(ch); }
63 wxUString( wxChar16 ch ) { assign(ch); }
64 wxUString( wxChar32 ch ) { assign(ch); }
65 wxUString( wxUniChar ch ) { assign(ch); }
66 wxUString( wxUniCharRef ch ) { assign(ch); }
67 wxUString( size_type n, char ch ) { assign(n,ch); }
68 wxUString( size_type n, wxChar16 ch ) { assign(n,ch); }
69 wxUString( size_type n, wxChar32 ch ) { assign(n,ch); }
70 wxUString( size_type n, wxUniChar ch ) { assign(n,ch); }
71 wxUString( size_type n, wxUniCharRef ch ) { assign(n,ch); }
cbb003b1 72
9a6d1438 73 // static construction
cbb003b1 74
9a6d1438
RR
75 static wxUString FromAscii( const char *str, size_type n )
76 {
77 wxUString ret;
78 ret.assignFromAscii( str, n );
79 return ret;
80 }
cbb003b1 81
9a6d1438
RR
82 static wxUString FromAscii( const char *str )
83 {
84 wxUString ret;
85 ret.assignFromAscii( str );
86 return ret;
87 }
cbb003b1 88
9a6d1438
RR
89 static wxUString FromUTF8( const char *str, size_type n )
90 {
91 wxUString ret;
92 ret.assignFromUTF8( str, n );
93 return ret;
94 }
cbb003b1 95
9a6d1438
RR
96 static wxUString FromUTF8( const char *str )
97 {
98 wxUString ret;
99 ret.assignFromUTF8( str );
100 return ret;
101 }
cbb003b1 102
9a6d1438
RR
103 static wxUString FromUTF16( const wxChar16 *str, size_type n )
104 {
105 wxUString ret;
106 ret.assignFromUTF16( str, n );
107 return ret;
108 }
cbb003b1 109
9a6d1438
RR
110 static wxUString FromUTF16( const wxChar16 *str )
111 {
112 wxUString ret;
113 ret.assignFromUTF16( str );
114 return ret;
115 }
cbb003b1 116
9a6d1438 117 // assign from encoding
cbb003b1 118
9a6d1438
RR
119 wxUString &assignFromAscii( const char *str );
120 wxUString &assignFromAscii( const char *str, size_type n );
121 wxUString &assignFromUTF8( const char *str );
122 wxUString &assignFromUTF8( const char *str, size_type n );
123 wxUString &assignFromUTF16( const wxChar16* str );
124 wxUString &assignFromUTF16( const wxChar16* str, size_type n );
125 wxUString &assignFromCString( const char* str );
126 wxUString &assignFromCString( const char* str, const wxMBConv &conv );
cbb003b1 127
9a6d1438 128 // conversions
cbb003b1 129
de4983f3
VS
130 wxScopedCharBuffer utf8_str() const;
131 wxScopedU16CharBuffer utf16_str() const;
cbb003b1 132
9a6d1438 133#if SIZEOF_WCHAR_T == 2
de4983f3 134 wxScopedWCharBuffer wc_str() const
9a6d1438
RR
135 {
136 return utf16_str();
137 }
138#else
139 wchar_t *wc_str() const
140 {
141 return (wchar_t*) c_str();
142 }
143#endif
144
145 operator wxString() const
146 {
147#if wxUSE_UNICODE_UTF8
148 return wxString::FromUTF8( utf8_str() );
149#else
150#if SIZEOF_WCHAR_T == 2
151 return wxString( utf16_str() );
152#else
153 return wxString( c_str() );
154#endif
155#endif
156 }
157
158#if wxUSE_UNICODE_UTF8
de4983f3 159 wxScopedCharBuffer wx_str()
9a6d1438
RR
160 {
161 return utf8_str();
162 }
163#else
164#if SIZEOF_WCHAR_T == 2
de4983f3 165 wxScopedWCharBuffer wx_str()
9a6d1438
RR
166 {
167 return utf16_str();
168 }
169#else
6090d53c 170 const wchar_t* wx_str()
9a6d1438
RR
171 {
172 return c_str();
173 }
174#endif
175#endif
176
177 // assign
cbb003b1 178
6286f3c8 179 wxUString &assign( const wxChar32* str )
9a6d1438
RR
180 {
181 std::basic_string<wxChar32> *base = this;
182 return (wxUString &) base->assign( str );
183 }
cbb003b1 184
6286f3c8 185 wxUString &assign( const wxChar32* str, size_type n )
9a6d1438
RR
186 {
187 std::basic_string<wxChar32> *base = this;
188 return (wxUString &) base->assign( str, n );
189 }
cbb003b1 190
6286f3c8 191 wxUString &assign( const wxUString &str )
9a6d1438
RR
192 {
193 std::basic_string<wxChar32> *base = this;
194 return (wxUString &) base->assign( str );
195 }
cbb003b1 196
6286f3c8 197 wxUString &assign( const wxUString &str, size_type pos, size_type n )
9a6d1438
RR
198 {
199 std::basic_string<wxChar32> *base = this;
200 return (wxUString &) base->assign( str, pos, n );
201 }
cbb003b1 202
6286f3c8 203 wxUString &assign( wxChar32 ch )
9a6d1438
RR
204 {
205 std::basic_string<wxChar32> *base = this;
206 return (wxUString &) base->assign( (size_type) 1, ch );
207 }
cbb003b1 208
6286f3c8 209 wxUString &assign( size_type n, wxChar32 ch )
9a6d1438
RR
210 {
211 std::basic_string<wxChar32> *base = this;
212 return (wxUString &) base->assign( n, ch );
213 }
cbb003b1 214
de4983f3 215 wxUString &assign( const wxScopedU32CharBuffer &buf )
9a6d1438
RR
216 {
217 return assign( buf.data() );
218 }
cbb003b1 219
9a6d1438
RR
220 wxUString &assign( const char *str )
221 {
222 return assignFromCString( str );
223 }
cbb003b1 224
de4983f3 225 wxUString &assign( const wxScopedCharBuffer &buf )
cbb003b1 226 {
9a6d1438
RR
227 return assignFromCString( buf.data() );
228 }
cbb003b1 229
9a6d1438 230 wxUString &assign( const char *str, const wxMBConv &conv )
cbb003b1 231 {
9a6d1438
RR
232 return assignFromCString( str, conv );
233 }
cbb003b1 234
de4983f3 235 wxUString &assign( const wxScopedCharBuffer &buf, const wxMBConv &conv )
cbb003b1 236 {
9a6d1438
RR
237 return assignFromCString( buf.data(), conv );
238 }
cbb003b1 239
9a6d1438
RR
240 wxUString &assign( const wxChar16 *str )
241 {
242 return assignFromUTF16( str );
243 }
cbb003b1 244
de4983f3 245 wxUString &assign( const wxScopedU16CharBuffer &buf )
9a6d1438
RR
246 {
247 return assignFromUTF16( buf.data() );
248 }
cbb003b1 249
9a6d1438
RR
250 wxUString &assign( const wxCStrData *cstr )
251 {
252#if SIZEOF_WCHAR_T == 2
253 return assignFromUTF16( cstr->AsWChar() );
254#else
255 return assign( cstr->AsWChar() );
256#endif
257 }
cbb003b1 258
9a6d1438
RR
259 wxUString &assign( const wxString &str )
260 {
261#if wxUSE_UNICODE_UTF8
262 return assignFromUTF8( str.wx_str() );
263#else
264 #if SIZEOF_WCHAR_T == 2
265 return assignFromUTF16( str.wc_str() );
266 #else
cbb003b1 267 return assign( str.wc_str() );
9a6d1438
RR
268 #endif
269#endif
270 }
cbb003b1 271
9a6d1438
RR
272 wxUString &assign( char ch )
273 {
274 char buf[2];
275 buf[0] = ch;
276 buf[1] = 0;
277 return assignFromCString( buf );
278 }
cbb003b1 279
9a6d1438 280 wxUString &assign( size_type n, char ch )
cbb003b1 281 {
9a6d1438
RR
282 wxCharBuffer buffer(n);
283 char *p = buffer.data();
284 size_type i;
285 for (i = 0; i < n; i++)
286 {
287 *p = ch;
288 p++;
289 }
290 return assignFromCString( buffer.data() );
291 }
cbb003b1 292
9a6d1438
RR
293 wxUString &assign( wxChar16 ch )
294 {
295 wxChar16 buf[2];
296 buf[0] = ch;
297 buf[1] = 0;
298 return assignFromUTF16( buf );
299 }
cbb003b1 300
9a6d1438
RR
301 wxUString &assign( size_type n, wxChar16 ch )
302 {
303 wxU16CharBuffer buffer(n);
304 wxChar16 *p = buffer.data();
305 size_type i;
306 for (i = 0; i < n; i++)
307 {
308 *p = ch;
309 p++;
310 }
311 return assignFromUTF16( buffer.data() );
312 }
cbb003b1 313
9a6d1438
RR
314 wxUString &assign( wxUniChar ch )
315 {
6286f3c8 316 return assign( (wxChar32) ch.GetValue() );
9a6d1438 317 }
cbb003b1 318
9a6d1438
RR
319 wxUString &assign( size_type n, wxUniChar ch )
320 {
6286f3c8 321 return assign( n, (wxChar32) ch.GetValue() );
9a6d1438 322 }
cbb003b1 323
9a6d1438
RR
324 wxUString &assign( wxUniCharRef ch )
325 {
6286f3c8 326 return assign( (wxChar32) ch.GetValue() );
9a6d1438 327 }
cbb003b1 328
9a6d1438
RR
329 wxUString &assign( size_type n, wxUniCharRef ch )
330 {
6286f3c8 331 return assign( n, (wxChar32) ch.GetValue() );
9a6d1438 332 }
cbb003b1 333
9a6d1438 334 // append [STL overload]
cbb003b1 335
6286f3c8 336 wxUString &append( const wxUString &s )
9a6d1438
RR
337 {
338 std::basic_string<wxChar32> *base = this;
339 return (wxUString &) base->append( s );
340 }
cbb003b1 341
6286f3c8 342 wxUString &append( const wxUString &s, size_type pos, size_type n )
9a6d1438
RR
343 {
344 std::basic_string<wxChar32> *base = this;
345 return (wxUString &) base->append( s, pos, n );
346 }
cbb003b1 347
6286f3c8 348 wxUString &append( const wxChar32* s )
9a6d1438
RR
349 {
350 std::basic_string<wxChar32> *base = this;
351 return (wxUString &) base->append( s );
352 }
353
6286f3c8 354 wxUString &append( const wxChar32* s, size_type n )
9a6d1438
RR
355 {
356 std::basic_string<wxChar32> *base = this;
357 return (wxUString &) base->append( s, n );
358 }
359
6286f3c8 360 wxUString &append( size_type n, wxChar32 c )
9a6d1438
RR
361 {
362 std::basic_string<wxChar32> *base = this;
363 return (wxUString &) base->append( n, c );
364 }
365
6286f3c8 366 wxUString &append( wxChar32 c )
9a6d1438
RR
367 {
368 std::basic_string<wxChar32> *base = this;
369 return (wxUString &) base->append( 1, c );
370 }
371
372 // append [wx overload]
373
de4983f3 374 wxUString &append( const wxScopedU16CharBuffer &buf )
9a6d1438
RR
375 {
376 return append( buf.data() );
377 }
378
de4983f3 379 wxUString &append( const wxScopedU32CharBuffer &buf )
9a6d1438
RR
380 {
381 return append( buf.data() );
382 }
383
384 wxUString &append( const char *str )
385 {
386 return append( wxUString( str ) );
387 }
388
de4983f3 389 wxUString &append( const wxScopedCharBuffer &buf )
9a6d1438
RR
390 {
391 return append( wxUString( buf ) );
392 }
393
394 wxUString &append( const wxChar16 *str )
395 {
396 return append( wxUString( str ) );
397 }
cbb003b1 398
9a6d1438
RR
399 wxUString &append( const wxString &str )
400 {
401 return append( wxUString( str ) );
402 }
cbb003b1 403
9a6d1438
RR
404 wxUString &append( const wxCStrData *cstr )
405 {
406 return append( wxUString( cstr ) );
407 }
cbb003b1 408
9a6d1438
RR
409 wxUString &append( char ch )
410 {
411 char buf[2];
412 buf[0] = ch;
413 buf[1] = 0;
414 return append( buf );
415 }
cbb003b1 416
9a6d1438
RR
417 wxUString &append( wxChar16 ch )
418 {
419 wxChar16 buf[2];
420 buf[0] = ch;
421 buf[1] = 0;
422 return append( buf );
423 }
cbb003b1 424
9a6d1438
RR
425 wxUString &append( wxUniChar ch )
426 {
427 return append( (size_type) 1, (wxChar32) ch.GetValue() );
428 }
429
430 wxUString &append( wxUniCharRef ch )
431 {
432 return append( (size_type) 1, (wxChar32) ch.GetValue() );
433 }
434
cbb003b1 435
9a6d1438 436 // insert [STL overloads]
cbb003b1 437
6286f3c8 438 wxUString &insert( size_type pos, const wxUString &s )
9a6d1438
RR
439 {
440 std::basic_string<wxChar32> *base = this;
441 return (wxUString &) base->insert( pos, s );
442 }
443
6286f3c8 444 wxUString &insert( size_type pos, const wxUString &s, size_type pos1, size_type n )
9a6d1438
RR
445 {
446 std::basic_string<wxChar32> *base = this;
447 return (wxUString &) base->insert( pos, s, pos1, n );
448 }
449
6286f3c8 450 wxUString &insert( size_type pos, const wxChar32 *s )
9a6d1438
RR
451 {
452 std::basic_string<wxChar32> *base = this;
453 return (wxUString &) base->insert( pos, s );
454 }
455
6286f3c8 456 wxUString &insert( size_type pos, const wxChar32 *s, size_type n )
9a6d1438
RR
457 {
458 std::basic_string<wxChar32> *base = this;
459 return (wxUString &) base->insert( pos, s, n );
460 }
461
6286f3c8 462 wxUString &insert( size_type pos, size_type n, wxChar32 c )
9a6d1438
RR
463 {
464 std::basic_string<wxChar32> *base = this;
465 return (wxUString &) base->insert( pos, n, c );
466 }
467
468
469 // insert [STL overloads]
470
471 wxUString &insert( size_type n, const char *s )
472 {
473 return insert( n, wxUString( s ) );
474 }
475
476 wxUString &insert( size_type n, const wxChar16 *s )
477 {
478 return insert( n, wxUString( s ) );
479 }
480
de4983f3 481 wxUString &insert( size_type n, const wxScopedCharBuffer &buf )
9a6d1438
RR
482 {
483 return insert( n, wxUString( buf ) );
484 }
485
de4983f3 486 wxUString &insert( size_type n, const wxScopedU16CharBuffer &buf )
9a6d1438
RR
487 {
488 return insert( n, wxUString( buf ) );
489 }
490
de4983f3 491 wxUString &insert( size_type n, const wxScopedU32CharBuffer &buf )
9a6d1438
RR
492 {
493 return insert( n, buf.data() );
494 }
495
496 wxUString &insert( size_type n, const wxString &s )
497 {
498 return insert( n, wxUString( s ) );
499 }
cbb003b1 500
9a6d1438
RR
501 wxUString &insert( size_type n, const wxCStrData *cstr )
502 {
503 return insert( n, wxUString( cstr ) );
504 }
cbb003b1 505
9a6d1438
RR
506 wxUString &insert( size_type n, char ch )
507 {
508 char buf[2];
509 buf[0] = ch;
510 buf[1] = 0;
511 return insert( n, buf );
512 }
cbb003b1 513
9a6d1438
RR
514 wxUString &insert( size_type n, wchar_t ch )
515 {
516 wchar_t buf[2];
517 buf[0] = ch;
518 buf[1] = 0;
519 return insert( n, buf );
520 }
cbb003b1 521
9a6d1438 522 // insert iterator
cbb003b1 523
9a6d1438
RR
524 iterator insert( iterator it, wxChar32 ch )
525 {
526 std::basic_string<wxChar32> *base = this;
527 return base->insert( it, ch );
528 }
cbb003b1 529
9a6d1438
RR
530 void insert(iterator it, const_iterator first, const_iterator last)
531 {
532 std::basic_string<wxChar32> *base = this;
533 base->insert( it, first, last );
534 }
535
536
537 // operator =
6286f3c8 538 wxUString& operator=(const wxUString& s)
9a6d1438 539 { return assign( s ); }
6286f3c8 540 wxUString& operator=(const wxString& s)
9a6d1438 541 { return assign( s ); }
6286f3c8 542 wxUString& operator=(const wxCStrData* s)
9a6d1438 543 { return assign( s ); }
6286f3c8 544 wxUString& operator=(const char *s)
9a6d1438 545 { return assign( s ); }
6286f3c8 546 wxUString& operator=(const wxChar16 *s)
9a6d1438 547 { return assign( s ); }
6286f3c8 548 wxUString& operator=(const wxChar32 *s)
9a6d1438 549 { return assign( s ); }
de4983f3 550 wxUString& operator=(const wxScopedCharBuffer &s)
9a6d1438 551 { return assign( s ); }
de4983f3 552 wxUString& operator=(const wxScopedU16CharBuffer &s)
9a6d1438 553 { return assign( s ); }
de4983f3 554 wxUString& operator=(const wxScopedU32CharBuffer &s)
9a6d1438 555 { return assign( s ); }
6286f3c8 556 wxUString& operator=(const char ch)
9a6d1438 557 { return assign( ch ); }
6286f3c8 558 wxUString& operator=(const wxChar16 ch)
9a6d1438 559 { return assign( ch ); }
6286f3c8 560 wxUString& operator=(const wxChar32 ch)
9a6d1438 561 { return assign( ch ); }
6286f3c8 562 wxUString& operator=(const wxUniChar ch)
9a6d1438 563 { return assign( ch ); }
6286f3c8 564 wxUString& operator=(const wxUniCharRef ch)
9a6d1438 565 { return assign( ch ); }
cbb003b1 566
9a6d1438 567 // operator +=
6286f3c8 568 wxUString& operator+=(const wxUString& s)
9a6d1438 569 { return append( s ); }
6286f3c8 570 wxUString& operator+=(const wxString& s)
9a6d1438 571 { return append( s ); }
6286f3c8 572 wxUString& operator+=(const wxCStrData* s)
9a6d1438 573 { return append( s ); }
6286f3c8 574 wxUString& operator+=(const char *s)
9a6d1438 575 { return append( s ); }
6286f3c8 576 wxUString& operator+=(const wxChar16 *s)
9a6d1438 577 { return append( s ); }
6286f3c8 578 wxUString& operator+=(const wxChar32 *s)
9a6d1438 579 { return append( s ); }
de4983f3 580 wxUString& operator+=(const wxScopedCharBuffer &s)
9a6d1438 581 { return append( s ); }
de4983f3 582 wxUString& operator+=(const wxScopedU16CharBuffer &s)
9a6d1438 583 { return append( s ); }
de4983f3 584 wxUString& operator+=(const wxScopedU32CharBuffer &s)
9a6d1438 585 { return append( s ); }
6286f3c8 586 wxUString& operator+=(const char ch)
9a6d1438 587 { return append( ch ); }
6286f3c8 588 wxUString& operator+=(const wxChar16 ch)
9a6d1438 589 { return append( ch ); }
6286f3c8 590 wxUString& operator+=(const wxChar32 ch)
9a6d1438 591 { return append( ch ); }
6286f3c8 592 wxUString& operator+=(const wxUniChar ch)
9a6d1438 593 { return append( ch ); }
6286f3c8 594 wxUString& operator+=(const wxUniCharRef ch)
9a6d1438 595 { return append( ch ); }
cbb003b1 596
9a6d1438
RR
597};
598
adcc13ac 599#ifdef __VISUALC__
fb330c2e 600 #pragma warning(pop)
adcc13ac
VZ
601#endif
602
9a6d1438
RR
603inline wxUString operator+(const wxUString &s1, const wxUString &s2)
604 { wxUString ret( s1 ); ret.append( s2 ); return ret; }
605inline wxUString operator+(const wxUString &s1, const char *s2)
606 { return s1 + wxUString(s2); }
607inline wxUString operator+(const wxUString &s1, const wxString &s2)
608 { return s1 + wxUString(s2); }
609inline wxUString operator+(const wxUString &s1, const wxCStrData *s2)
610 { return s1 + wxUString(s2); }
611inline wxUString operator+(const wxUString &s1, const wxChar16* s2)
612 { return s1 + wxUString(s2); }
613inline wxUString operator+(const wxUString &s1, const wxChar32 *s2)
614 { return s1 + wxUString(s2); }
de4983f3 615inline wxUString operator+(const wxUString &s1, const wxScopedCharBuffer &s2)
9a6d1438 616 { return s1 + wxUString(s2); }
de4983f3 617inline wxUString operator+(const wxUString &s1, const wxScopedU16CharBuffer &s2)
9a6d1438 618 { return s1 + wxUString(s2); }
de4983f3 619inline wxUString operator+(const wxUString &s1, const wxScopedU32CharBuffer &s2)
9a6d1438
RR
620 { return s1 + wxUString(s2); }
621inline wxUString operator+(const wxUString &s1, char s2)
622 { return s1 + wxUString(s2); }
623inline wxUString operator+(const wxUString &s1, wxChar32 s2)
624 { wxUString ret( s1 ); ret.append( s2 ); return ret; }
625inline wxUString operator+(const wxUString &s1, wxChar16 s2)
626 { wxUString ret( s1 ); ret.append( (wxChar32) s2 ); return ret; }
627inline wxUString operator+(const wxUString &s1, wxUniChar s2)
628 { wxUString ret( s1 ); ret.append( (wxChar32) s2.GetValue() ); return ret; }
629inline wxUString operator+(const wxUString &s1, wxUniCharRef s2)
630 { wxUString ret( s1 ); ret.append( (wxChar32) s2.GetValue() ); return ret; }
631
632inline wxUString operator+(const char *s1, const wxUString &s2)
633 { return wxUString(s1) + s2; }
634inline wxUString operator+(const wxString &s1, const wxUString &s2)
635 { return wxUString(s1) + s2; }
636inline wxUString operator+(const wxCStrData *s1, const wxUString &s2)
637 { return wxUString(s1) + s2; }
638inline wxUString operator+(const wxChar16* s1, const wxUString &s2)
639 { return wxUString(s1) + s2; }
640inline wxUString operator+(const wxChar32 *s1, const wxUString &s2)
641 { return wxUString(s1) + s2; }
de4983f3 642inline wxUString operator+(const wxScopedCharBuffer &s1, const wxUString &s2)
9a6d1438 643 { return wxUString(s1) + s2; }
de4983f3 644inline wxUString operator+(const wxScopedU16CharBuffer &s1, const wxUString &s2)
9a6d1438 645 { return wxUString(s1) + s2; }
de4983f3 646inline wxUString operator+(const wxScopedU32CharBuffer &s1, const wxUString &s2)
9a6d1438
RR
647 { return wxUString(s1) + s2; }
648inline wxUString operator+(char s1, const wxUString &s2)
649 { return wxUString(s1) + s2; }
650inline wxUString operator+(wxChar32 s1, const wxUString &s2 )
651 { return wxUString(s1) + s2; }
652inline wxUString operator+(wxChar16 s1, const wxUString &s2)
653 { return wxUString(s1) + s2; }
654inline wxUString operator+(wxUniChar s1, const wxUString &s2)
655 { return wxUString(s1) + s2; }
656inline wxUString operator+(wxUniCharRef s1, const wxUString &s2)
657 { return wxUString(s1) + s2; }
658
659
660inline bool operator==(const wxUString& s1, const wxUString& s2)
661 { return s1.compare( s2 ) == 0; }
662inline bool operator!=(const wxUString& s1, const wxUString& s2)
663 { return s1.compare( s2 ) != 0; }
664inline bool operator< (const wxUString& s1, const wxUString& s2)
a99bcb5e 665 { return s1.compare( s2 ) < 0; }
9a6d1438
RR
666inline bool operator> (const wxUString& s1, const wxUString& s2)
667 { return s1.compare( s2 ) > 0; }
668inline bool operator<=(const wxUString& s1, const wxUString& s2)
669 { return s1.compare( s2 ) <= 0; }
670inline bool operator>=(const wxUString& s1, const wxUString& s2)
671 { return s1.compare( s2 ) >= 0; }
672
673#define wxUSTRING_COMP_OPERATORS( T ) \
674inline bool operator==(const wxUString& s1, T s2) \
675 { return s1.compare( wxUString(s2) ) == 0; } \
676inline bool operator!=(const wxUString& s1, T s2) \
677 { return s1.compare( wxUString(s2) ) != 0; } \
678inline bool operator< (const wxUString& s1, T s2) \
679 { return s1.compare( wxUString(s2) ) < 0; } \
680inline bool operator> (const wxUString& s1, T s2) \
681 { return s1.compare( wxUString(s2) ) > 0; } \
682inline bool operator<=(const wxUString& s1, T s2) \
683 { return s1.compare( wxUString(s2) ) <= 0; } \
684inline bool operator>=(const wxUString& s1, T s2) \
685 { return s1.compare( wxUString(s2) ) >= 0; } \
686\
687inline bool operator==(T s2, const wxUString& s1) \
688 { return s1.compare( wxUString(s2) ) == 0; } \
689inline bool operator!=(T s2, const wxUString& s1) \
690 { return s1.compare( wxUString(s2) ) != 0; } \
691inline bool operator< (T s2, const wxUString& s1) \
692 { return s1.compare( wxUString(s2) ) > 0; } \
693inline bool operator> (T s2, const wxUString& s1) \
694 { return s1.compare( wxUString(s2) ) < 0; } \
695inline bool operator<=(T s2, const wxUString& s1) \
696 { return s1.compare( wxUString(s2) ) >= 0; } \
697inline bool operator>=(T s2, const wxUString& s1) \
698 { return s1.compare( wxUString(s2) ) <= 0; }
699
700wxUSTRING_COMP_OPERATORS( const wxString & )
701wxUSTRING_COMP_OPERATORS( const char * )
702wxUSTRING_COMP_OPERATORS( const wxChar16 * )
703wxUSTRING_COMP_OPERATORS( const wxChar32 * )
de4983f3
VS
704wxUSTRING_COMP_OPERATORS( const wxScopedCharBuffer & )
705wxUSTRING_COMP_OPERATORS( const wxScopedU16CharBuffer & )
706wxUSTRING_COMP_OPERATORS( const wxScopedU32CharBuffer & )
9a6d1438
RR
707wxUSTRING_COMP_OPERATORS( const wxCStrData * )
708
6286f3c8 709#endif // _WX_USTRING_H_