]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/string.h
switching to defines not having a value for __WXMAC__
[wxWidgets.git] / include / wx / string.h
index e05371a9e4b564412027f9edcf582f27456dc7e2..309b27820ad368b219ae366e69d16aa2e20ba3b4 100644 (file)
     #include <strings.h>    // for strcasecmp()
 #endif // HAVE_STRCASECMP_IN_STRINGS_H
 
     #include <strings.h>    // for strcasecmp()
 #endif // HAVE_STRCASECMP_IN_STRINGS_H
 
+#ifdef __PALMOS__
+    #include <StringMgr.h>
+#endif
+
 #include "wx/wxchar.h"      // for wxChar
 #include "wx/buffer.h"      // for wxCharBuffer
 #include "wx/strconv.h"     // for wxConvertXXX() macros and wxMBConv classes
 
 #include "wx/wxchar.h"      // for wxChar
 #include "wx/buffer.h"      // for wxCharBuffer
 #include "wx/strconv.h"     // for wxConvertXXX() macros and wxMBConv classes
 
+class WXDLLIMPEXP_BASE wxString;
+
 // ---------------------------------------------------------------------------
 // macros
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // macros
 // ---------------------------------------------------------------------------
@@ -80,7 +86,7 @@ extern const unsigned int wxSTRING_MAXLEN;
 
 #else
 // maximum possible length for a string means "take all string" everywhere
 
 #else
 // maximum possible length for a string means "take all string" everywhere
-//  (as sizeof(StringData) is unknown here, we substract 100)
+//  (as sizeof(StringData) is unknown here, we subtract 100)
 const unsigned int wxSTRING_MAXLEN = UINT_MAX - 100;
 
 #endif
 const unsigned int wxSTRING_MAXLEN = UINT_MAX - 100;
 
 #endif
@@ -164,10 +170,6 @@ inline int Stricmp(const char *psz1, const char *psz2)
 #endif  // OS/compiler
 }
 
 #endif  // OS/compiler
 }
 
-// return an empty wxString
-class WXDLLIMPEXP_BASE wxString; // not yet defined
-inline const wxString& wxGetEmptyString() { return *(wxString *)&wxEmptyString; }
-
 #if wxUSE_STL
 
 #include "wx/beforestd.h"
 #if wxUSE_STL
 
 #include "wx/beforestd.h"
@@ -574,17 +576,15 @@ public:
     // All compare functions return -1, 0 or 1 if the [sub]string is less,
     // equal or greater than the compare() argument.
 
     // All compare functions return -1, 0 or 1 if the [sub]string is less,
     // equal or greater than the compare() argument.
 
-    // just like strcmp()
-  int compare(const wxStringBase& str) const
-    { return wxStrcmp(c_str(), str.c_str()); }
+    // comparison with another string
+  int compare(const wxStringBase& str) const;
     // comparison with a substring
   int compare(size_t nStart, size_t nLen, const wxStringBase& str) const;
     // comparison of 2 substrings
   int compare(size_t nStart, size_t nLen,
               const wxStringBase& str, size_t nStart2, size_t nLen2) const;
     // comparison with a substring
   int compare(size_t nStart, size_t nLen, const wxStringBase& str) const;
     // comparison of 2 substrings
   int compare(size_t nStart, size_t nLen,
               const wxStringBase& str, size_t nStart2, size_t nLen2) const;
-    // just like strcmp()
-  int compare(const wxChar* sz) const
-    { return wxStrcmp(c_str(), sz); }
+    // comparison with a c string
+  int compare(const wxChar* sz) const;
     // substring comparison with first nCount characters of sz
   int compare(size_t nStart, size_t nLen,
               const wxChar* sz, size_t nCount = npos) const;
     // substring comparison with first nCount characters of sz
   int compare(size_t nStart, size_t nLen,
               const wxChar* sz, size_t nCount = npos) const;
