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