]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/string.h
rename wxFileList to wxFileListCtrl
[wxWidgets.git] / include / wx / string.h
index 436a6831f4544ee00cf9a47362a0811afb060c33..3b112d582da2b45e99f3a04afddf9c9059d46d0f 100644 (file)
@@ -1087,19 +1087,25 @@ public:
 
   void resize(size_t nSize, wxUniChar ch = wxT('\0'))
   {
+    const size_t len = length();
+    if ( nSize == len)
+        return;
+
 #if wxUSE_UNICODE_UTF8
-    if ( !ch.IsAscii() )
+    if ( nSize < len )
     {
-        size_t len = length();
-        if ( nSize == len)
-            return;
-        else if ( nSize < len )
-            erase(nSize);
-        else
-            append(nSize - len, ch);
+        // we can't use wxStringImpl::resize() for truncating the string as it
+        // counts in bytes, not characters
+        erase(nSize);
+        return;
     }
+
+    // we also can't use (presumably more efficient) resize() if we have to
+    // append characters taking more than one byte
+    if ( !ch.IsAscii() )
+        append(nSize - len, ch);
     else
-#endif
+#endif // wxUSE_UNICODE_UTF8
         m_impl.resize(nSize, (wxStringCharType)ch);
   }
 
@@ -2760,7 +2766,7 @@ private:
 #endif // !wxUSE_STL_BASED_WXSTRING
 
 template<typename T>
-class wxStringTypeBufferBase
+class WXDLLIMPEXP_BASE wxStringTypeBufferBase
 {
 public:
     typedef T CharType;
@@ -2778,7 +2784,7 @@ protected:
 };
 
 template<typename T>
-class wxStringTypeBufferLengthBase
+class WXDLLIMPEXP_BASE wxStringTypeBufferLengthBase
 {
 public:
     typedef T CharType;
@@ -2828,6 +2834,9 @@ public:
 };
 
 #if wxUSE_STL_BASED_WXSTRING
+
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferBase<wxStringCharType> )
+
 class wxStringInternalBuffer : public wxStringTypeBufferBase<wxStringCharType>
 {
 public:
@@ -2839,7 +2848,11 @@ public:
     DECLARE_NO_COPY_CLASS(wxStringInternalBuffer)
 };
 
-class wxStringInternalBufferLength : public wxStringTypeBufferLengthBase<wxStringCharType>
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(
+    wxStringTypeBufferLengthBase<wxStringCharType> )
+
+class wxStringInternalBufferLength
+    : public wxStringTypeBufferLengthBase<wxStringCharType>
 {
 public:
     wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024)
@@ -2868,6 +2881,9 @@ typedef wxStringInternalBufferLength          wxStringBufferLength;
 typedef wxStringInternalBuffer                wxUTF8StringBuffer;
 typedef wxStringInternalBufferLength          wxUTF8StringBufferLength;
 #elif wxUSE_UNICODE_WCHAR
+
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferBase<char> )
+
 class WXDLLIMPEXP_BASE wxUTF8StringBuffer : public wxStringTypeBufferBase<char>
 {
 public:
@@ -2878,6 +2894,8 @@ public:
     DECLARE_NO_COPY_CLASS(wxUTF8StringBuffer)
 };
 
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferLengthBase<char> )
+
 class WXDLLIMPEXP_BASE wxUTF8StringBufferLength
     : public wxStringTypeBufferLengthBase<char>
 {