#include <StringMgr.h>
#endif
-#include "wx/wxchar.h" // for wxChar
+#include "wx/wxchar.h" // for wxChar, wxStrlen() etc.
+#include "wx/unichar.h"
#include "wx/strvararg.h"
#include "wx/buffer.h" // for wxCharBuffer
#include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes
// strlen() and portable strcasecmp()
//---------------------------------------------------------------------------
-// Use wxXXX() functions from wxchar.h instead! These functions are for
+#if WXWIN_COMPATIBILITY_2_8
+// Use wxXXX() functions from wxcrt.h instead! These functions are for
// backwards compatibility only.
// checks whether the passed in pointer is NULL and if the string is empty
+wxDEPRECATED( inline bool IsEmpty(const char *p) );
inline bool IsEmpty(const char *p) { return (!p || !*p); }
// safe version of strlen() (returns 0 if passed NULL pointer)
+wxDEPRECATED( inline size_t Strlen(const char *psz) );
inline size_t Strlen(const char *psz)
{ return psz ? strlen(psz) : 0; }
// portable strcasecmp/_stricmp
+wxDEPRECATED( inline int Stricmp(const char *psz1, const char *psz2) );
inline int Stricmp(const char *psz1, const char *psz2)
{
#if defined(__VISUALC__) && defined(__WXWINCE__)
#endif // OS/compiler
}
+#endif // WXWIN_COMPATIBILITY_2_8
+
// ----------------------------------------------------------------------------
// deal with STL/non-STL/non-STL-but-wxUSE_STD_STRING
// ----------------------------------------------------------------------------
// allow expressions like "c_str()[0]":
wxUniChar operator[](int n) const { return operator[](size_t(n)); }
wxUniChar operator[](size_t n) const;
+ wxUniChar operator[](long n) const { return operator[](size_t(n)); }
#ifndef wxSIZE_T_IS_UINT
wxUniChar operator[](unsigned int n) const { return operator[](size_t(n)); }
#endif // size_t != unsigned int
*/
wxUniChar operator[](int n) const
{ return wxStringBase::at(n); }
+ wxUniChar operator[](long n) const
+ { return wxStringBase::at(n); }
wxUniChar operator[](size_t n) const
{ return wxStringBase::at(n); }
#ifndef wxSIZE_T_IS_UINT
// operator versions of GetWriteableChar()
wxUniCharRef operator[](int n)
{ return wxStringBase::at(n); }
+ wxUniCharRef operator[](long n)
+ { return wxStringBase::at(n); }
wxUniCharRef operator[](size_t n)
{ return wxStringBase::at(n); }
#ifndef wxSIZE_T_IS_UINT
// from another wxString
wxString& operator=(const wxStringBase& stringSrc)
{ return (wxString&)wxStringBase::operator=(stringSrc); }
+ wxString& operator=(const wxCStrData& cstr);
// from a character
wxString& operator=(wxUniChar ch)
{ return (wxString&)wxStringBase::operator=(ch); }
return m_str->at(m_offset + n);
}
+// ----------------------------------------------------------------------------
+// implementation of wxString inline methods using wxCStrData
+// ----------------------------------------------------------------------------
+
+inline wxString& wxString::operator=(const wxCStrData& cstr)
+{
+ return *this = cstr.AsString();
+}
+
+// ----------------------------------------------------------------------------
+// implementation of wx[W]CharBuffer inline methods using wxCStrData
+// ----------------------------------------------------------------------------
+
+#if wxUSE_UNICODE
+
+inline wxWCharBuffer::wxWCharBuffer(const wxCStrData& cstr)
+ : m_str(wxStrdupW(cstr))
+{
+}
+
+#else // !wxUSE_UNICODE
+
+inline wxCharBuffer::wxCharBuffer(const wxCStrData& cstr)
+ : m_str(wxStrdupA(cstr))
+{
+}
+
+#endif // wxUSE_UNICODE/!wxUSE_UNICODE
+
#endif // _WX_WXSTRINGH__