@@ -823,8 +823,7 @@ public:
     // type differs because a function may either return pointer to the buffer
     // directly or have to use intermediate buffer for translation.
 #if wxUSE_UNICODE
     // type differs because a function may either return pointer to the buffer
     // directly or have to use intermediate buffer for translation.
 #if wxUSE_UNICODE
-    const wxCharBuffer mb_str(wxMBConv& conv = wxConvLibc) const
-        { return conv.cWC2MB(c_str()); }
+    const wxCharBuffer mb_str(wxMBConv& conv = wxConvLibc) const;
 
     const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); }
 
 
     const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); }
 
@@ -847,8 +846,7 @@ public:
     const wxWX2MBbuf mbc_str() const { return mb_str(); }
 
 #if wxUSE_WCHAR_T
     const wxWX2MBbuf mbc_str() const { return mb_str(); }
 
 #if wxUSE_WCHAR_T
-    const wxWCharBuffer wc_str(wxMBConv& conv) const
-        { return conv.cMB2WC(c_str()); }
+    const wxWCharBuffer wc_str(wxMBConv& conv) const;
 #endif // wxUSE_WCHAR_T
 
     const wxChar* fn_str() const { return c_str(); }
 #endif // wxUSE_WCHAR_T
 
     const wxChar* fn_str() const { return c_str(); }
@@ -973,9 +971,11 @@ public:
 
   // string comparison
     // case-sensitive comparison (returns a value < 0, = 0 or > 0)
 
   // string comparison
     // case-sensitive comparison (returns a value < 0, = 0 or > 0)
-  int Cmp(const wxChar *psz) const { return wxStrcmp(c_str(), psz); }
+  int Cmp(const wxChar *psz) const;
+  int Cmp(const wxString& s) const;
     // same as Cmp() but not case-sensitive
     // same as Cmp() but not case-sensitive
-  int CmpNoCase(const wxChar *psz) const { return wxStricmp(c_str(), psz); }
+  int CmpNoCase(const wxChar *psz) const;
+  int CmpNoCase(const wxString& s) const;
     // test for the string equality, either considering case or not
     // (if compareWithCase then the case matters)
   bool IsSameAs(const wxChar *psz, bool compareWithCase = true) const
     // test for the string equality, either considering case or not
     // (if compareWithCase then the case matters)
   bool IsSameAs(const wxChar *psz, bool compareWithCase = true) const
@@ -1287,6 +1287,17 @@ public:
     #include "wx/arrstr.h"
 #endif
 
     #include "wx/arrstr.h"
 #endif
 
+#if wxUSE_STL
+    // return an empty wxString (not very useful with wxUSE_STL == 1)
+    inline const wxString wxGetEmptyString() { return wxString(); }
+#else // !wxUSE_STL
+    // return an empty wxString (more efficient than wxString() here)
+    inline const wxString& wxGetEmptyString()
+    {
+        return *(wxString *)&wxEmptyString;
+    }
+#endif // wxUSE_STL/!wxUSE_STL
+
 // ----------------------------------------------------------------------------
 // wxStringBuffer: a tiny class allowing to get a writable pointer into string
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // wxStringBuffer: a tiny class allowing to get a writable pointer into string
 // ----------------------------------------------------------------------------
@@ -1369,7 +1380,10 @@ class WXDLLIMPEXP_BASE wxStringBufferLength
 public:
     wxStringBufferLength(wxString& str, size_t lenWanted = 1024)
         : m_str(str), m_buf(NULL), m_len(0), m_lenSet(false)
 public:
     wxStringBufferLength(wxString& str, size_t lenWanted = 1024)
         : m_str(str), m_buf(NULL), m_len(0), m_lenSet(false)
-        { m_buf = m_str.GetWriteBuf(lenWanted); }
+    { 
+        m_buf = m_str.GetWriteBuf(lenWanted); 
+        wxASSERT(m_buf != NULL);
+    }
 
     ~wxStringBufferLength()
     {
 
     ~wxStringBufferLength()
     {