]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/string.h
Fix line endings
[wxWidgets.git] / include / wx / string.h
index 2d7d3e3a9c21c8dcabb23429952a0a1fc0c14341..f3afbd34fff8e74b19858fb3c80e6f0022c171e2 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"
@@ -1343,7 +1341,15 @@ public:
     { return *this = cstr.AsString(); }
     // from a character
   wxString& operator=(wxUniChar ch)
-    { m_impl = wxStringOperations::EncodeChar(ch); return *this; }
+  {
+#if wxUSE_UNICODE_UTF8
+    if ( !ch.IsAscii() )
+        m_impl = wxStringOperations::EncodeChar(ch);
+    else
+#endif
+        m_impl = (wxStringCharType)ch;
+    return *this;
+  }
   wxString& operator=(wxUniCharRef ch)
     { return operator=((wxUniChar)ch); }
   wxString& operator=(char ch)
@@ -2242,8 +2248,15 @@ public:
     // find the first occurence of character ch after nStart
   size_t find(wxUniChar ch, size_t nStart = 0) const
   {
-    return PosFromImpl(m_impl.find(wxStringOperations::EncodeChar(ch),
-                                   PosToImpl(nStart)));
+#if wxUSE_UNICODE_UTF8
+    if ( !ch.IsAscii() )
+        return PosFromImpl(m_impl.find(wxStringOperations::EncodeChar(ch),
+                                       PosToImpl(nStart)));
+    else
+#endif
+        return PosFromImpl(m_impl.find((wxStringCharType)ch,
+                                       PosToImpl(nStart)));
+
   }
   size_t find(wxUniCharRef ch, size_t nStart = 0) const
     {  return find(wxUniChar(ch), nStart); }
@@ -2280,8 +2293,14 @@ public:
     // as find, but from the end
   size_t rfind(wxUniChar ch, size_t nStart = npos) const
   {
-    return PosFromImpl(m_impl.rfind(wxStringOperations::EncodeChar(ch),
-                                    PosToImpl(nStart)));
+#if wxUSE_UNICODE_UTF8
+    if ( !ch.IsAscii() )
+        return PosFromImpl(m_impl.rfind(wxStringOperations::EncodeChar(ch),
+                                        PosToImpl(nStart)));
+    else
+#endif
+        return PosFromImpl(m_impl.rfind((wxStringCharType)ch,
+                                        PosToImpl(nStart)));
   }
   size_t rfind(wxUniCharRef ch, size_t nStart = npos) const
     {  return rfind(wxUniChar(ch), nStart); }
@@ -2519,7 +2538,15 @@ public:
     { return operator+=(s.data()); }
       // string += char
   wxString& operator+=(wxUniChar ch)
-    { m_impl += wxStringOperations::EncodeChar(ch); return *this; }
+  {
+#if wxUSE_UNICODE_UTF8
+    if ( !ch.IsAscii() )
+        m_impl += wxStringOperations::EncodeChar(ch);
+    else
+#endif
+        m_impl += (wxStringCharType)ch;
+    return *this;
+  }
   wxString& operator+=(wxUniCharRef ch) { return *this += wxUniChar(ch); }
   wxString& operator+=(int ch) { return *this += wxUniChar(ch); }
   wxString& operator+=(char ch) { return *this += wxUniChar(ch); }