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