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