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