X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ede25f5bd0725dcc0888b37edfbb1ae2194b6138..884470b12ee25b20796bfef11a9bfa5fb1e1511c:/src/common/string.cpp?ds=sidebyside diff --git a/src/common/string.cpp b/src/common/string.cpp index c4101484cf..5329f085e2 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -41,6 +41,10 @@ #include #include +#ifdef __SALFORDC__ +#include +#endif + #if wxUSE_WCSRTOMBS #include // for wcsrtombs(), see comments where it's used #endif // GNU @@ -58,9 +62,9 @@ // static class variables definition // --------------------------------------------------------------------------- -#ifdef STD_STRING_COMPATIBILITY +#ifdef wxSTD_STRING_COMPATIBILITY const size_t wxString::npos = STRING_MAXLEN; -#endif +#endif // wxSTD_STRING_COMPATIBILITY // ---------------------------------------------------------------------------- // static data @@ -76,7 +80,7 @@ static const struct } g_strEmpty = { {-1, 0, 0}, '\0' }; // empty C style string: points to 'string data' byte of g_strEmpty -extern const char *g_szNul = &g_strEmpty.dummy; +extern const char WXDLLEXPORT *g_szNul = &g_strEmpty.dummy; // ---------------------------------------------------------------------------- // conditional compilation @@ -109,7 +113,7 @@ extern const char *g_szNul = &g_strEmpty.dummy; // global functions // ---------------------------------------------------------------------------- -#ifdef STD_STRING_COMPATIBILITY +#ifdef wxSTD_STRING_COMPATIBILITY // MS Visual C++ version 5.0 provides the new STL headers as well as the old // iostream ones. @@ -253,7 +257,7 @@ wxString::wxString(const unsigned char* psz, size_t nLength) InitWith((const char *)psz, 0, nLength); } -#ifdef STD_STRING_COMPATIBILITY +#ifdef wxSTD_STRING_COMPATIBILITY // poor man's iterators are "void *" pointers wxString::wxString(const void *pStart, const void *pEnd) @@ -672,11 +676,11 @@ wxString wxString::Right(size_t nCount) const // get all characters after the last occurence of ch // (returns the whole string if ch not found) -wxString wxString::Right(char ch) const +wxString wxString::AfterLast(char ch) const { wxString str; int iPos = Find(ch, TRUE); - if ( iPos == NOT_FOUND ) + if ( iPos == wxNOT_FOUND ) str = *this; else str = c_str() + iPos + 1; @@ -697,7 +701,7 @@ wxString wxString::Left(size_t nCount) const // get all characters before the first occurence of ch // (returns the whole string if ch not found) -wxString wxString::Left(char ch) const +wxString wxString::BeforeFirst(char ch) const { wxString str; for ( const char *pc = m_pchData; *pc != '\0' && *pc != ch; pc++ ) @@ -708,11 +712,11 @@ wxString wxString::Left(char ch) const /// get all characters before the last occurence of ch /// (returns empty string if ch not found) -wxString wxString::Before(char ch) const +wxString wxString::BeforeLast(char ch) const { wxString str; int iPos = Find(ch, TRUE); - if ( iPos != NOT_FOUND && iPos != 0 ) + if ( iPos != wxNOT_FOUND && iPos != 0 ) str = wxString(c_str(), iPos); return str; @@ -720,11 +724,11 @@ wxString wxString::Before(char ch) const /// get all characters after the first occurence of ch /// (returns empty string if ch not found) -wxString wxString::After(char ch) const +wxString wxString::AfterFirst(char ch) const { wxString str; int iPos = Find(ch); - if ( iPos != NOT_FOUND ) + if ( iPos != wxNOT_FOUND ) str = c_str() + iPos + 1; return str; @@ -871,7 +875,7 @@ wxString& wxString::Trim(bool bFromRight) psz++; // fix up data and length - int nDataLength = GetStringData()->nDataLength - (psz - m_pchData); + int nDataLength = GetStringData()->nDataLength - (psz - (const char*) m_pchData); memmove(m_pchData, psz, (nDataLength + 1)*sizeof(char)); GetStringData()->nDataLength = nDataLength; } @@ -911,7 +915,7 @@ wxString& wxString::Truncate(size_t uiLen) } // --------------------------------------------------------------------------- -// finding (return NOT_FOUND if not found and index otherwise) +// finding (return wxNOT_FOUND if not found and index otherwise) // --------------------------------------------------------------------------- // find a character @@ -919,7 +923,7 @@ int wxString::Find(char ch, bool bFromEnd) const { const char *psz = bFromEnd ? strrchr(m_pchData, ch) : strchr(m_pchData, ch); - return (psz == NULL) ? NOT_FOUND : psz - m_pchData; + return (psz == NULL) ? wxNOT_FOUND : psz - (const char*) m_pchData; } // find a sub-string (like strstr) @@ -927,7 +931,7 @@ int wxString::Find(const char *pszSub) const { const char *psz = strstr(m_pchData, pszSub); - return (psz == NULL) ? NOT_FOUND : psz - m_pchData; + return (psz == NULL) ? wxNOT_FOUND : psz - (const char*) m_pchData; } // --------------------------------------------------------------------------- @@ -1091,7 +1095,7 @@ int wxString::Freq(char ch) const // --------------------------------------------------------------------------- // standard C++ library string functions // --------------------------------------------------------------------------- -#ifdef STD_STRING_COMPATIBILITY +#ifdef wxSTD_STRING_COMPATIBILITY wxString& wxString::insert(size_t nPos, const wxString& str) { @@ -1385,7 +1389,7 @@ int wxArrayString::Index(const char *sz, bool bCase, bool bFromEnd) const } } - return NOT_FOUND; + return wxNOT_FOUND; } // add item at the end @@ -1436,7 +1440,7 @@ void wxArrayString::Remove(const char *sz) { int iIndex = Index(sz); - wxCHECK_RET( iIndex != NOT_FOUND, + wxCHECK_RET( iIndex != wxNOT_FOUND, _("removing inexistent element in wxArrayString::Remove") ); Remove(iIndex);