]> git.saurik.com Git - wxWidgets.git/blame - include/wx/stringimpl.h
Fix compilation in !wxUSE_LOG_DEBUG && !HAVE_VARIADIC_MACROS case.
[wxWidgets.git] / include / wx / stringimpl.h
CommitLineData
a7ea63e2
VS
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/stringimpl.h
3// Purpose: wxStringImpl class, implementation of wxString
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>
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12/*
13 This header implements std::string-like string class, wxStringImpl, that is
01871bf6 14 used by wxString to store the data. Alternatively, if wxUSE_STD_STRING=1,
a7ea63e2
VS
15 wxStringImpl is just a typedef to std:: string class.
16*/
17
18#ifndef _WX_WXSTRINGIMPL_H__
19#define _WX_WXSTRINGIMPL_H__
20
21// ----------------------------------------------------------------------------
22// headers
23// ----------------------------------------------------------------------------
24
25#include "wx/defs.h" // everybody should include this
2523e9b7 26#include "wx/chartype.h" // for wxChar
52de37c7 27#include "wx/wxcrtbase.h" // for wxStrlen() etc.
a7ea63e2 28
745817ff
VS
29#include <stdlib.h>
30
a7ea63e2
VS
31// ---------------------------------------------------------------------------
32// macros
33// ---------------------------------------------------------------------------
34
35// implementation only
36#define wxASSERT_VALID_INDEX(i) \
9a83f860 37 wxASSERT_MSG( (size_t)(i) <= length(), wxT("invalid index in wxString") )
a7ea63e2
VS
38
39
40// ----------------------------------------------------------------------------
41// global data
42// ----------------------------------------------------------------------------
43
44// global pointer to empty string
45extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString;
81727065
VS
46#if wxUSE_UNICODE_UTF8
47// FIXME-UTF8: we should have only one wxEmptyString
48extern WXDLLIMPEXP_DATA_BASE(const wxStringCharType*) wxEmptyStringImpl;
49#endif
a7ea63e2
VS
50
51
52// ----------------------------------------------------------------------------
01871bf6 53// deal with various build options
a7ea63e2
VS
54// ----------------------------------------------------------------------------
55
4f29051b
VZ
56// we use STL-based string internally if we use std::string at all now, there
57// should be no reason to prefer our internal implement but if you really need
58// it you can predefine wxUSE_STL_BASED_WXSTRING as 0 when building the library
59#ifndef wxUSE_STL_BASED_WXSTRING
60 #define wxUSE_STL_BASED_WXSTRING wxUSE_STD_STRING
61#endif
a7ea63e2
VS
62
63// in both cases we need to define wxStdString
64#if wxUSE_STL_BASED_WXSTRING || wxUSE_STD_STRING
65
66#include "wx/beforestd.h"
67#include <string>
68#include "wx/afterstd.h"
69
59953bf4
VS
70#ifdef HAVE_STD_WSTRING
71 typedef std::wstring wxStdWideString;
72#else
73 typedef std::basic_string<wchar_t> wxStdWideString;
74#endif
75
a7ea63e2 76#if wxUSE_UNICODE_WCHAR
59953bf4 77 typedef wxStdWideString wxStdString;
a7ea63e2
VS
78#else
79 typedef std::string wxStdString;
80#endif
81
59953bf4
VS
82#endif // wxUSE_STL_BASED_WXSTRING || wxUSE_STD_STRING
83
a7ea63e2
VS
84
85#if wxUSE_STL_BASED_WXSTRING
86
87 // we always want ctor from std::string when using std::string internally
88 #undef wxUSE_STD_STRING
89 #define wxUSE_STD_STRING 1
90
b8088349
VZ
91 // the versions of std::string included with gcc 2.95 and VC6 (for which
92 // _MSC_VER == 1200) and eVC4 (_MSC_VER == 1201) lack clear() method
a7ea63e2 93 #if (defined(__GNUG__) && (__GNUG__ < 3)) || \
88eb6b7c 94 !wxCHECK_VISUALC_VERSION(7) || defined(__EVC4__)
a7ea63e2
VS
95 #define wxSTRING_BASE_HASNT_CLEAR
96 #endif
97
98 typedef wxStdString wxStringImpl;
99#else // if !wxUSE_STL_BASED_WXSTRING
100
101// in non-STL mode, compare() is implemented in wxString and not wxStringImpl
102#undef HAVE_STD_STRING_COMPARE
103
104// ---------------------------------------------------------------------------
105// string data prepended with some housekeeping info (used by wxString class),
106// is never used directly (but had to be put here to allow inlining)
107// ---------------------------------------------------------------------------
108
109struct WXDLLIMPEXP_BASE wxStringData
110{
111 int nRefs; // reference count
112 size_t nDataLength, // actual string length
113 nAllocLength; // allocated memory size
114
81727065
VS
115 // mimics declaration 'wxStringCharType data[nAllocLength]'
116 wxStringCharType* data() const { return (wxStringCharType*)(this + 1); }
a7ea63e2
VS
117
118 // empty string has a special ref count so it's never deleted
119 bool IsEmpty() const { return (nRefs == -1); }
120 bool IsShared() const { return (nRefs > 1); }
121
122 // lock/unlock
123 void Lock() { if ( !IsEmpty() ) nRefs++; }
124
125 // VC++ will refuse to inline Unlock but profiling shows that it is wrong
126#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
127 __forceinline
128#endif
129 // VC++ free must take place in same DLL as allocation when using non dll
130 // run-time library (e.g. Multithreaded instead of Multithreaded DLL)
131#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL)
132 void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); }
133 // we must not inline deallocation since allocation is not inlined
134 void Free();
135#else
136 void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); }
137#endif
138
139 // if we had taken control over string memory (GetWriteBuf), it's
140 // intentionally put in invalid state
141 void Validate(bool b) { nRefs = (b ? 1 : 0); }
142 bool IsValid() const { return (nRefs != 0); }
143};
144
145class WXDLLIMPEXP_BASE wxStringImpl
146{
147public:
148 // an 'invalid' value for string index, moved to this place due to a CW bug
149 static const size_t npos;
150
151protected:
152 // points to data preceded by wxStringData structure with ref count info
153 wxStringCharType *m_pchData;
154
155 // accessor to string data
156 wxStringData* GetStringData() const { return (wxStringData*)m_pchData - 1; }
157
158 // string (re)initialization functions
159 // initializes the string to the empty value (must be called only from
160 // ctors, use Reinit() otherwise)
81727065
VS
161#if wxUSE_UNICODE_UTF8
162 void Init() { m_pchData = (wxStringCharType *)wxEmptyStringImpl; } // FIXME-UTF8
163#else
a7ea63e2 164 void Init() { m_pchData = (wxStringCharType *)wxEmptyString; }
81727065 165#endif
a7ea63e2
VS
166 // initializes the string with (a part of) C-string
167 void InitWith(const wxStringCharType *psz, size_t nPos = 0, size_t nLen = npos);
168 // as Init, but also frees old data
169 void Reinit() { GetStringData()->Unlock(); Init(); }
170
171 // memory allocation
172 // allocates memory for string of length nLen
173 bool AllocBuffer(size_t nLen);
174 // effectively copies data to string
175 bool AssignCopy(size_t, const wxStringCharType *);
176
177 // append a (sub)string
178 bool ConcatSelf(size_t nLen, const wxStringCharType *src, size_t nMaxLen);
179 bool ConcatSelf(size_t nLen, const wxStringCharType *src)
180 { return ConcatSelf(nLen, src, nLen); }
181
182 // functions called before writing to the string: they copy it if there
183 // are other references to our data (should be the only owner when writing)
184 bool CopyBeforeWrite();
185 bool AllocBeforeWrite(size_t);
186
187 // compatibility with wxString
188 bool Alloc(size_t nLen);
189
190public:
191 // standard types
192 typedef wxStringCharType value_type;
193 typedef wxStringCharType char_type;
194 typedef size_t size_type;
195 typedef value_type& reference;
196 typedef const value_type& const_reference;
197 typedef value_type* pointer;
198 typedef const value_type* const_pointer;
f2a1b1bd
VZ
199
200 // macro to define the bulk of iterator and const_iterator classes
201 #define WX_DEFINE_STRINGIMPL_ITERATOR(iterator_name, ref_type, ptr_type) \
202 public: \
203 typedef wxStringCharType value_type; \
204 typedef ref_type reference; \
205 typedef ptr_type pointer; \
89360a8c 206 typedef int difference_type; \
f2a1b1bd 207 \
39c20230 208 iterator_name() : m_ptr(NULL) { } \
f2a1b1bd
VZ
209 iterator_name(pointer ptr) : m_ptr(ptr) { } \
210 \
211 reference operator*() const { return *m_ptr; } \
212 \
213 iterator_name& operator++() { m_ptr++; return *this; } \
214 iterator_name operator++(int) \
215 { \
216 const iterator_name tmp(*this); \
217 m_ptr++; \
218 return tmp; \
219 } \
220 \
221 iterator_name& operator--() { m_ptr--; return *this; } \
222 iterator_name operator--(int) \
223 { \
224 const iterator_name tmp(*this); \
225 m_ptr--; \
226 return tmp; \
227 } \
228 \
b5343e06 229 iterator_name operator+(ptrdiff_t n) const \
f2a1b1bd 230 { return iterator_name(m_ptr + n); } \
b5343e06 231 iterator_name operator-(ptrdiff_t n) const \
15c12109 232 { return iterator_name(m_ptr - n); } \
b5343e06 233 iterator_name& operator+=(ptrdiff_t n) \
f2a1b1bd 234 { m_ptr += n; return *this; } \
b5343e06 235 iterator_name& operator-=(ptrdiff_t n) \
f2a1b1bd
VZ
236 { m_ptr -= n; return *this; } \
237 \
89360a8c 238 difference_type operator-(const iterator_name& i) const \
f2a1b1bd
VZ
239 { return m_ptr - i.m_ptr; } \
240 \
241 bool operator==(const iterator_name& i) const \
242 { return m_ptr == i.m_ptr; } \
243 bool operator!=(const iterator_name& i) const \
244 { return m_ptr != i.m_ptr; } \
245 \
246 bool operator<(const iterator_name& i) const \
247 { return m_ptr < i.m_ptr; } \
248 bool operator>(const iterator_name& i) const \
249 { return m_ptr > i.m_ptr; } \
250 bool operator<=(const iterator_name& i) const \
251 { return m_ptr <= i.m_ptr; } \
252 bool operator>=(const iterator_name& i) const \
253 { return m_ptr >= i.m_ptr; } \
254 \
255 private: \
256 /* for wxStringImpl use only */ \
fb252067 257 pointer GetPtr() const { return m_ptr; } \
f2a1b1bd 258 \
b5dbe15d 259 friend class wxStringImpl; \
f2a1b1bd
VZ
260 \
261 pointer m_ptr
262
7c2b62db
VZ
263 // we need to declare const_iterator in wxStringImpl scope, the friend
264 // declaration inside iterator class itself is not enough, or at least not
265 // for g++ 3.4 (g++ 4 is ok)
b5dbe15d 266 class WXDLLIMPEXP_FWD_BASE const_iterator;
7c2b62db 267
541aa821 268 class WXDLLIMPEXP_BASE iterator
f2a1b1bd
VZ
269 {
270 WX_DEFINE_STRINGIMPL_ITERATOR(iterator,
271 wxStringCharType&,
272 wxStringCharType*);
273
274 friend class const_iterator;
275 };
276
541aa821 277 class WXDLLIMPEXP_BASE const_iterator
f2a1b1bd
VZ
278 {
279 public:
280 const_iterator(iterator i) : m_ptr(i.m_ptr) { }
281
282 WX_DEFINE_STRINGIMPL_ITERATOR(const_iterator,
283 const wxStringCharType&,
284 const wxStringCharType*);
285 };
286
89360a8c
VS
287 #undef WX_DEFINE_STRINGIMPL_ITERATOR
288
a7ea63e2
VS
289
290 // constructors and destructor
291 // ctor for an empty string
292 wxStringImpl() { Init(); }
293 // copy ctor
294 wxStringImpl(const wxStringImpl& stringSrc)
295 {
296 wxASSERT_MSG( stringSrc.GetStringData()->IsValid(),
9a83f860 297 wxT("did you forget to call UngetWriteBuf()?") );
a7ea63e2
VS
298
299 if ( stringSrc.empty() ) {
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 }
308 // string containing nRepeat copies of ch
309 wxStringImpl(size_type nRepeat, wxStringCharType ch);
310 // ctor takes first nLength characters from C string
311 // (default value of npos means take all the string)
312 wxStringImpl(const wxStringCharType *psz)
313 { InitWith(psz, 0, npos); }
314 wxStringImpl(const wxStringCharType *psz, size_t nLength)
315 { InitWith(psz, 0, nLength); }
316 // take nLen chars starting at nPos
317 wxStringImpl(const wxStringImpl& str, size_t nPos, size_t nLen)
318 {
319 wxASSERT_MSG( str.GetStringData()->IsValid(),
9a83f860 320 wxT("did you forget to call UngetWriteBuf()?") );
a7ea63e2
VS
321 Init();
322 size_t strLen = str.length() - nPos; nLen = strLen < nLen ? strLen : nLen;
323 InitWith(str.c_str(), nPos, nLen);
324 }
f2a1b1bd
VZ
325 // take everything between start and end
326 wxStringImpl(const_iterator start, const_iterator end);
a7ea63e2 327
59953bf4
VS
328
329 // ctor from and conversion to std::string
330#if wxUSE_STD_STRING
331 wxStringImpl(const wxStdString& impl)
332 { InitWith(impl.c_str(), 0, impl.length()); }
333
334 operator wxStdString() const
335 { return wxStdString(c_str(), length()); }
336#endif
337
5dd09653
VZ
338#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
339 // disable warning about Unlock() below not being inlined (first, it
340 // seems to be inlined nevertheless and second, even if it isn't, there
341 // is nothing we can do about this
342 #pragma warning(push)
343 #pragma warning (disable:4714)
344#endif
59953bf4 345
a7ea63e2
VS
346 // dtor is not virtual, this class must not be inherited from!
347 ~wxStringImpl()
348 {
a7ea63e2
VS
349 GetStringData()->Unlock();
350 }
351
352#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
5dd09653 353 #pragma warning(pop)
a7ea63e2 354#endif
5dd09653 355
a7ea63e2
VS
356 // overloaded assignment
357 // from another wxString
358 wxStringImpl& operator=(const wxStringImpl& stringSrc);
359 // from a character
360 wxStringImpl& operator=(wxStringCharType ch);
361 // from a C string
362 wxStringImpl& operator=(const wxStringCharType *psz);
363
364 // return the length of the string
365 size_type length() const { return GetStringData()->nDataLength; }
366 // return the length of the string
367 size_type size() const { return length(); }
368 // return the maximum size of the string
369 size_type max_size() const { return npos; }
370 // resize the string, filling the space with c if c != 0
371 void resize(size_t nSize, wxStringCharType ch = '\0');
372 // delete the contents of the string
373 void clear() { erase(0, npos); }
374 // returns true if the string is empty
375 bool empty() const { return length() == 0; }
376 // inform string about planned change in size
377 void reserve(size_t sz) { Alloc(sz); }
378 size_type capacity() const { return GetStringData()->nAllocLength; }
379
380 // lib.string.access
381 // return the character at position n
87c7fc67 382 value_type operator[](size_type n) const { return m_pchData[n]; }
a7ea63e2
VS
383 value_type at(size_type n) const
384 { wxASSERT_VALID_INDEX( n ); return m_pchData[n]; }
385 // returns the writable character at position n
87c7fc67 386 reference operator[](size_type n) { CopyBeforeWrite(); return m_pchData[n]; }
a7ea63e2
VS
387 reference at(size_type n)
388 {
389 wxASSERT_VALID_INDEX( n );
390 CopyBeforeWrite();
391 return m_pchData[n];
392 } // FIXME-UTF8: not useful for us...?
393
394 // lib.string.modifiers
395 // append elements str[pos], ..., str[pos+n]
396 wxStringImpl& append(const wxStringImpl& str, size_t pos, size_t n)
397 {
398 wxASSERT(pos <= str.length());
399 ConcatSelf(n, str.c_str() + pos, str.length() - pos);
400 return *this;
401 }
402 // append a string
403 wxStringImpl& append(const wxStringImpl& str)
404 { ConcatSelf(str.length(), str.c_str()); return *this; }
405 // append first n (or all if n == npos) characters of sz
406 wxStringImpl& append(const wxStringCharType *sz)
52de37c7 407 { ConcatSelf(wxStrlen(sz), sz); return *this; }
a7ea63e2
VS
408 wxStringImpl& append(const wxStringCharType *sz, size_t n)
409 { ConcatSelf(n, sz); return *this; }
410 // append n copies of ch
411 wxStringImpl& append(size_t n, wxStringCharType ch);
412 // append from first to last
413 wxStringImpl& append(const_iterator first, const_iterator last)
fb252067 414 { ConcatSelf(last - first, first.GetPtr()); return *this; }
a7ea63e2
VS
415
416 // same as `this_string = str'
417 wxStringImpl& assign(const wxStringImpl& str)
418 { return *this = str; }
419 // same as ` = str[pos..pos + n]
420 wxStringImpl& assign(const wxStringImpl& str, size_t pos, size_t n)
d545bded 421 { return replace(0, npos, str, pos, n); }
a7ea63e2
VS
422 // same as `= first n (or all if n == npos) characters of sz'
423 wxStringImpl& assign(const wxStringCharType *sz)
d545bded 424 { return replace(0, npos, sz, wxStrlen(sz)); }
a7ea63e2 425 wxStringImpl& assign(const wxStringCharType *sz, size_t n)
d545bded 426 { return replace(0, npos, sz, n); }
a7ea63e2
VS
427 // same as `= n copies of ch'
428 wxStringImpl& assign(size_t n, wxStringCharType ch)
d545bded 429 { return replace(0, npos, n, ch); }
a7ea63e2
VS
430 // assign from first to last
431 wxStringImpl& assign(const_iterator first, const_iterator last)
d545bded 432 { return replace(begin(), end(), first, last); }
a7ea63e2
VS
433
434 // first valid index position
435 const_iterator begin() const { return m_pchData; }
436 iterator begin();
437 // position one after the last valid one
438 const_iterator end() const { return m_pchData + length(); }
439 iterator end();
440
441 // insert another string
442 wxStringImpl& insert(size_t nPos, const wxStringImpl& str)
443 {
444 wxASSERT( str.GetStringData()->IsValid() );
445 return insert(nPos, str.c_str(), str.length());
446 }
447 // insert n chars of str starting at nStart (in str)
448 wxStringImpl& insert(size_t nPos, const wxStringImpl& str, size_t nStart, size_t n)
449 {
450 wxASSERT( str.GetStringData()->IsValid() );
451 wxASSERT( nStart < str.length() );
452 size_t strLen = str.length() - nStart;
453 n = strLen < n ? strLen : n;
454 return insert(nPos, str.c_str() + nStart, n);
455 }
456 // insert first n (or all if n == npos) characters of sz
457 wxStringImpl& insert(size_t nPos, const wxStringCharType *sz, size_t n = npos);
458 // insert n copies of ch
81727065 459 wxStringImpl& insert(size_t nPos, size_t n, wxStringCharType ch)
a7ea63e2 460 { return insert(nPos, wxStringImpl(n, ch)); }
81727065 461 iterator insert(iterator it, wxStringCharType ch)
a7ea63e2
VS
462 { size_t idx = it - begin(); insert(idx, 1, ch); return begin() + idx; }
463 void insert(iterator it, const_iterator first, const_iterator last)
fb252067 464 { insert(it - begin(), first.GetPtr(), last - first); }
a7ea63e2
VS
465 void insert(iterator it, size_type n, wxStringCharType ch)
466 { insert(it - begin(), n, ch); }
467
468 // delete characters from nStart to nStart + nLen
469 wxStringImpl& erase(size_type pos = 0, size_type n = npos);
470 iterator erase(iterator first, iterator last)
471 {
472 size_t idx = first - begin();
473 erase(idx, last - first);
474 return begin() + idx;
475 }
476 iterator erase(iterator first);
477
478 // explicit conversion to C string (use this with printf()!)
479 const wxStringCharType* c_str() const { return m_pchData; }
480 const wxStringCharType* data() const { return m_pchData; }
481
482 // replaces the substring of length nLen starting at nStart
d545bded
VZ
483 wxStringImpl& replace(size_t nStart, size_t nLen, const wxStringCharType* sz)
484 { return replace(nStart, nLen, sz, npos); }
a7ea63e2
VS
485 // replaces the substring of length nLen starting at nStart
486 wxStringImpl& replace(size_t nStart, size_t nLen, const wxStringImpl& str)
d545bded 487 { return replace(nStart, nLen, str.c_str(), str.length()); }
a7ea63e2 488 // replaces the substring with nCount copies of ch
d545bded
VZ
489 wxStringImpl& replace(size_t nStart, size_t nLen,
490 size_t nCount, wxStringCharType ch)
491 { return replace(nStart, nLen, wxStringImpl(nCount, ch)); }
a7ea63e2
VS
492 // replaces a substring with another substring
493 wxStringImpl& replace(size_t nStart, size_t nLen,
d545bded
VZ
494 const wxStringImpl& str, size_t nStart2, size_t nLen2)
495 { return replace(nStart, nLen, str.substr(nStart2, nLen2)); }
a7ea63e2
VS
496 // replaces the substring with first nCount chars of sz
497 wxStringImpl& replace(size_t nStart, size_t nLen,
498 const wxStringCharType* sz, size_t nCount);
d545bded 499
a7ea63e2
VS
500 wxStringImpl& replace(iterator first, iterator last, const_pointer s)
501 { return replace(first - begin(), last - first, s); }
502 wxStringImpl& replace(iterator first, iterator last, const_pointer s,
503 size_type n)
504 { return replace(first - begin(), last - first, s, n); }
505 wxStringImpl& replace(iterator first, iterator last, const wxStringImpl& s)
506 { return replace(first - begin(), last - first, s); }
507 wxStringImpl& replace(iterator first, iterator last, size_type n, wxStringCharType c)
508 { return replace(first - begin(), last - first, n, c); }
509 wxStringImpl& replace(iterator first, iterator last,
510 const_iterator first1, const_iterator last1)
fb252067 511 { return replace(first - begin(), last - first, first1.GetPtr(), last1 - first1); }
a7ea63e2
VS
512
513 // swap two strings
514 void swap(wxStringImpl& str);
515
516 // All find() functions take the nStart argument which specifies the
517 // position to start the search on, the default value is 0. All functions
518 // return npos if there were no match.
519
520 // find a substring
521 size_t find(const wxStringImpl& str, size_t nStart = 0) const;
522
523 // find first n characters of sz
524 size_t find(const wxStringCharType* sz, size_t nStart = 0, size_t n = npos) const;
525
f2a1b1bd 526 // find the first occurrence of character ch after nStart
a7ea63e2
VS
527 size_t find(wxStringCharType ch, size_t nStart = 0) const;
528
529 // rfind() family is exactly like find() but works right to left
530
531 // as find, but from the end
532 size_t rfind(const wxStringImpl& str, size_t nStart = npos) const;
533
534 // as find, but from the end
535 size_t rfind(const wxStringCharType* sz, size_t nStart = npos,
536 size_t n = npos) const;
537 // as find, but from the end
538 size_t rfind(wxStringCharType ch, size_t nStart = npos) const;
539
540 size_type copy(wxStringCharType* s, size_type n, size_type pos = 0);
541
542 // substring extraction
543 wxStringImpl substr(size_t nStart = 0, size_t nLen = npos) const;
544
545 // string += string
546 wxStringImpl& operator+=(const wxStringImpl& s) { return append(s); }
547 // string += C string
548 wxStringImpl& operator+=(const wxStringCharType *psz) { return append(psz); }
549 // string += char
550 wxStringImpl& operator+=(wxStringCharType ch) { return append(1, ch); }
551
a7ea63e2
VS
552 // helpers for wxStringBuffer and wxStringBufferLength
553 wxStringCharType *DoGetWriteBuf(size_t nLen);
554 void DoUngetWriteBuf();
555 void DoUngetWriteBuf(size_t nLen);
a7ea63e2 556
b5dbe15d 557 friend class WXDLLIMPEXP_FWD_BASE wxString;
a7ea63e2
VS
558};
559
560#endif // !wxUSE_STL_BASED_WXSTRING
561
562// don't pollute the library user's name space
563#undef wxASSERT_VALID_INDEX
564
565#endif // _WX_WXSTRINGIMPL_H__