]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/string.h
[ 1945434 ] Changing method wxComboCtrlBase::DrawButton to virtual one
[wxWidgets.git] / include / wx / string.h
index deecb1795bf7193f172beb2f33bd1c772fd657c6..c5283522d57be2d9b25e3fee888ec3bd9e7f9618 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "wx/defs.h"        // everybody should include this
 
+#ifndef __WXPALMOS5__
 #if defined(__WXMAC__) || defined(__VISAGECPP__)
     #include <ctype.h>
 #endif
 #ifdef HAVE_STRCASECMP_IN_STRINGS_H
     #include <strings.h>    // for strcasecmp()
 #endif // HAVE_STRCASECMP_IN_STRINGS_H
-
-#ifdef __WXPALMOS__
-    #include <StringMgr.h>
-#endif
+#endif // ! __WXPALMOS5__
 
 #include "wx/wxcrtbase.h"   // for wxChar, wxStrlen() etc.
 #include "wx/strvararg.h"
@@ -433,7 +431,10 @@ private:
       size_t len;
 
       SubstrBufFromType(const T& data_, size_t len_)
-          : data(data_), len(len_) {}
+          : data(data_), len(len_)
+      {
+          wxASSERT_MSG( len != npos, "must have real length" );
+      }
   };
 
 #if wxUSE_UNICODE_UTF8
@@ -1441,6 +1442,16 @@ public:
     { append(psz); return *this; }
   wxString& Append(const wxWCharBuffer& psz)
     { append(psz); return *this; }
+  wxString& Append(const char* psz, size_t nLen)
+    { append(psz, nLen); return *this; }
+  wxString& Append(const wchar_t* pwz, size_t nLen)
+    { append(pwz, nLen); return *this; }
+  wxString& Append(const wxCStrData& psz, size_t nLen)
+    { append(psz, nLen); return *this; }
+  wxString& Append(const wxCharBuffer& psz, size_t nLen)
+    { append(psz, nLen); return *this; }
+  wxString& Append(const wxWCharBuffer& psz, size_t nLen)
+    { append(psz, nLen); return *this; }
     // append count copies of given character
   wxString& Append(wxUniChar ch, size_t count = 1u)
     { append(count, ch); return *this; }
@@ -1452,10 +1463,6 @@ public:
     { append(count, ch); return *this; }
   wxString& Append(wchar_t ch, size_t count = 1u)
     { append(count, ch); return *this; }
-  wxString& Append(const char* psz, size_t nLen)
-    { append(psz, nLen); return *this; }
-  wxString& Append(const wchar_t* pwz, size_t nLen)
-    { append(pwz, nLen); return *this; }
 
     // prepend a string, return the string itself
   wxString& Prepend(const wxString& str)
@@ -1731,7 +1738,7 @@ public:
   // raw access to string memory
     // ensure that string has space for at least nLen characters
     // only works if the data of this string is not shared
-  bool Alloc(size_t nLen) { reserve(nLen); /*return capacity() >= nLen;*/ return true; }
+  bool Alloc(size_t nLen) { reserve(nLen); return capacity() >= nLen; }
     // minimize the string's memory
     // only works if the data of this string is not shared
   bool Shrink();
@@ -1880,6 +1887,12 @@ public:
     { return append(str.data()); }
   wxString& append(const wxWCharBuffer& str)
     { return append(str.data()); }
+  wxString& append(const wxCStrData& str, size_t n)
+    { return append(str.AsString(), 0, n); }
+  wxString& append(const wxCharBuffer& str, size_t n)
+    { return append(str.data(), n); }
+  wxString& append(const wxWCharBuffer& str, size_t n)
+    { return append(str.data(), n); }
 
     // append n copies of ch
   wxString& append(size_t n, wxUniChar ch)
@@ -1892,6 +1905,15 @@ public:
         m_impl.append(n, (wxStringCharType)ch);
     return *this;
   }
+  wxString& append(size_t n, wxUniCharRef ch)
+    { return append(n, wxUniChar(ch)); }
+  wxString& append(size_t n, char ch)
+    { return append(n, wxUniChar(ch)); }
+  wxString& append(size_t n, unsigned char ch)
+    { return append(n, wxUniChar(ch)); }
+  wxString& append(size_t n, wchar_t ch)
+    { return append(n, wxUniChar(ch)); }
+
     // append from first to last
   wxString& append(const_iterator first, const_iterator last)
     { m_impl.append(first.impl(), last.impl()); return *this; }