X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c84c52de6f534df50dc6348b839c98029fa3f8ee..9ef4a31e643ce01bef16b37f10be125df0c2ab0f:/include/wx/string.h?ds=sidebyside diff --git a/include/wx/string.h b/include/wx/string.h index f3c3c00111..fbe3c9e36d 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -16,15 +16,10 @@ #pragma interface "string.h" #endif -/* Dependencies (should be included before this header): - * string.h - * stdio.h - * stdarg.h - * limits.h - */ #ifdef __WXMAC__ -#include + #include #endif + #include #include #include @@ -32,11 +27,12 @@ #include #ifndef WX_PRECOMP - #include "wx/defs.h" // Robert Roebling + #include "wx/defs.h" + #ifdef WXSTRING_IS_WXOBJECT #include "wx/object.h" #endif -#endif +#endif // !PCH #include "wx/debug.h" @@ -83,7 +79,7 @@ inline size_t WXDLLEXPORT Strlen(const char *psz) // portable strcasecmp/_stricmp inline int WXDLLEXPORT Stricmp(const char *psz1, const char *psz2) { -#if defined(_MSC_VER) +#if defined(__VISUALC__) || defined(__MWERKS__) return _stricmp(psz1, psz2); #elif defined(__SC__) return _stricmp(psz1, psz2); @@ -230,6 +226,13 @@ private: void CopyBeforeWrite(); void AllocBeforeWrite(size_t); + // this method is not implemented - there is _no_ conversion from int to + // string, you're doing something wrong if the compiler wants to call it! + // + // try `s << i' or `s.Printf("%d", i)' instead + wxString(int); + wxString(long); + public: // constructors and destructor // ctor for an empty string @@ -266,6 +269,8 @@ public: size_t Len() const { return GetStringData()->nDataLength; } // string contains any characters? bool IsEmpty() const { return Len() == 0; } + // empty string is "FALSE", so !str will return TRUE + bool operator!() const { return IsEmpty(); } // empty string contents void Empty() { @@ -448,11 +453,12 @@ public: // convert to upper case in place, return the string itself wxString& MakeUpper(); // convert to upper case, return the copy of the string - wxString Upper() const { wxString s(*this); return s.MakeUpper(); } + // Here's something to remember: BC++ doesn't like returns in inlines. + wxString Upper() const ; // convert to lower case in place, return the string itself wxString& MakeLower(); // convert to lower case, return the copy of the string - wxString Lower() const { wxString s(*this); return s.MakeLower(); } + wxString Lower() const ; // trimming/padding whitespace (either side) and truncating // remove spaces from left or from right (default) side @@ -504,15 +510,9 @@ public: enum caseCompare {exact, ignoreCase}; // values for first parameter of Strip function enum stripType {leading = 0x1, trailing = 0x2, both = 0x3}; + // use Printf() - inline int sprintf(const char *pszFormat, ...) - { - va_list argptr; - va_start(argptr, pszFormat); - int iLen = PrintfV(pszFormat, argptr); - va_end(argptr); - return iLen; - } + int sprintf(const char *pszFormat, ...); // use Cmp() inline int CompareTo(const char* psz, caseCompare cmp = exact) const @@ -648,7 +648,7 @@ public: size_t find(const wxString& str, size_t nStart = 0) const; // VC++ 1.5 can't cope with this syntax. -#if !(defined(_MSC_VER) && !defined(__WIN32__)) +#if !defined(__VISUALC__) || defined(__WIN32__) // find first n characters of sz size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const; #endif @@ -664,7 +664,7 @@ public: size_t rfind(const wxString& str, size_t nStart = npos) const; // VC++ 1.5 can't cope with this syntax. -#if ! (defined(_MSC_VER) && !defined(__WIN32__)) +#if !defined(__VISUALC__) || defined(__WIN32__) // as find, but from the end size_t rfind(const char* sz, size_t nStart = npos, size_t n = npos) const; @@ -857,19 +857,7 @@ wxString WXDLLEXPORT operator+(const char *psz, const wxString& string); #ifdef wxSTD_STRING_COMPATIBILITY -// forward declare iostream -// Known not to work with wxUSE_IOSTREAMH set to 0, so -// replacing with includes (on advice of ungod@pasdex.com.au) -// class WXDLLEXPORT istream; -#if wxUSE_IOSTREAMH -// N.B. BC++ doesn't have istream.h, ostream.h -#include -#else -#include -# ifdef _MSC_VER - using namespace std; -# endif -#endif +#include "wx/ioswrap.h" WXDLLEXPORT istream& operator>>(istream& is, wxString& str);