X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb3c9042543e8e0ee533eff7be4b2bdc2e9eb84e..b4cfe261db9bec8cdfb2664ed3f50e3e8350bbde:/include/wx/string.h?ds=inline diff --git a/include/wx/string.h b/include/wx/string.h index 888a1faaf4..30b903e322 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -168,9 +168,6 @@ inline int Stricmp(const char *psz1, const char *psz2) #if wxUSE_STL -// return an empty wxString (doesn't make much sense with wxUSE_STL == 1) -inline const wxString wxGetEmptyString() { wxString(); } - #include "wx/beforestd.h" #include #include "wx/afterstd.h" @@ -192,9 +189,6 @@ inline const wxString wxGetEmptyString() { wxString(); } #else // if !wxUSE_STL -// return an empty wxString -inline const wxString& wxGetEmptyString() { return *(wxString *)&wxEmptyString; } - #ifndef HAVE_STD_STRING_COMPARE #define HAVE_STD_STRING_COMPARE #endif @@ -578,17 +572,15 @@ public: // 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; - // 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; @@ -827,8 +819,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 - 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); } @@ -851,8 +842,7 @@ public: 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(); } @@ -977,9 +967,11 @@ public: // 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 - 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 @@ -1291,6 +1283,17 @@ public: #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 // ----------------------------------------------------------------------------