]> git.saurik.com Git - wxWidgets.git/blame - include/wx/string.h
wxMDIChildFrame::Maximize() should have default value for its argument just as wxFram...
[wxWidgets.git] / include / wx / string.h
CommitLineData
3c67202d 1///////////////////////////////////////////////////////////////////////////////
1c2d1459 2// Name: wx/string.h
3c67202d 3// Purpose: wxString and wxArrayString classes
c801d85f
KB
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 29/01/98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 9// Licence: wxWindows licence
3c67202d 10///////////////////////////////////////////////////////////////////////////////
c801d85f 11
e90c1d2a
VZ
12/*
13 Efficient string class [more or less] compatible with MFC CString,
77ffb593 14 wxWidgets version 1 wxString and std::string and some handy functions
e90c1d2a
VZ
15 missing from string.h.
16*/
17
34138703
JS
18#ifndef _WX_WXSTRINGH__
19#define _WX_WXSTRINGH__
c801d85f 20
12028905 21#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
e90c1d2a
VZ
22 #pragma interface "string.h"
23#endif
24
e90c1d2a
VZ
25// ----------------------------------------------------------------------------
26// headers
27// ----------------------------------------------------------------------------
28
5737d05f
VZ
29#include "wx/defs.h" // everybody should include this
30
9dea36ef 31#if defined(__WXMAC__) || defined(__VISAGECPP__)
3f4a0c5b 32 #include <ctype.h>
17dff81c 33#endif
3f4a0c5b 34
9dea36ef
DW
35#if defined(__VISAGECPP__) && __IBMCPP__ >= 400
36 // problem in VACPP V4 with including stdlib.h multiple times
37 // strconv includes it anyway
38# include <stdio.h>
39# include <string.h>
40# include <stdarg.h>
41# include <limits.h>
42#else
43# include <string.h>
44# include <stdio.h>
45# include <stdarg.h>
46# include <limits.h>
47# include <stdlib.h>
48#endif
c801d85f 49
1c2d1459 50#ifdef HAVE_STRCASECMP_IN_STRINGS_H
1bfcb0b6 51 #include <strings.h> // for strcasecmp()
1c2d1459 52#endif // HAVE_STRCASECMP_IN_STRINGS_H
1bfcb0b6 53
4055ed82 54#ifdef __WXPALMOS__
ffecfa5a
JS
55 #include <StringMgr.h>
56#endif
57
e90c1d2a
VZ
58#include "wx/wxchar.h" // for wxChar
59#include "wx/buffer.h" // for wxCharBuffer
60#include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes
3f4a0c5b 61
fb3c9042
VZ
62class WXDLLIMPEXP_BASE wxString;
63
c801d85f
KB
64// ---------------------------------------------------------------------------
65// macros
66// ---------------------------------------------------------------------------
67
5737d05f
VZ
68// casts [unfortunately!] needed to call some broken functions which require
69// "char *" instead of "const char *"
2bb67b80 70#define WXSTRINGCAST (wxChar *)(const wxChar *)
e90c1d2a
VZ
71#define wxCSTRINGCAST (wxChar *)(const wxChar *)
72#define wxMBSTRINGCAST (char *)(const char *)
73#define wxWCSTRINGCAST (wchar_t *)(const wchar_t *)
c801d85f 74
3c67202d 75// implementation only
5737d05f 76#define wxASSERT_VALID_INDEX(i) \
e87b7833 77 wxASSERT_MSG( (size_t)(i) <= length(), _T("invalid index in wxString") )
c801d85f 78
e90c1d2a
VZ
79// ----------------------------------------------------------------------------
80// constants
81// ----------------------------------------------------------------------------
82
83// maximum possible length for a string means "take all string" everywhere
2cbfa061 84#define wxSTRING_MAXLEN wxStringBase::npos
66b6b045 85
e90c1d2a
VZ
86// ----------------------------------------------------------------------------
87// global data
88// ----------------------------------------------------------------------------
89
90// global pointer to empty string
bddd7a8d 91extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString;
6001e347 92
c801d85f 93// ---------------------------------------------------------------------------
e90c1d2a 94// global functions complementing standard C string library replacements for
3c67202d
VZ
95// strlen() and portable strcasecmp()
96//---------------------------------------------------------------------------
e90c1d2a
VZ
97
98// Use wxXXX() functions from wxchar.h instead! These functions are for
99// backwards compatibility only.
88150e60 100
3c67202d 101// checks whether the passed in pointer is NULL and if the string is empty
6d56eb5c 102inline bool IsEmpty(const char *p) { return (!p || !*p); }
c801d85f 103
3c67202d 104// safe version of strlen() (returns 0 if passed NULL pointer)
6d56eb5c 105inline size_t Strlen(const char *psz)
c801d85f
KB
106 { return psz ? strlen(psz) : 0; }
107
3c67202d 108// portable strcasecmp/_stricmp
6d56eb5c 109inline int Stricmp(const char *psz1, const char *psz2)
dd1eaa89 110{
7f0586ef
JS
111#if defined(__VISUALC__) && defined(__WXWINCE__)
112 register char c1, c2;
113 do {
114 c1 = tolower(*psz1++);
115 c2 = tolower(*psz2++);
116 } while ( c1 && (c1 == c2) );
117
118 return c1 - c2;
119#elif defined(__VISUALC__) || ( defined(__MWERKS__) && defined(__INTEL__) )
dd1eaa89 120 return _stricmp(psz1, psz2);
91b8de8d 121#elif defined(__SC__)
2432b92d 122 return _stricmp(psz1, psz2);
91b8de8d 123#elif defined(__SALFORDC__)
a3ef5bf5 124 return stricmp(psz1, psz2);
dd1eaa89
VZ
125#elif defined(__BORLANDC__)
126 return stricmp(psz1, psz2);
7be1f0d9
JS
127#elif defined(__WATCOMC__)
128 return stricmp(psz1, psz2);
14704334
VS
129#elif defined(__DJGPP__)
130 return stricmp(psz1, psz2);
91b8de8d
RR
131#elif defined(__EMX__)
132 return stricmp(psz1, psz2);
e2c87f4c 133#elif defined(__WXPM__)
1777b9bb 134 return stricmp(psz1, psz2);
a0be6908
WS
135#elif defined(__WXPALMOS__) || \
136 defined(HAVE_STRCASECMP_IN_STRING_H) || \
1c2d1459
VZ
137 defined(HAVE_STRCASECMP_IN_STRINGS_H) || \
138 defined(__GNUWIN32__)
dd1eaa89 139 return strcasecmp(psz1, psz2);
8be97d65 140#elif defined(__MWERKS__) && !defined(__INTEL__)
17dff81c
SC
141 register char c1, c2;
142 do {
143 c1 = tolower(*psz1++);
144 c2 = tolower(*psz2++);
145 } while ( c1 && (c1 == c2) );
146
147 return c1 - c2;
dd1eaa89
VZ
148#else
149 // almost all compilers/libraries provide this function (unfortunately under
150 // different names), that's why we don't implement our own which will surely
151 // be more efficient than this code (uncomment to use):
152 /*
153 register char c1, c2;
154 do {
155 c1 = tolower(*psz1++);
156 c2 = tolower(*psz2++);
157 } while ( c1 && (c1 == c2) );
158
159 return c1 - c2;
160 */
161
162 #error "Please define string case-insensitive compare for your OS/compiler"
163#endif // OS/compiler
164}
c801d85f 165
e87b7833
MB
166#if wxUSE_STL
167
168#include "wx/beforestd.h"
169#include <string>
170#include "wx/afterstd.h"
171
172#if wxUSE_UNICODE
0c7cfd99 173 #ifdef HAVE_STD_WSTRING
e87b7833
MB
174 typedef std::wstring wxStringBase;
175 #else
176 typedef std::basic_string<wxChar> wxStringBase;
177 #endif
178#else
179 typedef std::string wxStringBase;
180#endif
181
182#if (defined(__GNUG__) && (__GNUG__ < 3)) || \
9ee7c8d6 183 (defined(_MSC_VER) && (_MSC_VER <= 1200))
e87b7833
MB
184 #define wxSTRING_BASE_HASNT_CLEAR
185#endif
186
187#else // if !wxUSE_STL
188
189#ifndef HAVE_STD_STRING_COMPARE
190 #define HAVE_STD_STRING_COMPARE
191#endif
192
c801d85f 193// ---------------------------------------------------------------------------
f04f3991 194// string data prepended with some housekeeping info (used by wxString class),
c801d85f
KB
195// is never used directly (but had to be put here to allow inlining)
196// ---------------------------------------------------------------------------
e90c1d2a 197
bddd7a8d 198struct WXDLLIMPEXP_BASE wxStringData
c801d85f
KB
199{
200 int nRefs; // reference count
3c024cc2 201 size_t nDataLength, // actual string length
c801d85f
KB
202 nAllocLength; // allocated memory size
203
2bb67b80
OK
204 // mimics declaration 'wxChar data[nAllocLength]'
205 wxChar* data() const { return (wxChar*)(this + 1); }
c801d85f
KB
206
207 // empty string has a special ref count so it's never deleted
dbda9e86
JS
208 bool IsEmpty() const { return (nRefs == -1); }
209 bool IsShared() const { return (nRefs > 1); }
c801d85f
KB
210
211 // lock/unlock
dd1eaa89 212 void Lock() { if ( !IsEmpty() ) nRefs++; }
f6bcfd97 213
8ecf21b7 214 // VC++ will refuse to inline Unlock but profiling shows that it is wrong
f6bcfd97 215#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
1c2d1459 216 __forceinline
f6bcfd97 217#endif
ca5e07c7
GD
218 // VC++ free must take place in same DLL as allocation when using non dll
219 // run-time library (e.g. Multithreaded instead of Multithreaded DLL)
8ecf21b7
GD
220#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL)
221 void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); }
ca5e07c7
GD
222 // we must not inline deallocation since allocation is not inlined
223 void Free();
8ecf21b7 224#else
f1317a5d 225 void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); }
8ecf21b7 226#endif
8fd0f20b 227
dd1eaa89 228 // if we had taken control over string memory (GetWriteBuf), it's
8fd0f20b 229 // intentionally put in invalid state
dbda9e86
JS
230 void Validate(bool b) { nRefs = (b ? 1 : 0); }
231 bool IsValid() const { return (nRefs != 0); }
c801d85f
KB
232};
233
e87b7833 234class WXDLLIMPEXP_BASE wxStringBase
3c67202d 235{
df5168c4 236#if !wxUSE_STL
bddd7a8d 237friend class WXDLLIMPEXP_BASE wxArrayString;
df5168c4 238#endif
5c0217af
SC
239public :
240 // an 'invalid' value for string index, moved to this place due to a CW bug
241 static const size_t npos;
e87b7833 242protected:
dd1eaa89 243 // points to data preceded by wxStringData structure with ref count info
2bb67b80 244 wxChar *m_pchData;
dd1eaa89
VZ
245
246 // accessor to string data
247 wxStringData* GetStringData() const { return (wxStringData*)m_pchData - 1; }
248
6b95b20d
VZ
249 // string (re)initialization functions
250 // initializes the string to the empty value (must be called only from
251 // ctors, use Reinit() otherwise)
e90c1d2a 252 void Init() { m_pchData = (wxChar *)wxEmptyString; }
6b95b20d 253 // initializaes the string with (a part of) C-string
e87b7833 254 void InitWith(const wxChar *psz, size_t nPos = 0, size_t nLen = npos);
6b95b20d
VZ
255 // as Init, but also frees old data
256 void Reinit() { GetStringData()->Unlock(); Init(); }
257
258 // memory allocation
b1801e0e
GD
259 // allocates memory for string of length nLen
260 bool AllocBuffer(size_t nLen);
6b95b20d 261 // copies data to another string
b1801e0e 262 bool AllocCopy(wxString&, int, int) const;
6b95b20d 263 // effectively copies data to string
b1801e0e 264 bool AssignCopy(size_t, const wxChar *);
6b95b20d
VZ
265
266 // append a (sub)string
e87b7833
MB
267 bool ConcatSelf(size_t nLen, const wxChar *src, size_t nMaxLen);
268 bool ConcatSelf(size_t nLen, const wxChar *src)
269 { return ConcatSelf(nLen, src, nLen); }
6b95b20d
VZ
270
271 // functions called before writing to the string: they copy it if there
272 // are other references to our data (should be the only owner when writing)
b1801e0e
GD
273 bool CopyBeforeWrite();
274 bool AllocBeforeWrite(size_t);
6b95b20d 275
e87b7833
MB
276 // compatibility with wxString
277 bool Alloc(size_t nLen);
278public:
279 // standard types
280 typedef wxChar value_type;
281 typedef wxChar char_type;
282 typedef size_t size_type;
283 typedef value_type& reference;
284 typedef const value_type& const_reference;
285 typedef value_type* pointer;
286 typedef const value_type* const_pointer;
287 typedef value_type *iterator;
288 typedef const value_type *const_iterator;
00b4a13e 289
3c67202d
VZ
290 // constructors and destructor
291 // ctor for an empty string
e87b7833 292 wxStringBase() { Init(); }
3c67202d 293 // copy ctor
e87b7833 294 wxStringBase(const wxStringBase& stringSrc)
6b95b20d 295 {
09443a26
VZ
296 wxASSERT_MSG( stringSrc.GetStringData()->IsValid(),
297 _T("did you forget to call UngetWriteBuf()?") );
6b95b20d 298
e87b7833 299 if ( stringSrc.empty() ) {
6b95b20d
VZ
300 // nothing to do for an empty string
301 Init();
302 }
303 else {
304 m_pchData = stringSrc.m_pchData; // share same data
305 GetStringData()->Lock(); // => one more copy
306 }
307 }
3c67202d 308 // string containing nRepeat copies of ch
e87b7833 309 wxStringBase(size_type nRepeat, wxChar ch);
3c67202d 310 // ctor takes first nLength characters from C string
e87b7833
MB
311 // (default value of npos means take all the string)
312 wxStringBase(const wxChar *psz)
313 { InitWith(psz, 0, npos); }
314 wxStringBase(const wxChar *psz, size_t nLength)
b1801e0e 315 { InitWith(psz, 0, nLength); }
e87b7833 316 wxStringBase(const wxChar *psz, wxMBConv& WXUNUSED(conv), size_t nLength = npos)
b1801e0e 317 { InitWith(psz, 0, nLength); }
e87b7833
MB
318 // take nLen chars starting at nPos
319 wxStringBase(const wxStringBase& str, size_t nPos, size_t nLen)
320 {
321 wxASSERT_MSG( str.GetStringData()->IsValid(),
322 _T("did you forget to call UngetWriteBuf()?") );
323 Init();
324 size_t strLen = str.length() - nPos; nLen = strLen < nLen ? strLen : nLen;
325 InitWith(str.c_str(), nPos, nLen);
326 }
327 // take all characters from pStart to pEnd
328 wxStringBase(const void *pStart, const void *pEnd);
329
330 // dtor is not virtual, this class must not be inherited from!
1c2d1459
VZ
331 ~wxStringBase()
332 {
7b758e8f 333#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
1c2d1459
VZ
334 //RN - according to the above VC++ does indeed inline this,
335 //even though it spits out two warnings
336 #pragma warning (disable:4714)
7b758e8f 337#endif
e87b7833 338
1c2d1459 339 GetStringData()->Unlock();
7b758e8f
RN
340 }
341
342#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
1c2d1459
VZ
343 //re-enable inlining warning
344 #pragma warning (default:4714)
345#endif
e87b7833
MB
346 // overloaded assignment
347 // from another wxString
348 wxStringBase& operator=(const wxStringBase& stringSrc);
349 // from a character
350 wxStringBase& operator=(wxChar ch);
351 // from a C string
352 wxStringBase& operator=(const wxChar *psz);
353
354 // return the length of the string
355 size_type size() const { return GetStringData()->nDataLength; }
356 // return the length of the string
357 size_type length() const { return size(); }
358 // return the maximum size of the string
359 size_type max_size() const { return wxSTRING_MAXLEN; }
360 // resize the string, filling the space with c if c != 0
361 void resize(size_t nSize, wxChar ch = wxT('\0'));
362 // delete the contents of the string
363 void clear() { erase(0, npos); }
364 // returns true if the string is empty
365 bool empty() const { return size() == 0; }
366 // inform string about planned change in size
367 void reserve(size_t sz) { Alloc(sz); }
368 size_type capacity() const { return GetStringData()->nAllocLength; }
369
370 // lib.string.access
371 // return the character at position n
372 value_type at(size_type n) const
373 { wxASSERT_VALID_INDEX( n ); return m_pchData[n]; }
e87b7833
MB
374 // returns the writable character at position n
375 reference at(size_type n)
376 { wxASSERT_VALID_INDEX( n ); CopyBeforeWrite(); return m_pchData[n]; }
e87b7833
MB
377
378 // lib.string.modifiers
379 // append elements str[pos], ..., str[pos+n]
380 wxStringBase& append(const wxStringBase& str, size_t pos, size_t n)
381 {
382 wxASSERT(pos <= str.length());
383 ConcatSelf(n, str.c_str() + pos, str.length() - pos);
384 return *this;
385 }
386 // append a string
387 wxStringBase& append(const wxStringBase& str)
388 { ConcatSelf(str.length(), str.c_str()); return *this; }
389 // append first n (or all if n == npos) characters of sz
390 wxStringBase& append(const wxChar *sz)
391 { ConcatSelf(wxStrlen(sz), sz); return *this; }
392 wxStringBase& append(const wxChar *sz, size_t n)
393 { ConcatSelf(n, sz); return *this; }
394 // append n copies of ch
395 wxStringBase& append(size_t n, wxChar ch);
396 // append from first to last
397 wxStringBase& append(const_iterator first, const_iterator last)
398 { ConcatSelf(last - first, first); return *this; }
399
400 // same as `this_string = str'
401 wxStringBase& assign(const wxStringBase& str)
402 { return *this = str; }
403 // same as ` = str[pos..pos + n]
404 wxStringBase& assign(const wxStringBase& str, size_t pos, size_t n)
405 { clear(); return append(str, pos, n); }
406 // same as `= first n (or all if n == npos) characters of sz'
407 wxStringBase& assign(const wxChar *sz)
408 { clear(); return append(sz, wxStrlen(sz)); }
409 wxStringBase& assign(const wxChar *sz, size_t n)
410 { clear(); return append(sz, n); }
411 // same as `= n copies of ch'
412 wxStringBase& assign(size_t n, wxChar ch)
413 { clear(); return append(n, ch); }
414 // assign from first to last
415 wxStringBase& assign(const_iterator first, const_iterator last)
416 { clear(); return append(first, last); }
417
418 // first valid index position
419 const_iterator begin() const { return m_pchData; }
420 // position one after the last valid one
421 const_iterator end() const { return m_pchData + length(); }
422
423 // first valid index position
ac3c86ee 424 iterator begin();
e87b7833 425 // position one after the last valid one
ac3c86ee 426 iterator end();
e87b7833
MB
427
428 // insert another string
429 wxStringBase& insert(size_t nPos, const wxStringBase& str)
430 {
431 wxASSERT( str.GetStringData()->IsValid() );
432 return insert(nPos, str.c_str(), str.length());
433 }
434 // insert n chars of str starting at nStart (in str)
435 wxStringBase& insert(size_t nPos, const wxStringBase& str, size_t nStart, size_t n)
436 {
437 wxASSERT( str.GetStringData()->IsValid() );
438 wxASSERT( nStart < str.length() );
439 size_t strLen = str.length() - nStart;
440 n = strLen < n ? strLen : n;
441 return insert(nPos, str.c_str() + nStart, n);
442 }
443 // insert first n (or all if n == npos) characters of sz
444 wxStringBase& insert(size_t nPos, const wxChar *sz, size_t n = npos);
445 // insert n copies of ch
446 wxStringBase& insert(size_t nPos, size_t n, wxChar ch)
447 { return insert(nPos, wxStringBase(n, ch)); }
448 iterator insert(iterator it, wxChar ch)
1c2d1459 449 { size_t idx = it - begin(); insert(idx, 1, ch); return begin() + idx; }
e87b7833
MB
450 void insert(iterator it, const_iterator first, const_iterator last)
451 { insert(it - begin(), first, last - first); }
452 void insert(iterator it, size_type n, wxChar ch)
453 { insert(it - begin(), n, ch); }
454
455 // delete characters from nStart to nStart + nLen
456 wxStringBase& erase(size_type pos = 0, size_type n = npos);
457 iterator erase(iterator first, iterator last)
458 {
459 size_t idx = first - begin();
460 erase(idx, last - first);
461 return begin() + idx;
462 }
463 iterator erase(iterator first);
464
465 // explicit conversion to C string (use this with printf()!)
466 const wxChar* c_str() const { return m_pchData; }
467 const wxChar* data() const { return m_pchData; }
468
469 // replaces the substring of length nLen starting at nStart
470 wxStringBase& replace(size_t nStart, size_t nLen, const wxChar* sz);
471 // replaces the substring of length nLen starting at nStart
472 wxStringBase& replace(size_t nStart, size_t nLen, const wxStringBase& str)
473 { return replace(nStart, nLen, str.c_str()); }
474 // replaces the substring with nCount copies of ch
475 wxStringBase& replace(size_t nStart, size_t nLen, size_t nCount, wxChar ch);
476 // replaces a substring with another substring
477 wxStringBase& replace(size_t nStart, size_t nLen,
478 const wxStringBase& str, size_t nStart2, size_t nLen2);
479 // replaces the substring with first nCount chars of sz
480 wxStringBase& replace(size_t nStart, size_t nLen,
481 const wxChar* sz, size_t nCount);
482 wxStringBase& replace(iterator first, iterator last, const_pointer s)
483 { return replace(first - begin(), last - first, s); }
484 wxStringBase& replace(iterator first, iterator last, const_pointer s,
485 size_type n)
486 { return replace(first - begin(), last - first, s, n); }
487 wxStringBase& replace(iterator first, iterator last, const wxStringBase& s)
488 { return replace(first - begin(), last - first, s); }
489 wxStringBase& replace(iterator first, iterator last, size_type n, wxChar c)
490 { return replace(first - begin(), last - first, n, c); }
491 wxStringBase& replace(iterator first, iterator last,
492 const_iterator first1, const_iterator last1)
493 { return replace(first - begin(), last - first, first1, last1 - first1); }
494
495 // swap two strings
496 void swap(wxStringBase& str);
497
498 // All find() functions take the nStart argument which specifies the
499 // position to start the search on, the default value is 0. All functions
500 // return npos if there were no match.
501
502 // find a substring
503 size_t find(const wxStringBase& str, size_t nStart = 0) const;
504
505 // VC++ 1.5 can't cope with this syntax.
506#if !defined(__VISUALC__) || defined(__WIN32__)
507 // find first n characters of sz
508 size_t find(const wxChar* sz, size_t nStart = 0, size_t n = npos) const;
509#endif // VC++ 1.5
510
e87b7833
MB
511 // find the first occurence of character ch after nStart
512 size_t find(wxChar ch, size_t nStart = 0) const;
1412634b 513
e87b7833
MB
514 // rfind() family is exactly like find() but works right to left
515
516 // as find, but from the end
517 size_t rfind(const wxStringBase& str, size_t nStart = npos) const;
518
519 // VC++ 1.5 can't cope with this syntax.
520 // as find, but from the end
521 size_t rfind(const wxChar* sz, size_t nStart = npos,
522 size_t n = npos) const;
523 // as find, but from the end
524 size_t rfind(wxChar ch, size_t nStart = npos) const;
525
526 // find first/last occurence of any character in the set
527
528 // as strpbrk() but starts at nStart, returns npos if not found
529 size_t find_first_of(const wxStringBase& str, size_t nStart = 0) const
530 { return find_first_of(str.c_str(), nStart); }
531 // same as above
532 size_t find_first_of(const wxChar* sz, size_t nStart = 0) const;
e2101186 533 size_t find_first_of(const wxChar* sz, size_t nStart, size_t n) const;
e87b7833
MB
534 // same as find(char, size_t)
535 size_t find_first_of(wxChar c, size_t nStart = 0) const
536 { return find(c, nStart); }
537 // find the last (starting from nStart) char from str in this string
538 size_t find_last_of (const wxStringBase& str, size_t nStart = npos) const
539 { return find_last_of(str.c_str(), nStart); }
540 // same as above
541 size_t find_last_of (const wxChar* sz, size_t nStart = npos) const;
e2101186 542 size_t find_last_of(const wxChar* sz, size_t nStart, size_t n) const;
e87b7833
MB
543 // same as above
544 size_t find_last_of(wxChar c, size_t nStart = npos) const
545 { return rfind(c, nStart); }
546
547 // find first/last occurence of any character not in the set
548
549 // as strspn() (starting from nStart), returns npos on failure
550 size_t find_first_not_of(const wxStringBase& str, size_t nStart = 0) const
551 { return find_first_not_of(str.c_str(), nStart); }
552 // same as above
553 size_t find_first_not_of(const wxChar* sz, size_t nStart = 0) const;
e2101186 554 size_t find_first_not_of(const wxChar* sz, size_t nStart, size_t n) const;
e87b7833
MB
555 // same as above
556 size_t find_first_not_of(wxChar ch, size_t nStart = 0) const;
557 // as strcspn()
558 size_t find_last_not_of(const wxStringBase& str, size_t nStart = npos) const
e2101186 559 { return find_last_not_of(str.c_str(), nStart); }
e87b7833
MB
560 // same as above
561 size_t find_last_not_of(const wxChar* sz, size_t nStart = npos) const;
e2101186 562 size_t find_last_not_of(const wxChar* sz, size_t nStart, size_t n) const;
e87b7833
MB
563 // same as above
564 size_t find_last_not_of(wxChar ch, size_t nStart = npos) const;
565
566 // All compare functions return -1, 0 or 1 if the [sub]string is less,
567 // equal or greater than the compare() argument.
568
dcb68102
RN
569 // comparison with another string
570 int compare(const wxStringBase& str) const;
e87b7833
MB
571 // comparison with a substring
572 int compare(size_t nStart, size_t nLen, const wxStringBase& str) const;
573 // comparison of 2 substrings
574 int compare(size_t nStart, size_t nLen,
575 const wxStringBase& str, size_t nStart2, size_t nLen2) const;
dcb68102
RN
576 // comparison with a c string
577 int compare(const wxChar* sz) const;
e87b7833
MB
578 // substring comparison with first nCount characters of sz
579 int compare(size_t nStart, size_t nLen,
580 const wxChar* sz, size_t nCount = npos) const;
581
582 size_type copy(wxChar* s, size_type n, size_type pos = 0);
583
584 // substring extraction
585 wxStringBase substr(size_t nStart = 0, size_t nLen = npos) const;
586
587 // string += string
588 wxStringBase& operator+=(const wxStringBase& s) { return append(s); }
589 // string += C string
590 wxStringBase& operator+=(const wxChar *psz) { return append(psz); }
591 // string += char
592 wxStringBase& operator+=(wxChar ch) { return append(1, ch); }
593};
594
595#endif // !wxUSE_STL
596
b6339dde
VZ
597// ----------------------------------------------------------------------------
598// wxString: string class trying to be compatible with std::string, MFC
599// CString and wxWindows 1.x wxString all at once
e87b7833
MB
600// ---------------------------------------------------------------------------
601
602class WXDLLIMPEXP_BASE wxString : public wxStringBase
603{
604#if !wxUSE_STL
605friend class WXDLLIMPEXP_BASE wxArrayString;
606#endif
607
608 // NB: special care was taken in arranging the member functions in such order
609 // that all inline functions can be effectively inlined, verify that all
610 // performace critical functions are still inlined if you change order!
611private:
612 // if we hadn't made these operators private, it would be possible to
613 // compile "wxString s; s = 17;" without any warnings as 17 is implicitly
614 // converted to char in C and we do have operator=(char)
615 //
616 // NB: we don't need other versions (short/long and unsigned) as attempt
617 // to assign another numeric type to wxString will now result in
618 // ambiguity between operator=(char) and operator=(int)
619 wxString& operator=(int);
620
621 // these methods are not implemented - there is _no_ conversion from int to
622 // string, you're doing something wrong if the compiler wants to call it!
623 //
624 // try `s << i' or `s.Printf("%d", i)' instead
625 wxString(int);
626
627public:
628 // constructors and destructor
629 // ctor for an empty string
630 wxString() : wxStringBase() { }
631 // copy ctor
632 wxString(const wxStringBase& stringSrc) : wxStringBase(stringSrc) { }
633 wxString(const wxString& stringSrc) : wxStringBase(stringSrc) { }
634 // string containing nRepeat copies of ch
635 wxString(wxChar ch, size_t nRepeat = 1)
636 : wxStringBase(nRepeat, ch) { }
637 wxString(size_t nRepeat, wxChar ch)
638 : wxStringBase(nRepeat, ch) { }
639 // ctor takes first nLength characters from C string
640 // (default value of npos means take all the string)
641 wxString(const wxChar *psz)
642 : wxStringBase(psz ? psz : wxT("")) { }
643 wxString(const wxChar *psz, size_t nLength)
644 : wxStringBase(psz, nLength) { }
645 wxString(const wxChar *psz, wxMBConv& WXUNUSED(conv), size_t nLength = npos)
646 : wxStringBase(psz, nLength == npos ? wxStrlen(psz) : nLength) { }
e90c1d2a 647
2bb67b80
OK
648#if wxUSE_UNICODE
649 // from multibyte string
e87b7833 650 wxString(const char *psz, wxMBConv& conv, size_t nLength = npos);
2bb67b80 651 // from wxWCharBuffer (i.e. return from wxGetString)
e87b7833 652 wxString(const wxWCharBuffer& psz) : wxStringBase(psz.data()) { }
e90c1d2a 653#else // ANSI
3c67202d 654 // from C string (for compilers using unsigned char)
e87b7833
MB
655 wxString(const unsigned char* psz, size_t nLength = npos)
656 : wxStringBase((const char*)psz, nLength) { }
e90c1d2a 657
6f841509 658#if wxUSE_WCHAR_T
2bb67b80 659 // from wide (Unicode) string
e87b7833 660 wxString(const wchar_t *pwz, wxMBConv& conv = wxConvLibc, size_t nLength = npos);
e90c1d2a
VZ
661#endif // !wxUSE_WCHAR_T
662
2bb67b80
OK
663 // from wxCharBuffer
664 wxString(const wxCharBuffer& psz)
051aa330 665 : wxStringBase(psz) { }
e90c1d2a
VZ
666#endif // Unicode/ANSI
667
3c67202d
VZ
668 // generic attributes & operations
669 // as standard strlen()
e87b7833 670 size_t Len() const { return length(); }
3c67202d 671 // string contains any characters?
e87b7833 672 bool IsEmpty() const { return empty(); }
d775fa82 673 // empty string is "false", so !str will return true
dcfde592 674 bool operator!() const { return IsEmpty(); }
735d1db6
VZ
675 // truncate the string to given length
676 wxString& Truncate(size_t uiLen);
3c67202d 677 // empty string contents
dd1eaa89
VZ
678 void Empty()
679 {
735d1db6 680 Truncate(0);
dd1eaa89 681
735d1db6 682 wxASSERT_MSG( IsEmpty(), _T("string not empty after call to Empty()?") );
7be07660 683 }
3c67202d 684 // empty the string and free memory
7be07660
VZ
685 void Clear()
686 {
e87b7833
MB
687 wxString tmp(wxEmptyString);
688 swap(tmp);
dd1eaa89
VZ
689 }
690
3c67202d
VZ
691 // contents test
692 // Is an ascii value
c801d85f 693 bool IsAscii() const;
3c67202d 694 // Is a number
c801d85f 695 bool IsNumber() const;
3c67202d 696 // Is a word
c801d85f 697 bool IsWord() const;
c801d85f 698
3c67202d
VZ
699 // data access (all indexes are 0 based)
700 // read access
2bb67b80 701 wxChar GetChar(size_t n) const
9d9ad673 702 { return at(n); }
3c67202d 703 // read/write access
2bb67b80 704 wxChar& GetWritableChar(size_t n)
9d9ad673 705 { return at(n); }
3c67202d 706 // write access
2bb67b80 707 void SetChar(size_t n, wxChar ch)
9d9ad673 708 { at(n) = ch; }
c801d85f 709
3c67202d 710 // get last character
2bb67b80 711 wxChar Last() const
09443a26
VZ
712 {
713 wxASSERT_MSG( !IsEmpty(), _T("wxString: index out of bounds") );
714
9d9ad673 715 return at(length() - 1);
09443a26
VZ
716 }
717
3c67202d 718 // get writable last character
2bb67b80 719 wxChar& Last()
09443a26
VZ
720 {
721 wxASSERT_MSG( !IsEmpty(), _T("wxString: index out of bounds") );
9d9ad673 722 return at(length() - 1);
09443a26 723 }
c801d85f 724
d836ee96 725 /*
9d9ad673 726 Note that we we must define all of the overloads below to avoid
01398433
VZ
727 ambiguity when using str[0]. Also note that for a conforming compiler we
728 don't need const version of operatorp[] at all as indexed access to
729 const string is provided by implicit conversion to "const wxChar *"
730 below and defining them would only result in ambiguities, but some other
731 compilers refuse to compile "str[0]" without them.
d836ee96
VZ
732 */
733
01398433
VZ
734#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__MWERKS__)
735 wxChar operator[](int n) const
736 { return wxStringBase::at(n); }
737 wxChar operator[](size_type n) const
738 { return wxStringBase::at(n); }
739#ifndef wxSIZE_T_IS_UINT
740 wxChar operator[](unsigned int n) const
741 { return wxStringBase::at(n); }
742#endif // size_t != unsigned int
743#endif // broken compiler
744
745
9d9ad673
VZ
746 // operator versions of GetWriteableChar()
747 wxChar& operator[](int n)
748 { return wxStringBase::at(n); }
e87b7833 749 wxChar& operator[](size_type n)
9d9ad673 750 { return wxStringBase::at(n); }
d836ee96 751#ifndef wxSIZE_T_IS_UINT
d836ee96 752 wxChar& operator[](unsigned int n)
9d9ad673 753 { return wxStringBase::at(n); }
d836ee96 754#endif // size_t != unsigned int
c801d85f 755
3c67202d 756 // implicit conversion to C string
e87b7833 757 operator const wxChar*() const { return c_str(); }
e015c2a3 758
e015c2a3 759 // identical to c_str(), for wxWin 1.6x compatibility
e87b7833 760 const wxChar* wx_str() const { return c_str(); }
e015c2a3 761 // identical to c_str(), for MFC compatibility
e87b7833 762 const wxChar* GetData() const { return c_str(); }
e90c1d2a 763
e015c2a3
VZ
764 // conversion to/from plain (i.e. 7 bit) ASCII: this is useful for
765 // converting numbers or strings which are certain not to contain special
766 // chars (typically system functions, X atoms, environment variables etc.)
767 //
768 // the behaviour of these functions with the strings containing anything
769 // else than 7 bit ASCII characters is undefined, use at your own risk.
b1ac3b56 770#if wxUSE_UNICODE
2b5f62a0
VZ
771 static wxString FromAscii(const char *ascii); // string
772 static wxString FromAscii(const char ascii); // char
b1ac3b56 773 const wxCharBuffer ToAscii() const;
e015c2a3
VZ
774#else // ANSI
775 static wxString FromAscii(const char *ascii) { return wxString( ascii ); }
2b5f62a0 776 static wxString FromAscii(const char ascii) { return wxString( ascii ); }
e015c2a3
VZ
777 const char *ToAscii() const { return c_str(); }
778#endif // Unicode/!Unicode
b1ac3b56 779
2b5f62a0 780 // conversions with (possible) format conversions: have to return a
e90c1d2a 781 // buffer with temporary data
f6bcfd97
BP
782 //
783 // the functions defined (in either Unicode or ANSI) mode are mb_str() to
784 // return an ANSI (multibyte) string, wc_str() to return a wide string and
785 // fn_str() to return a string which should be used with the OS APIs
786 // accepting the file names. The return value is always the same, but the
787 // type differs because a function may either return pointer to the buffer
788 // directly or have to use intermediate buffer for translation.
2bb67b80 789#if wxUSE_UNICODE
265d5cce 790 const wxCharBuffer mb_str(wxMBConv& conv = wxConvLibc) const;
f6bcfd97 791
e90c1d2a
VZ
792 const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); }
793
e87b7833 794 const wxChar* wc_str() const { return c_str(); }
f6bcfd97
BP
795
796 // for compatibility with !wxUSE_UNICODE version
e87b7833 797 const wxChar* wc_str(wxMBConv& WXUNUSED(conv)) const { return c_str(); }
e90c1d2a 798
2bb67b80 799#if wxMBFILES
5f709e67 800 const wxCharBuffer fn_str() const { return mb_str(wxConvFile); }
e90c1d2a 801#else // !wxMBFILES
e87b7833 802 const wxChar* fn_str() const { return c_str(); }
e90c1d2a
VZ
803#endif // wxMBFILES/!wxMBFILES
804#else // ANSI
e87b7833 805 const wxChar* mb_str() const { return c_str(); }
f6bcfd97
BP
806
807 // for compatibility with wxUSE_UNICODE version
e87b7833 808 const wxChar* mb_str(wxMBConv& WXUNUSED(conv)) const { return c_str(); }
f6bcfd97 809
e90c1d2a 810 const wxWX2MBbuf mbc_str() const { return mb_str(); }
f6bcfd97 811
6f841509 812#if wxUSE_WCHAR_T
265d5cce 813 const wxWCharBuffer wc_str(wxMBConv& conv) const;
e90c1d2a 814#endif // wxUSE_WCHAR_T
d5c8817c
SC
815#ifdef __WXOSX__
816 const wxCharBuffer fn_str() const { return wxConvFile.cWC2WX( wc_str( wxConvLocal ) ); }
817#else
e87b7833 818 const wxChar* fn_str() const { return c_str(); }
d5c8817c 819#endif
e90c1d2a 820#endif // Unicode/ANSI
c801d85f 821
3c67202d
VZ
822 // overloaded assignment
823 // from another wxString
e87b7833
MB
824 wxString& operator=(const wxStringBase& stringSrc)
825 { return (wxString&)wxStringBase::operator=(stringSrc); }
3c67202d 826 // from a character
e87b7833
MB
827 wxString& operator=(wxChar ch)
828 { return (wxString&)wxStringBase::operator=(ch); }
3c67202d 829 // from a C string
e87b7833
MB
830 wxString& operator=(const wxChar *psz)
831 { return (wxString&)wxStringBase::operator=(psz); }
111bb7f2
OK
832#if wxUSE_UNICODE
833 // from wxWCharBuffer
b1801e0e 834 wxString& operator=(const wxWCharBuffer& psz)
e87b7833 835 { (void) operator=((const wchar_t *)psz); return *this; }
e90c1d2a 836#else // ANSI
3c67202d 837 // from another kind of C string
c801d85f 838 wxString& operator=(const unsigned char* psz);
6f841509 839#if wxUSE_WCHAR_T
3c67202d 840 // from a wide string
c801d85f 841 wxString& operator=(const wchar_t *pwz);
6f841509 842#endif
111bb7f2 843 // from wxCharBuffer
b1801e0e 844 wxString& operator=(const wxCharBuffer& psz)
e87b7833 845 { (void) operator=((const char *)psz); return *this; }
e90c1d2a 846#endif // Unicode/ANSI
3c67202d
VZ
847
848 // string concatenation
849 // in place concatenation
850 /*
851 Concatenate and return the result. Note that the left to right
852 associativity of << allows to write things like "str << str1 << str2
853 << ..." (unlike with +=)
854 */
855 // string += string
dd1eaa89
VZ
856 wxString& operator<<(const wxString& s)
857 {
e87b7833 858#if !wxUSE_STL
09443a26
VZ
859 wxASSERT_MSG( s.GetStringData()->IsValid(),
860 _T("did you forget to call UngetWriteBuf()?") );
e87b7833 861#endif
dd1eaa89 862
e87b7833 863 append(s);
dd1eaa89
VZ
864 return *this;
865 }
3c67202d 866 // string += C string
2bb67b80 867 wxString& operator<<(const wxChar *psz)
e87b7833 868 { append(psz); return *this; }
3c67202d 869 // string += char
e87b7833 870 wxString& operator<<(wxChar ch) { append(1, ch); return *this; }
2bb67b80
OK
871
872 // string += buffer (i.e. from wxGetString)
873#if wxUSE_UNICODE
09443a26
VZ
874 wxString& operator<<(const wxWCharBuffer& s)
875 { (void)operator<<((const wchar_t *)s); return *this; }
876 void operator+=(const wxWCharBuffer& s)
877 { (void)operator<<((const wchar_t *)s); }
878#else // !wxUSE_UNICODE
879 wxString& operator<<(const wxCharBuffer& s)
880 { (void)operator<<((const char *)s); return *this; }
881 void operator+=(const wxCharBuffer& s)
882 { (void)operator<<((const char *)s); }
883#endif // wxUSE_UNICODE/!wxUSE_UNICODE
6b95b20d 884
3c67202d 885 // string += C string
09443a26
VZ
886 wxString& Append(const wxString& s)
887 {
888 // test for IsEmpty() to share the string if possible
889 if ( IsEmpty() )
890 *this = s;
891 else
e87b7833 892 append(s);
09443a26
VZ
893 return *this;
894 }
2bb67b80 895 wxString& Append(const wxChar* psz)
e87b7833 896 { append(psz); return *this; }
3c67202d 897 // append count copies of given character
2bb67b80 898 wxString& Append(wxChar ch, size_t count = 1u)
e87b7833 899 { append(count, ch); return *this; }
8f06a017 900 wxString& Append(const wxChar* psz, size_t nLen)
e87b7833 901 { append(psz, nLen); return *this; }
3c67202d
VZ
902
903 // prepend a string, return the string itself
904 wxString& Prepend(const wxString& str)
905 { *this = str + *this; return *this; }
906
907 // non-destructive concatenation
908 //
bddd7a8d 909 friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2);
3c67202d 910 //
bddd7a8d 911 friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch);
3c67202d 912 //
bddd7a8d 913 friend wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string);
3c67202d 914 //
bddd7a8d 915 friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wxChar *psz);
3c67202d 916 //
bddd7a8d 917 friend wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, const wxString& string);
3c67202d
VZ
918
919 // stream-like functions
920 // insert an int into string
3ce65f6c
VZ
921 wxString& operator<<(int i)
922 { return (*this) << Format(_T("%d"), i); }
923 // insert an unsigned int into string
924 wxString& operator<<(unsigned int ui)
925 { return (*this) << Format(_T("%u"), ui); }
926 // insert a long into string
927 wxString& operator<<(long l)
928 { return (*this) << Format(_T("%ld"), l); }
929 // insert an unsigned long into string
930 wxString& operator<<(unsigned long ul)
931 { return (*this) << Format(_T("%lu"), ul); }
3c67202d 932 // insert a float into string
3ce65f6c
VZ
933 wxString& operator<<(float f)
934 { return (*this) << Format(_T("%f"), f); }
3c67202d 935 // insert a double into string
3ce65f6c
VZ
936 wxString& operator<<(double d)
937 { return (*this) << Format(_T("%g"), d); }
c84c52de 938
3c67202d 939 // string comparison
30b21f9a 940 // case-sensitive comparison (returns a value < 0, = 0 or > 0)
dcb68102
RN
941 int Cmp(const wxChar *psz) const;
942 int Cmp(const wxString& s) const;
3c67202d 943 // same as Cmp() but not case-sensitive
dcb68102
RN
944 int CmpNoCase(const wxChar *psz) const;
945 int CmpNoCase(const wxString& s) const;
3c67202d
VZ
946 // test for the string equality, either considering case or not
947 // (if compareWithCase then the case matters)
d775fa82 948 bool IsSameAs(const wxChar *psz, bool compareWithCase = true) const
3c67202d 949 { return (compareWithCase ? Cmp(psz) : CmpNoCase(psz)) == 0; }
d775fa82
WS
950 // comparison with a signle character: returns true if equal
951 bool IsSameAs(wxChar c, bool compareWithCase = true) const
f33fee2a 952 {
e87b7833 953 return (length() == 1) && (compareWithCase ? GetChar(0u) == c
f33fee2a
VZ
954 : wxToupper(GetChar(0u)) == wxToupper(c));
955 }
3c67202d
VZ
956
957 // simple sub-string extraction
958 // return substring starting at nFirst of length nCount (or till the end
959 // if nCount = default value)
e87b7833 960 wxString Mid(size_t nFirst, size_t nCount = npos) const;
3c67202d 961
f6bcfd97 962 // operator version of Mid()
3c67202d
VZ
963 wxString operator()(size_t start, size_t len) const
964 { return Mid(start, len); }
965
c0881dc3 966 // check that the string starts with prefix and return the rest of the
f6bcfd97 967 // string in the provided pointer if it is not NULL, otherwise return
d775fa82 968 // false
f6bcfd97
BP
969 bool StartsWith(const wxChar *prefix, wxString *rest = NULL) const;
970
3c67202d 971 // get first nCount characters
c801d85f 972 wxString Left(size_t nCount) const;
3c67202d 973 // get last nCount characters
c801d85f 974 wxString Right(size_t nCount) const;
c0881dc3 975 // get all characters before the first occurance of ch
3c67202d 976 // (returns the whole string if ch not found)
2bb67b80 977 wxString BeforeFirst(wxChar ch) const;
3c67202d
VZ
978 // get all characters before the last occurence of ch
979 // (returns empty string if ch not found)
2bb67b80 980 wxString BeforeLast(wxChar ch) const;
3c67202d
VZ
981 // get all characters after the first occurence of ch
982 // (returns empty string if ch not found)
2bb67b80 983 wxString AfterFirst(wxChar ch) const;
3c67202d
VZ
984 // get all characters after the last occurence of ch
985 // (returns the whole string if ch not found)
2bb67b80 986 wxString AfterLast(wxChar ch) const;
3c67202d
VZ
987
988 // for compatibility only, use more explicitly named functions above
2bb67b80
OK
989 wxString Before(wxChar ch) const { return BeforeLast(ch); }
990 wxString After(wxChar ch) const { return AfterFirst(ch); }
3c67202d
VZ
991
992 // case conversion
c84c52de 993 // convert to upper case in place, return the string itself
c801d85f 994 wxString& MakeUpper();
c84c52de 995 // convert to upper case, return the copy of the string
03ab016d
JS
996 // Here's something to remember: BC++ doesn't like returns in inlines.
997 wxString Upper() const ;
c84c52de 998 // convert to lower case in place, return the string itself
c801d85f 999 wxString& MakeLower();
c84c52de 1000 // convert to lower case, return the copy of the string
03ab016d 1001 wxString Lower() const ;
c801d85f 1002
3c67202d
VZ
1003 // trimming/padding whitespace (either side) and truncating
1004 // remove spaces from left or from right (default) side
d775fa82 1005 wxString& Trim(bool bFromRight = true);
3c67202d 1006 // add nCount copies chPad in the beginning or at the end (default)
d775fa82 1007 wxString& Pad(size_t nCount, wxChar chPad = wxT(' '), bool bFromRight = true);
dd1eaa89 1008
3c67202d
VZ
1009 // searching and replacing
1010 // searching (return starting index, or -1 if not found)
d775fa82 1011 int Find(wxChar ch, bool bFromEnd = false) const; // like strchr/strrchr
3c67202d 1012 // searching (return starting index, or -1 if not found)
2bb67b80 1013 int Find(const wxChar *pszSub) const; // like strstr
3c67202d
VZ
1014 // replace first (or all of bReplaceAll) occurences of substring with
1015 // another string, returns the number of replacements made
2bb67b80
OK
1016 size_t Replace(const wxChar *szOld,
1017 const wxChar *szNew,
d775fa82 1018 bool bReplaceAll = true);
3c67202d
VZ
1019
1020 // check if the string contents matches a mask containing '*' and '?'
2bb67b80 1021 bool Matches(const wxChar *szMask) const;
c801d85f 1022
d775fa82 1023 // conversion to numbers: all functions return true only if the whole
538f35cc
VZ
1024 // string is a number and put the value of this number into the pointer
1025 // provided, the base is the numeric base in which the conversion should be
1026 // done and must be comprised between 2 and 36 or be 0 in which case the
1027 // standard C rules apply (leading '0' => octal, "0x" => hex)
cd0b1709 1028 // convert to a signed integer
538f35cc 1029 bool ToLong(long *val, int base = 10) const;
cd0b1709 1030 // convert to an unsigned integer
538f35cc 1031 bool ToULong(unsigned long *val, int base = 10) const;
cd0b1709
VZ
1032 // convert to a double
1033 bool ToDouble(double *val) const;
1034
3c67202d
VZ
1035 // formated input/output
1036 // as sprintf(), returns the number of characters written or < 0 on error
7357f981
GD
1037 // (take 'this' into account in attribute parameter count)
1038 int Printf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2;
3c67202d 1039 // as vprintf(), returns the number of characters written or < 0 on error
2bb67b80 1040 int PrintfV(const wxChar* pszFormat, va_list argptr);
dd1eaa89 1041
341e7d28 1042 // returns the string containing the result of Printf() to it
7357f981 1043 static wxString Format(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_1;
341e7d28
VZ
1044 // the same as above, but takes a va_list
1045 static wxString FormatV(const wxChar *pszFormat, va_list argptr);
1046
3c67202d
VZ
1047 // raw access to string memory
1048 // ensure that string has space for at least nLen characters
dd1eaa89 1049 // only works if the data of this string is not shared
e87b7833 1050 bool Alloc(size_t nLen) { reserve(nLen); /*return capacity() >= nLen;*/ return true; }
3c67202d 1051 // minimize the string's memory
dd1eaa89 1052 // only works if the data of this string is not shared
b1801e0e 1053 bool Shrink();
e87b7833 1054#if !wxUSE_STL
3c67202d
VZ
1055 // get writable buffer of at least nLen bytes. Unget() *must* be called
1056 // a.s.a.p. to put string back in a reasonable state!
2bb67b80 1057 wxChar *GetWriteBuf(size_t nLen);
3c67202d 1058 // call this immediately after GetWriteBuf() has been used
8fd0f20b 1059 void UngetWriteBuf();
8f06a017 1060 void UngetWriteBuf(size_t nLen);
e87b7833 1061#endif
c801d85f 1062
77ffb593 1063 // wxWidgets version 1 compatibility functions
3c67202d
VZ
1064
1065 // use Mid()
1066 wxString SubString(size_t from, size_t to) const
1067 { return Mid(from, (to - from + 1)); }
1068 // values for second parameter of CompareTo function
c801d85f 1069 enum caseCompare {exact, ignoreCase};
3c67202d 1070 // values for first parameter of Strip function
c801d85f 1071 enum stripType {leading = 0x1, trailing = 0x2, both = 0x3};
8870c26e 1072
7357f981
GD
1073 // use Printf()
1074 // (take 'this' into account in attribute parameter count)
1075 int sprintf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2;
c801d85f 1076
3c67202d 1077 // use Cmp()
2bb67b80 1078 inline int CompareTo(const wxChar* psz, caseCompare cmp = exact) const
6b95b20d 1079 { return cmp == exact ? Cmp(psz) : CmpNoCase(psz); }
c801d85f 1080
3c67202d 1081 // use Len
e87b7833 1082 size_t Length() const { return length(); }
3c67202d 1083 // Count the number of characters
2bb67b80 1084 int Freq(wxChar ch) const;
3c67202d 1085 // use MakeLower
c801d85f 1086 void LowerCase() { MakeLower(); }
3c67202d 1087 // use MakeUpper
c801d85f 1088 void UpperCase() { MakeUpper(); }
3c67202d 1089 // use Trim except that it doesn't change this string
c801d85f
KB
1090 wxString Strip(stripType w = trailing) const;
1091
3c67202d 1092 // use Find (more general variants not yet supported)
2bb67b80
OK
1093 size_t Index(const wxChar* psz) const { return Find(psz); }
1094 size_t Index(wxChar ch) const { return Find(ch); }
3c67202d 1095 // use Truncate
c801d85f 1096 wxString& Remove(size_t pos) { return Truncate(pos); }
e87b7833 1097 wxString& RemoveLast(size_t n = 1) { return Truncate(length() - n); }
c801d85f 1098
e87b7833
MB
1099 wxString& Remove(size_t nStart, size_t nLen)
1100 { return (wxString&)erase( nStart, nLen ); }
dd1eaa89 1101
3c67202d 1102 // use Find()
2bb67b80
OK
1103 int First( const wxChar ch ) const { return Find(ch); }
1104 int First( const wxChar* psz ) const { return Find(psz); }
3ed358cb 1105 int First( const wxString &str ) const { return Find(str); }
d775fa82
WS
1106 int Last( const wxChar ch ) const { return Find(ch, true); }
1107 bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; }
c801d85f 1108
3c67202d 1109 // use IsEmpty()
c801d85f 1110 bool IsNull() const { return IsEmpty(); }
c801d85f 1111
3c67202d 1112 // std::string compatibility functions
dd1eaa89 1113
3c67202d
VZ
1114 // take nLen chars starting at nPos
1115 wxString(const wxString& str, size_t nPos, size_t nLen)
e87b7833 1116 : wxStringBase(str, nPos, nLen) { }
3c67202d 1117 // take all characters from pStart to pEnd
e87b7833 1118 wxString(const void *pStart, const void *pEnd)
6e94fff9 1119 : wxStringBase((const wxChar*)pStart, (const wxChar*)pEnd) { }
e87b7833
MB
1120#if wxUSE_STL
1121 wxString(const_iterator first, const_iterator last)
1122 : wxStringBase(first, last) { }
1123#endif
5460b9e3 1124
3c67202d 1125 // lib.string.modifiers
3c67202d
VZ
1126 // append elements str[pos], ..., str[pos+n]
1127 wxString& append(const wxString& str, size_t pos, size_t n)
e87b7833
MB
1128 { return (wxString&)wxStringBase::append(str, pos, n); }
1129 // append a string
1130 wxString& append(const wxString& str)
1131 { return (wxString&)wxStringBase::append(str); }
3c67202d 1132 // append first n (or all if n == npos) characters of sz
e87b7833
MB
1133 wxString& append(const wxChar *sz)
1134 { return (wxString&)wxStringBase::append(sz); }
1135 wxString& append(const wxChar *sz, size_t n)
1136 { return (wxString&)wxStringBase::append(sz, n); }
3c67202d 1137 // append n copies of ch
e87b7833
MB
1138 wxString& append(size_t n, wxChar ch)
1139 { return (wxString&)wxStringBase::append(n, ch); }
1140 // append from first to last
1141 wxString& append(const_iterator first, const_iterator last)
1142 { return (wxString&)wxStringBase::append(first, last); }
3c67202d
VZ
1143
1144 // same as `this_string = str'
735d1db6 1145 wxString& assign(const wxString& str)
e87b7833 1146 { return (wxString&)wxStringBase::assign(str); }
3c67202d
VZ
1147 // same as ` = str[pos..pos + n]
1148 wxString& assign(const wxString& str, size_t pos, size_t n)
e87b7833 1149 { return (wxString&)wxStringBase::assign(str, pos, n); }
3c67202d 1150 // same as `= first n (or all if n == npos) characters of sz'
e87b7833
MB
1151 wxString& assign(const wxChar *sz)
1152 { return (wxString&)wxStringBase::assign(sz); }
1153 wxString& assign(const wxChar *sz, size_t n)
1154 { return (wxString&)wxStringBase::assign(sz, n); }
3c67202d 1155 // same as `= n copies of ch'
2bb67b80 1156 wxString& assign(size_t n, wxChar ch)
e87b7833
MB
1157 { return (wxString&)wxStringBase::assign(n, ch); }
1158 // assign from first to last
1159 wxString& assign(const_iterator first, const_iterator last)
1160 { return (wxString&)wxStringBase::assign(first, last); }
1161
1162 // string comparison
1163#ifndef HAVE_STD_STRING_COMPARE
1164 int compare(const wxStringBase& str) const;
1165 // comparison with a substring
1166 int compare(size_t nStart, size_t nLen, const wxStringBase& str) const;
1167 // comparison of 2 substrings
1168 int compare(size_t nStart, size_t nLen,
1169 const wxStringBase& str, size_t nStart2, size_t nLen2) const;
1170 // just like strcmp()
1171 int compare(const wxChar* sz) const;
1172 // substring comparison with first nCount characters of sz
1173 int compare(size_t nStart, size_t nLen,
1174 const wxChar* sz, size_t nCount = npos) const;
1175#endif // !defined HAVE_STD_STRING_COMPARE
3c67202d
VZ
1176
1177 // insert another string
e87b7833
MB
1178 wxString& insert(size_t nPos, const wxString& str)
1179 { return (wxString&)wxStringBase::insert(nPos, str); }
3c67202d
VZ
1180 // insert n chars of str starting at nStart (in str)
1181 wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n)
e87b7833 1182 { return (wxString&)wxStringBase::insert(nPos, str, nStart, n); }
3c67202d 1183 // insert first n (or all if n == npos) characters of sz
e87b7833
MB
1184 wxString& insert(size_t nPos, const wxChar *sz)
1185 { return (wxString&)wxStringBase::insert(nPos, sz); }
1186 wxString& insert(size_t nPos, const wxChar *sz, size_t n)
1187 { return (wxString&)wxStringBase::insert(nPos, sz, n); }
3c67202d 1188 // insert n copies of ch
2bb67b80 1189 wxString& insert(size_t nPos, size_t n, wxChar ch)
e87b7833
MB
1190 { return (wxString&)wxStringBase::insert(nPos, n, ch); }
1191 iterator insert(iterator it, wxChar ch)
1c2d1459 1192 { return wxStringBase::insert(it, ch); }
e87b7833
MB
1193 void insert(iterator it, const_iterator first, const_iterator last)
1194 { wxStringBase::insert(it, first, last); }
1195 void insert(iterator it, size_type n, wxChar ch)
1196 { wxStringBase::insert(it, n, ch); }
3c67202d
VZ
1197
1198 // delete characters from nStart to nStart + nLen
e87b7833
MB
1199 wxString& erase(size_type pos = 0, size_type n = npos)
1200 { return (wxString&)wxStringBase::erase(pos, n); }
1201 iterator erase(iterator first, iterator last)
1202 { return wxStringBase::erase(first, last); }
1203 iterator erase(iterator first)
1204 { return wxStringBase::erase(first); }
1205
1206#ifdef wxSTRING_BASE_HASNT_CLEAR
1207 void clear() { erase(); }
1208#endif
3c67202d
VZ
1209
1210 // replaces the substring of length nLen starting at nStart
e87b7833
MB
1211 wxString& replace(size_t nStart, size_t nLen, const wxChar* sz)
1212 { return (wxString&)wxStringBase::replace(nStart, nLen, sz); }
1213 // replaces the substring of length nLen starting at nStart
1214 wxString& replace(size_t nStart, size_t nLen, const wxString& str)
1215 { return (wxString&)wxStringBase::replace(nStart, nLen, str); }
3c67202d 1216 // replaces the substring with nCount copies of ch
e87b7833
MB
1217 wxString& replace(size_t nStart, size_t nLen, size_t nCount, wxChar ch)
1218 { return (wxString&)wxStringBase::replace(nStart, nLen, nCount, ch); }
3c67202d
VZ
1219 // replaces a substring with another substring
1220 wxString& replace(size_t nStart, size_t nLen,
e87b7833
MB
1221 const wxString& str, size_t nStart2, size_t nLen2)
1222 { return (wxString&)wxStringBase::replace(nStart, nLen, str,
1223 nStart2, nLen2); }
1224 // replaces the substring with first nCount chars of sz
fb20fa43 1225 wxString& replace(size_t nStart, size_t nLen,
e87b7833
MB
1226 const wxChar* sz, size_t nCount)
1227 { return (wxString&)wxStringBase::replace(nStart, nLen, sz, nCount); }
1228 wxString& replace(iterator first, iterator last, const_pointer s)
1229 { return (wxString&)wxStringBase::replace(first, last, s); }
1230 wxString& replace(iterator first, iterator last, const_pointer s,
1231 size_type n)
1232 { return (wxString&)wxStringBase::replace(first, last, s, n); }
1233 wxString& replace(iterator first, iterator last, const wxString& s)
1234 { return (wxString&)wxStringBase::replace(first, last, s); }
1235 wxString& replace(iterator first, iterator last, size_type n, wxChar c)
1236 { return (wxString&)wxStringBase::replace(first, last, n, c); }
1237 wxString& replace(iterator first, iterator last,
1238 const_iterator first1, const_iterator last1)
1239 { return (wxString&)wxStringBase::replace(first, last, first1, last1); }
3c67202d 1240
e87b7833
MB
1241 // string += string
1242 wxString& operator+=(const wxString& s)
1243 { return (wxString&)wxStringBase::operator+=(s); }
1244 // string += C string
1245 wxString& operator+=(const wxChar *psz)
1246 { return (wxString&)wxStringBase::operator+=(psz); }
1247 // string += char
1248 wxString& operator+=(wxChar ch)
1249 { return (wxString&)wxStringBase::operator+=(ch); }
c801d85f
KB
1250};
1251
df5168c4
MB
1252// define wxArrayString, for compatibility
1253#if WXWIN_COMPATIBILITY_2_4 && !wxUSE_STL
1254 #include "wx/arrstr.h"
ba8c1601 1255#endif
9d155f50 1256
07170120
VZ
1257#if wxUSE_STL
1258 // return an empty wxString (not very useful with wxUSE_STL == 1)
12f99210 1259 inline const wxString wxGetEmptyString() { return wxString(); }
07170120
VZ
1260#else // !wxUSE_STL
1261 // return an empty wxString (more efficient than wxString() here)
1262 inline const wxString& wxGetEmptyString()
1263 {
1264 return *(wxString *)&wxEmptyString;
1265 }
1266#endif // wxUSE_STL/!wxUSE_STL
1267
1d218550
VZ
1268// ----------------------------------------------------------------------------
1269// wxStringBuffer: a tiny class allowing to get a writable pointer into string
1270// ----------------------------------------------------------------------------
1271
941b78cc
MB
1272#if wxUSE_STL
1273
1274class WXDLLIMPEXP_BASE wxStringBuffer
1275{
1276public:
1277 wxStringBuffer(wxString& str, size_t lenWanted = 1024)
e87b7833 1278 : m_str(str), m_buf(lenWanted)
941b78cc
MB
1279 { }
1280
fe5fc682 1281 ~wxStringBuffer() { m_str.assign(m_buf.data(), wxStrlen(m_buf.data())); }
941b78cc
MB
1282
1283 operator wxChar*() { return m_buf.data(); }
1284
1285private:
1286 wxString& m_str;
1287#if wxUSE_UNICODE
1288 wxWCharBuffer m_buf;
1289#else
1290 wxCharBuffer m_buf;
1291#endif
941b78cc
MB
1292
1293 DECLARE_NO_COPY_CLASS(wxStringBuffer)
1294};
1295
1296class WXDLLIMPEXP_BASE wxStringBufferLength
1297{
1298public:
1299 wxStringBufferLength(wxString& str, size_t lenWanted = 1024)
1300 : m_str(str), m_buf(lenWanted), m_len(0), m_lenSet(false)
1301 { }
1302
1303 ~wxStringBufferLength()
1304 {
1305 wxASSERT(m_lenSet);
1306 m_str.assign(m_buf.data(), m_len);
1307 }
1308
1309 operator wxChar*() { return m_buf.data(); }
1310 void SetLength(size_t length) { m_len = length; m_lenSet = true; }
1311
1312private:
1313 wxString& m_str;
1314#if wxUSE_UNICODE
1315 wxWCharBuffer m_buf;
1316#else
1317 wxCharBuffer m_buf;
1318#endif
1319 size_t m_len;
1320 bool m_lenSet;
1321
1322 DECLARE_NO_COPY_CLASS(wxStringBufferLength)
1323};
1324
1325#else // if !wxUSE_STL
1326
bddd7a8d 1327class WXDLLIMPEXP_BASE wxStringBuffer
1d218550
VZ
1328{
1329public:
1330 wxStringBuffer(wxString& str, size_t lenWanted = 1024)
b1801e0e
GD
1331 : m_str(str), m_buf(NULL)
1332 { m_buf = m_str.GetWriteBuf(lenWanted); }
e015c2a3 1333
1d218550 1334 ~wxStringBuffer() { m_str.UngetWriteBuf(); }
e015c2a3 1335
1d218550 1336 operator wxChar*() const { return m_buf; }
e015c2a3 1337
1d218550
VZ
1338private:
1339 wxString& m_str;
1340 wxChar *m_buf;
e015c2a3
VZ
1341
1342 DECLARE_NO_COPY_CLASS(wxStringBuffer)
1d218550
VZ
1343};
1344
941b78cc
MB
1345class WXDLLIMPEXP_BASE wxStringBufferLength
1346{
1347public:
1348 wxStringBufferLength(wxString& str, size_t lenWanted = 1024)
1349 : m_str(str), m_buf(NULL), m_len(0), m_lenSet(false)
4055ed82
WS
1350 {
1351 m_buf = m_str.GetWriteBuf(lenWanted);
494b978f
RN
1352 wxASSERT(m_buf != NULL);
1353 }
941b78cc
MB
1354
1355 ~wxStringBufferLength()
1356 {
1357 wxASSERT(m_lenSet);
1358 m_str.UngetWriteBuf(m_len);
1359 }
1360
1361 operator wxChar*() const { return m_buf; }
1362 void SetLength(size_t length) { m_len = length; m_lenSet = true; }
1363
1364private:
1365 wxString& m_str;
1366 wxChar *m_buf;
1367 size_t m_len;
1368 bool m_lenSet;
1369
1370 DECLARE_NO_COPY_CLASS(wxStringBufferLength)
1371};
1372
1373#endif // !wxUSE_STL
1374
c801d85f 1375// ---------------------------------------------------------------------------
3c67202d 1376// wxString comparison functions: operator versions are always case sensitive
c801d85f 1377// ---------------------------------------------------------------------------
f33fee2a 1378
b6339dde
VZ
1379// note that when wxUSE_STL == 1 the comparison operators taking std::string
1380// are used and defining them also for wxString would only result in
1381// compilation ambiguities when comparing std::string and wxString
1382#if !wxUSE_STL
e87b7833 1383
0cbe5ee3
VZ
1384inline bool operator==(const wxString& s1, const wxString& s2)
1385 { return (s1.Len() == s2.Len()) && (s1.Cmp(s2) == 0); }
1386inline bool operator==(const wxString& s1, const wxChar * s2)
1387 { return s1.Cmp(s2) == 0; }
1388inline bool operator==(const wxChar * s1, const wxString& s2)
1389 { return s2.Cmp(s1) == 0; }
1390inline bool operator!=(const wxString& s1, const wxString& s2)
1391 { return (s1.Len() != s2.Len()) || (s1.Cmp(s2) != 0); }
1392inline bool operator!=(const wxString& s1, const wxChar * s2)
1393 { return s1.Cmp(s2) != 0; }
1394inline bool operator!=(const wxChar * s1, const wxString& s2)
1395 { return s2.Cmp(s1) != 0; }
1396inline bool operator< (const wxString& s1, const wxString& s2)
1397 { return s1.Cmp(s2) < 0; }
1398inline bool operator< (const wxString& s1, const wxChar * s2)
1399 { return s1.Cmp(s2) < 0; }
1400inline bool operator< (const wxChar * s1, const wxString& s2)
1401 { return s2.Cmp(s1) > 0; }
1402inline bool operator> (const wxString& s1, const wxString& s2)
1403 { return s1.Cmp(s2) > 0; }
1404inline bool operator> (const wxString& s1, const wxChar * s2)
1405 { return s1.Cmp(s2) > 0; }
1406inline bool operator> (const wxChar * s1, const wxString& s2)
1407 { return s2.Cmp(s1) < 0; }
1408inline bool operator<=(const wxString& s1, const wxString& s2)
1409 { return s1.Cmp(s2) <= 0; }
1410inline bool operator<=(const wxString& s1, const wxChar * s2)
1411 { return s1.Cmp(s2) <= 0; }
1412inline bool operator<=(const wxChar * s1, const wxString& s2)
1413 { return s2.Cmp(s1) >= 0; }
1414inline bool operator>=(const wxString& s1, const wxString& s2)
1415 { return s1.Cmp(s2) >= 0; }
1416inline bool operator>=(const wxString& s1, const wxChar * s2)
1417 { return s1.Cmp(s2) >= 0; }
1418inline bool operator>=(const wxChar * s1, const wxString& s2)
1419 { return s2.Cmp(s1) <= 0; }
3c67202d 1420
5ca07d0f
OK
1421#if wxUSE_UNICODE
1422inline bool operator==(const wxString& s1, const wxWCharBuffer& s2)
f33fee2a 1423 { return (s1.Cmp((const wchar_t *)s2) == 0); }
5ca07d0f 1424inline bool operator==(const wxWCharBuffer& s1, const wxString& s2)
f33fee2a 1425 { return (s2.Cmp((const wchar_t *)s1) == 0); }
f6bcfd97
BP
1426inline bool operator!=(const wxString& s1, const wxWCharBuffer& s2)
1427 { return (s1.Cmp((const wchar_t *)s2) != 0); }
1428inline bool operator!=(const wxWCharBuffer& s1, const wxString& s2)
1429 { return (s2.Cmp((const wchar_t *)s1) != 0); }
0cbe5ee3 1430#else // !wxUSE_UNICODE
5ca07d0f 1431inline bool operator==(const wxString& s1, const wxCharBuffer& s2)
f33fee2a 1432 { return (s1.Cmp((const char *)s2) == 0); }
5ca07d0f 1433inline bool operator==(const wxCharBuffer& s1, const wxString& s2)
f33fee2a 1434 { return (s2.Cmp((const char *)s1) == 0); }
f6bcfd97
BP
1435inline bool operator!=(const wxString& s1, const wxCharBuffer& s2)
1436 { return (s1.Cmp((const char *)s2) != 0); }
1437inline bool operator!=(const wxCharBuffer& s1, const wxString& s2)
1438 { return (s2.Cmp((const char *)s1) != 0); }
0cbe5ee3 1439#endif // wxUSE_UNICODE/!wxUSE_UNICODE
5ca07d0f 1440
bddd7a8d
VZ
1441wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2);
1442wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch);
1443wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string);
1444wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wxChar *psz);
1445wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, const wxString& string);
e87b7833 1446
028a2b5d 1447#if wxUSE_UNICODE
6d56eb5c 1448inline wxString operator+(const wxString& string, const wxWCharBuffer& buf)
e90c1d2a 1449 { return string + (const wchar_t *)buf; }
6d56eb5c 1450inline wxString operator+(const wxWCharBuffer& buf, const wxString& string)
e90c1d2a 1451 { return (const wchar_t *)buf + string; }
0cbe5ee3 1452#else // !wxUSE_UNICODE
6d56eb5c 1453inline wxString operator+(const wxString& string, const wxCharBuffer& buf)
e90c1d2a 1454 { return string + (const char *)buf; }
6d56eb5c 1455inline wxString operator+(const wxCharBuffer& buf, const wxString& string)
e90c1d2a 1456 { return (const char *)buf + string; }
0cbe5ee3 1457#endif // wxUSE_UNICODE/!wxUSE_UNICODE
f04f3991 1458
e51b17a1
VZ
1459#endif // !wxUSE_STL
1460
1461// comparison with char (those are not defined by std::[w]string and so should
1462// be always available)
1463inline bool operator==(wxChar c, const wxString& s) { return s.IsSameAs(c); }
1464inline bool operator==(const wxString& s, wxChar c) { return s.IsSameAs(c); }
1465inline bool operator!=(wxChar c, const wxString& s) { return !s.IsSameAs(c); }
1466inline bool operator!=(const wxString& s, wxChar c) { return !s.IsSameAs(c); }
1467
c801d85f 1468// ---------------------------------------------------------------------------
3c67202d 1469// Implementation only from here until the end of file
c801d85f
KB
1470// ---------------------------------------------------------------------------
1471
e90c1d2a 1472// don't pollute the library user's name space
5737d05f 1473#undef wxASSERT_VALID_INDEX
e90c1d2a 1474
e87b7833 1475#if wxUSE_STD_IOSTREAM
c801d85f 1476
65f19af1 1477#include "wx/iosfwrap.h"
c801d85f 1478
bddd7a8d
VZ
1479WXDLLIMPEXP_BASE wxSTD istream& operator>>(wxSTD istream&, wxString&);
1480WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&);
c801d85f 1481
3c67202d 1482#endif // wxSTD_STRING_COMPATIBILITY
c801d85f 1483
34138703 1484#endif // _WX_WXSTRINGH__