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