Add wxNO_UNSAFE_WXSTRING_CONV2 macro
The macro disallows implicit conversions between wxString and const char*
This commit is contained in:
committed by
Vadim Zeitlin
parent
15a4375f93
commit
65cbf40b7e
@@ -504,8 +504,10 @@ extern WXDLLIMPEXP_BASE bool wxAnyConvertString(const wxString& value,
|
|||||||
wxAnyValueBuffer& dst);
|
wxAnyValueBuffer& dst);
|
||||||
|
|
||||||
WX_ANY_DEFINE_CONVERTIBLE_TYPE_BASE(wxString, wxString, wxAnyConvertString)
|
WX_ANY_DEFINE_CONVERTIBLE_TYPE_BASE(wxString, wxString, wxAnyConvertString)
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
WX_ANY_DEFINE_CONVERTIBLE_TYPE(const char*, ConstCharPtr,
|
WX_ANY_DEFINE_CONVERTIBLE_TYPE(const char*, ConstCharPtr,
|
||||||
wxAnyConvertString, wxString)
|
wxAnyConvertString, wxString)
|
||||||
|
#endif
|
||||||
WX_ANY_DEFINE_CONVERTIBLE_TYPE(const wchar_t*, ConstWchar_tPtr,
|
WX_ANY_DEFINE_CONVERTIBLE_TYPE(const wchar_t*, ConstWchar_tPtr,
|
||||||
wxAnyConvertString, wxString)
|
wxAnyConvertString, wxString)
|
||||||
|
|
||||||
@@ -757,11 +759,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// These two constructors are needed to deal with string literals
|
// These two constructors are needed to deal with string literals
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxAny(const char* value)
|
wxAny(const char* value)
|
||||||
{
|
{
|
||||||
m_type = wxAnyValueTypeImpl<const char*>::sm_instance.get();
|
m_type = wxAnyValueTypeImpl<const char*>::sm_instance.get();
|
||||||
wxAnyValueTypeImpl<const char*>::SetValue(value, m_buffer);
|
wxAnyValueTypeImpl<const char*>::SetValue(value, m_buffer);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
wxAny(const wchar_t* value)
|
wxAny(const wchar_t* value)
|
||||||
{
|
{
|
||||||
m_type = wxAnyValueTypeImpl<const wchar_t*>::sm_instance.get();
|
m_type = wxAnyValueTypeImpl<const wchar_t*>::sm_instance.get();
|
||||||
@@ -865,11 +869,13 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// These two operators are needed to deal with string literals
|
// These two operators are needed to deal with string literals
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxAny& operator=(const char* value)
|
wxAny& operator=(const char* value)
|
||||||
{
|
{
|
||||||
Assign(value);
|
Assign(value);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
wxAny& operator=(const wchar_t* value)
|
wxAny& operator=(const wchar_t* value)
|
||||||
{
|
{
|
||||||
Assign(value);
|
Assign(value);
|
||||||
@@ -888,8 +894,10 @@ public:
|
|||||||
return value == value2;
|
return value == value2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
bool operator==(const char* value) const
|
bool operator==(const char* value) const
|
||||||
{ return (*this) == wxString(value); }
|
{ return (*this) == wxString(value); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
bool operator==(const wchar_t* value) const
|
bool operator==(const wchar_t* value) const
|
||||||
{ return (*this) == wxString(value); }
|
{ return (*this) == wxString(value); }
|
||||||
|
|
||||||
@@ -1017,6 +1025,13 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
wxAny(const char*); // Disabled
|
||||||
|
wxAny& operator=(const char *&value); // Disabled
|
||||||
|
wxAny& operator=(const char value[]); // Disabled
|
||||||
|
wxAny& operator==(const char *value); // Disabled
|
||||||
|
#endif
|
||||||
|
|
||||||
// Assignment functions
|
// Assignment functions
|
||||||
void AssignAny(const wxAny& any)
|
void AssignAny(const wxAny& any)
|
||||||
{
|
{
|
||||||
|
@@ -65,6 +65,7 @@ public:
|
|||||||
bool operator!() const { return !((bool)*this); }
|
bool operator!() const { return !((bool)*this); }
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
// and these are the conversions operator which allow to assign the result
|
// and these are the conversions operator which allow to assign the result
|
||||||
// of FuncReturningAnyStrPtr() to either char* or wxChar* (i.e. wchar_t*)
|
// of FuncReturningAnyStrPtr() to either char* or wxChar* (i.e. wchar_t*)
|
||||||
operator const char *() const
|
operator const char *() const
|
||||||
@@ -94,6 +95,7 @@ public:
|
|||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
operator const wchar_t *() const
|
operator const wchar_t *() const
|
||||||
{
|
{
|
||||||
|
@@ -27,8 +27,8 @@ class wxArtProviderModule;
|
|||||||
typedef wxString wxArtClient;
|
typedef wxString wxArtClient;
|
||||||
typedef wxString wxArtID;
|
typedef wxString wxArtID;
|
||||||
|
|
||||||
#define wxART_MAKE_CLIENT_ID_FROM_STR(id) ((id) + "_C")
|
#define wxART_MAKE_CLIENT_ID_FROM_STR(id) ((id) + wxASCII_STR("_C"))
|
||||||
#define wxART_MAKE_CLIENT_ID(id) (#id "_C")
|
#define wxART_MAKE_CLIENT_ID(id) wxASCII_STR(#id "_C")
|
||||||
#define wxART_MAKE_ART_ID_FROM_STR(id) (id)
|
#define wxART_MAKE_ART_ID_FROM_STR(id) (id)
|
||||||
#define wxART_MAKE_ART_ID(id) (#id)
|
#define wxART_MAKE_ART_ID(id) (#id)
|
||||||
|
|
||||||
|
@@ -90,7 +90,7 @@ namespace Catch
|
|||||||
{
|
{
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
if ( !iswprint(*i) )
|
if ( !iswprint(*i) )
|
||||||
s += wxString::Format("\\u%04X", *i).ToStdString();
|
s += wxString::Format(wxASCII_STR("\\u%04X"), *i).ToAscii();
|
||||||
else
|
else
|
||||||
#endif // wxUSE_UNICODE
|
#endif // wxUSE_UNICODE
|
||||||
s += *i;
|
s += *i;
|
||||||
@@ -278,10 +278,10 @@ inline std::string wxGetCurrentTestName()
|
|||||||
// Use this macro to assert with the given formatted message (it should contain
|
// Use this macro to assert with the given formatted message (it should contain
|
||||||
// the format string and arguments in a separate pair of parentheses)
|
// the format string and arguments in a separate pair of parentheses)
|
||||||
#define WX_ASSERT_MESSAGE(msg, cond) \
|
#define WX_ASSERT_MESSAGE(msg, cond) \
|
||||||
CPPUNIT_ASSERT_MESSAGE(std::string(wxString::Format msg .mb_str()), (cond))
|
CPPUNIT_ASSERT_MESSAGE(std::string(wxString::Format msg .mb_str(wxConvLibc)), (cond))
|
||||||
|
|
||||||
#define WX_ASSERT_EQUAL_MESSAGE(msg, expected, actual) \
|
#define WX_ASSERT_EQUAL_MESSAGE(msg, expected, actual) \
|
||||||
CPPUNIT_ASSERT_EQUAL_MESSAGE(std::string(wxString::Format msg .mb_str()), \
|
CPPUNIT_ASSERT_EQUAL_MESSAGE(std::string(wxString::Format msg .mb_str(wxConvLibc)), \
|
||||||
(expected), (actual))
|
(expected), (actual))
|
||||||
|
|
||||||
#endif // _WX_CATCH_CPPUNIT_H_
|
#endif // _WX_CATCH_CPPUNIT_H_
|
||||||
|
@@ -20,6 +20,12 @@ class WXDLLIMPEXP_FWD_CORE wxColour;
|
|||||||
//
|
//
|
||||||
// It avoids the need to repeat these lines across all colour.h files, since
|
// It avoids the need to repeat these lines across all colour.h files, since
|
||||||
// Set() is a virtual function and thus cannot be called by wxColourBase ctors
|
// Set() is a virtual function and thus cannot be called by wxColourBase ctors
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
#define wxWXCOLOUR_CTOR_FROM_CHAR \
|
||||||
|
wxColour(const char *colourName) { Init(); Set(colourName); }
|
||||||
|
#else // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
#define wxWXCOLOUR_CTOR_FROM_CHAR
|
||||||
|
#endif
|
||||||
#define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \
|
#define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \
|
||||||
wxColour() { Init(); } \
|
wxColour() { Init(); } \
|
||||||
wxColour(ChannelType red, \
|
wxColour(ChannelType red, \
|
||||||
@@ -29,7 +35,7 @@ class WXDLLIMPEXP_FWD_CORE wxColour;
|
|||||||
{ Init(); Set(red, green, blue, alpha); } \
|
{ Init(); Set(red, green, blue, alpha); } \
|
||||||
wxColour(unsigned long colRGB) { Init(); Set(colRGB ); } \
|
wxColour(unsigned long colRGB) { Init(); Set(colRGB ); } \
|
||||||
wxColour(const wxString& colourName) { Init(); Set(colourName); } \
|
wxColour(const wxString& colourName) { Init(); Set(colourName); } \
|
||||||
wxColour(const char *colourName) { Init(); Set(colourName); } \
|
wxWXCOLOUR_CTOR_FROM_CHAR \
|
||||||
wxColour(const wchar_t *colourName) { Init(); Set(colourName); }
|
wxColour(const wchar_t *colourName) { Init(); Set(colourName); }
|
||||||
|
|
||||||
|
|
||||||
|
@@ -225,8 +225,10 @@ public:
|
|||||||
|
|
||||||
// we have to provide a separate version for C strings as otherwise the
|
// we have to provide a separate version for C strings as otherwise the
|
||||||
// template Read() would be used
|
// template Read() would be used
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxString Read(const wxString& key, const char* defVal) const
|
wxString Read(const wxString& key, const char* defVal) const
|
||||||
{ return Read(key, wxString(defVal)); }
|
{ return Read(key, wxString(defVal)); }
|
||||||
|
#endif
|
||||||
wxString Read(const wxString& key, const wchar_t* defVal) const
|
wxString Read(const wxString& key, const wchar_t* defVal) const
|
||||||
{ return Read(key, wxString(defVal)); }
|
{ return Read(key, wxString(defVal)); }
|
||||||
|
|
||||||
@@ -268,10 +270,12 @@ public:
|
|||||||
|
|
||||||
// we have to provide a separate version for C strings as otherwise they
|
// we have to provide a separate version for C strings as otherwise they
|
||||||
// would be converted to bool and not to wxString as expected!
|
// would be converted to bool and not to wxString as expected!
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
bool Write(const wxString& key, const char *value)
|
bool Write(const wxString& key, const char *value)
|
||||||
{ return Write(key, wxString(value)); }
|
{ return Write(key, wxString(value)); }
|
||||||
bool Write(const wxString& key, const unsigned char *value)
|
bool Write(const wxString& key, const unsigned char *value)
|
||||||
{ return Write(key, wxString(value)); }
|
{ return Write(key, wxString(value)); }
|
||||||
|
#endif
|
||||||
bool Write(const wxString& key, const wchar_t *value)
|
bool Write(const wxString& key, const wchar_t *value)
|
||||||
{ return Write(key, wxString(value)); }
|
{ return Write(key, wxString(value)); }
|
||||||
|
|
||||||
|
@@ -24,7 +24,9 @@ public:
|
|||||||
// we have to provide all the overloads to allow using strings instead of
|
// we have to provide all the overloads to allow using strings instead of
|
||||||
// data formats (as a lot of existing code does)
|
// data formats (as a lot of existing code does)
|
||||||
wxDataFormat( const wxString& id ) { InitFromString(id); }
|
wxDataFormat( const wxString& id ) { InitFromString(id); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxDataFormat( const char *id ) { InitFromString(id); }
|
wxDataFormat( const char *id ) { InitFromString(id); }
|
||||||
|
#endif
|
||||||
wxDataFormat( const wchar_t *id ) { InitFromString(id); }
|
wxDataFormat( const wchar_t *id ) { InitFromString(id); }
|
||||||
wxDataFormat( const wxCStrData& id ) { InitFromString(id); }
|
wxDataFormat( const wxCStrData& id ) { InitFromString(id); }
|
||||||
|
|
||||||
|
@@ -338,8 +338,10 @@ public:
|
|||||||
{ m_key.integer = i; }
|
{ m_key.integer = i; }
|
||||||
wxListKey(const wxString& s) : m_keyType(wxKEY_STRING)
|
wxListKey(const wxString& s) : m_keyType(wxKEY_STRING)
|
||||||
{ m_key.string = new wxString(s); }
|
{ m_key.string = new wxString(s); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxListKey(const char *s) : m_keyType(wxKEY_STRING)
|
wxListKey(const char *s) : m_keyType(wxKEY_STRING)
|
||||||
{ m_key.string = new wxString(s); }
|
{ m_key.string = new wxString(s); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxListKey(const wchar_t *s) : m_keyType(wxKEY_STRING)
|
wxListKey(const wchar_t *s) : m_keyType(wxKEY_STRING)
|
||||||
{ m_key.string = new wxString(s); }
|
{ m_key.string = new wxString(s); }
|
||||||
|
|
||||||
|
@@ -138,11 +138,15 @@ public:
|
|||||||
// Do not use, it's used by the ctor only.
|
// Do not use, it's used by the ctor only.
|
||||||
struct CtorString
|
struct CtorString
|
||||||
{
|
{
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
CtorString(const char *str) : m_str(str) {}
|
CtorString(const char *str) : m_str(str) {}
|
||||||
|
#endif
|
||||||
CtorString(const wchar_t *str) : m_str(str) {}
|
CtorString(const wchar_t *str) : m_str(str) {}
|
||||||
CtorString(const wxString& str) : m_str(str) {}
|
CtorString(const wxString& str) : m_str(str) {}
|
||||||
CtorString(const wxCStrData& str) : m_str(str) {}
|
CtorString(const wxCStrData& str) : m_str(str) {}
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
CtorString(const wxScopedCharBuffer& str) : m_str(str) {}
|
CtorString(const wxScopedCharBuffer& str) : m_str(str) {}
|
||||||
|
#endif
|
||||||
CtorString(const wxScopedWCharBuffer& str) : m_str(str) {}
|
CtorString(const wxScopedWCharBuffer& str) : m_str(str) {}
|
||||||
|
|
||||||
operator const wxString*() const { return &m_str; }
|
operator const wxString*() const { return &m_str; }
|
||||||
|
@@ -45,10 +45,12 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
ButtonLabel(const char *label)
|
ButtonLabel(const char *label)
|
||||||
: m_label(label), m_stockId(wxID_NONE)
|
: m_label(label), m_stockId(wxID_NONE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
ButtonLabel(const wchar_t *label)
|
ButtonLabel(const wchar_t *label)
|
||||||
: m_label(label), m_stockId(wxID_NONE)
|
: m_label(label), m_stockId(wxID_NONE)
|
||||||
|
@@ -719,5 +719,19 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI;
|
|||||||
#define wxSafeConvertWX2MB(s) (s)
|
#define wxSafeConvertWX2MB(s) (s)
|
||||||
#endif // Unicode/ANSI
|
#endif // Unicode/ANSI
|
||||||
|
|
||||||
|
// Macro that indicates the default encoding for converting C strings
|
||||||
|
// to wxString. It provides a default value for a const wxMBConv&
|
||||||
|
// parameter (i.e. wxConvLibc) unless wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
// is defined.
|
||||||
|
//
|
||||||
|
// Intended use:
|
||||||
|
// wxString(const char *data, ...,
|
||||||
|
// const wxMBConv &conv wxSTRING_DEFAULT_CONV_ARG);
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
#define wxSTRING_DEFAULT_CONV_ARG = wxConvLibc
|
||||||
|
#else
|
||||||
|
#define wxSTRING_DEFAULT_CONV_ARG
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _WX_STRCONV_H_
|
#endif // _WX_STRCONV_H_
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -133,16 +133,20 @@ class WXDLLIMPEXP_FWD_BASE wxString;
|
|||||||
class WXDLLIMPEXP_BASE wxFormatString
|
class WXDLLIMPEXP_BASE wxFormatString
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxFormatString(const char *str)
|
wxFormatString(const char *str)
|
||||||
: m_char(wxScopedCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {}
|
: m_char(wxScopedCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {}
|
||||||
|
#endif
|
||||||
wxFormatString(const wchar_t *str)
|
wxFormatString(const wchar_t *str)
|
||||||
: m_wchar(wxScopedWCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {}
|
: m_wchar(wxScopedWCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {}
|
||||||
wxFormatString(const wxString& str)
|
wxFormatString(const wxString& str)
|
||||||
: m_str(&str), m_cstr(NULL) {}
|
: m_str(&str), m_cstr(NULL) {}
|
||||||
wxFormatString(const wxCStrData& str)
|
wxFormatString(const wxCStrData& str)
|
||||||
: m_str(NULL), m_cstr(&str) {}
|
: m_str(NULL), m_cstr(&str) {}
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxFormatString(const wxScopedCharBuffer& str)
|
wxFormatString(const wxScopedCharBuffer& str)
|
||||||
: m_char(str), m_str(NULL), m_cstr(NULL) {}
|
: m_char(str), m_str(NULL), m_cstr(NULL) {}
|
||||||
|
#endif
|
||||||
wxFormatString(const wxScopedWCharBuffer& str)
|
wxFormatString(const wxScopedWCharBuffer& str)
|
||||||
: m_wchar(str), m_str(NULL), m_cstr(NULL) {}
|
: m_wchar(str), m_str(NULL), m_cstr(NULL) {}
|
||||||
|
|
||||||
@@ -201,7 +205,7 @@ public:
|
|||||||
// to other InputAsXXX() methods
|
// to other InputAsXXX() methods
|
||||||
wxString InputAsString() const;
|
wxString InputAsString() const;
|
||||||
|
|
||||||
#if !wxUSE_UNICODE_WCHAR
|
#if !wxUSE_UNICODE_WCHAR && !defined wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
operator const char*() const
|
operator const char*() const
|
||||||
{ return const_cast<wxFormatString*>(this)->AsChar(); }
|
{ return const_cast<wxFormatString*>(this)->AsChar(); }
|
||||||
private:
|
private:
|
||||||
@@ -212,7 +216,7 @@ private:
|
|||||||
const char* InputAsChar();
|
const char* InputAsChar();
|
||||||
const char* AsChar();
|
const char* AsChar();
|
||||||
wxScopedCharBuffer m_convertedChar;
|
wxScopedCharBuffer m_convertedChar;
|
||||||
#endif // !wxUSE_UNICODE_WCHAR
|
#endif // !wxUSE_UNICODE_WCHAR && !defined wx_NO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
|
#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
|
||||||
public:
|
public:
|
||||||
@@ -284,7 +288,12 @@ struct wxFormatStringArgumentFinder<wxString>
|
|||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct wxFormatStringArgumentFinder<wxScopedCharBuffer>
|
struct wxFormatStringArgumentFinder<wxScopedCharBuffer>
|
||||||
: public wxFormatStringArgumentFinder<const wxScopedCharBuffer&> {};
|
: public wxFormatStringArgumentFinder<const wxScopedCharBuffer&> {
|
||||||
|
#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
private:
|
||||||
|
wxFormatStringArgumentFinder<wxScopedCharBuffer>(); // Disabled
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct wxFormatStringArgumentFinder<wxScopedWCharBuffer>
|
struct wxFormatStringArgumentFinder<wxScopedWCharBuffer>
|
||||||
@@ -292,7 +301,12 @@ struct wxFormatStringArgumentFinder<wxScopedWCharBuffer>
|
|||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct wxFormatStringArgumentFinder<wxCharBuffer>
|
struct wxFormatStringArgumentFinder<wxCharBuffer>
|
||||||
: public wxFormatStringArgumentFinder<const wxCharBuffer&> {};
|
: public wxFormatStringArgumentFinder<const wxCharBuffer&> {
|
||||||
|
#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
private:
|
||||||
|
wxFormatStringArgumentFinder<wxCharBuffer>(); // Disabled
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct wxFormatStringArgumentFinder<wxWCharBuffer>
|
struct wxFormatStringArgumentFinder<wxWCharBuffer>
|
||||||
@@ -387,6 +401,13 @@ struct wxFormatStringSpecifier<const T*>
|
|||||||
enum { value = arg }; \
|
enum { value = arg }; \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define wxDISABLED_FORMAT_STRING_SPECIFIER(T) \
|
||||||
|
template<> struct wxFormatStringSpecifier<T> \
|
||||||
|
{ \
|
||||||
|
private: \
|
||||||
|
wxFormatStringSpecifier<T>(); /* Disabled */ \
|
||||||
|
};
|
||||||
|
|
||||||
wxFORMAT_STRING_SPECIFIER(bool, wxFormatString::Arg_Int)
|
wxFORMAT_STRING_SPECIFIER(bool, wxFormatString::Arg_Int)
|
||||||
wxFORMAT_STRING_SPECIFIER(int, wxFormatString::Arg_Int)
|
wxFORMAT_STRING_SPECIFIER(int, wxFormatString::Arg_Int)
|
||||||
wxFORMAT_STRING_SPECIFIER(unsigned int, wxFormatString::Arg_Int)
|
wxFORMAT_STRING_SPECIFIER(unsigned int, wxFormatString::Arg_Int)
|
||||||
@@ -406,18 +427,27 @@ wxFORMAT_STRING_SPECIFIER(long double, wxFormatString::Arg_LongDouble)
|
|||||||
wxFORMAT_STRING_SPECIFIER(wchar_t, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
|
wxFORMAT_STRING_SPECIFIER(wchar_t, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !wxUSE_UNICODE
|
#if !wxUSE_UNICODE && !defined wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxFORMAT_STRING_SPECIFIER(char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
|
wxFORMAT_STRING_SPECIFIER(char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
|
||||||
wxFORMAT_STRING_SPECIFIER(signed char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
|
wxFORMAT_STRING_SPECIFIER(signed char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
|
||||||
wxFORMAT_STRING_SPECIFIER(unsigned char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
|
wxFORMAT_STRING_SPECIFIER(unsigned char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxFORMAT_STRING_SPECIFIER(char*, wxFormatString::Arg_String)
|
wxFORMAT_STRING_SPECIFIER(char*, wxFormatString::Arg_String)
|
||||||
wxFORMAT_STRING_SPECIFIER(unsigned char*, wxFormatString::Arg_String)
|
wxFORMAT_STRING_SPECIFIER(unsigned char*, wxFormatString::Arg_String)
|
||||||
wxFORMAT_STRING_SPECIFIER(signed char*, wxFormatString::Arg_String)
|
wxFORMAT_STRING_SPECIFIER(signed char*, wxFormatString::Arg_String)
|
||||||
wxFORMAT_STRING_SPECIFIER(const char*, wxFormatString::Arg_String)
|
wxFORMAT_STRING_SPECIFIER(const char*, wxFormatString::Arg_String)
|
||||||
wxFORMAT_STRING_SPECIFIER(const unsigned char*, wxFormatString::Arg_String)
|
wxFORMAT_STRING_SPECIFIER(const unsigned char*, wxFormatString::Arg_String)
|
||||||
wxFORMAT_STRING_SPECIFIER(const signed char*, wxFormatString::Arg_String)
|
wxFORMAT_STRING_SPECIFIER(const signed char*, wxFormatString::Arg_String)
|
||||||
|
#else // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
wxDISABLED_FORMAT_STRING_SPECIFIER(char*)
|
||||||
|
wxDISABLED_FORMAT_STRING_SPECIFIER(unsigned char*)
|
||||||
|
wxDISABLED_FORMAT_STRING_SPECIFIER(signed char*)
|
||||||
|
wxDISABLED_FORMAT_STRING_SPECIFIER(const char*)
|
||||||
|
wxDISABLED_FORMAT_STRING_SPECIFIER(const unsigned char*)
|
||||||
|
wxDISABLED_FORMAT_STRING_SPECIFIER(const signed char*)
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxFORMAT_STRING_SPECIFIER(wchar_t*, wxFormatString::Arg_String)
|
wxFORMAT_STRING_SPECIFIER(wchar_t*, wxFormatString::Arg_String)
|
||||||
wxFORMAT_STRING_SPECIFIER(const wchar_t*, wxFormatString::Arg_String)
|
wxFORMAT_STRING_SPECIFIER(const wchar_t*, wxFormatString::Arg_String)
|
||||||
|
|
||||||
@@ -430,6 +460,7 @@ wxFORMAT_STRING_SPECIFIER(std::nullptr_t, wxFormatString::Arg_Pointer)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef wxFORMAT_STRING_SPECIFIER
|
#undef wxFORMAT_STRING_SPECIFIER
|
||||||
|
#undef wxDISABLED_FORMAT_STRING_SPECIFIER
|
||||||
|
|
||||||
|
|
||||||
// Converts an argument passed to wxPrint etc. into standard form expected,
|
// Converts an argument passed to wxPrint etc. into standard form expected,
|
||||||
@@ -571,6 +602,7 @@ struct WXDLLIMPEXP_BASE wxArgNormalizerWchar<const wxCStrData&>
|
|||||||
// char* for wchar_t Unicode build or UTF8):
|
// char* for wchar_t Unicode build or UTF8):
|
||||||
#if wxUSE_UNICODE_WCHAR
|
#if wxUSE_UNICODE_WCHAR
|
||||||
|
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
template<>
|
template<>
|
||||||
struct wxArgNormalizerWchar<const char*>
|
struct wxArgNormalizerWchar<const char*>
|
||||||
: public wxArgNormalizerWithBuffer<wchar_t>
|
: public wxArgNormalizerWithBuffer<wchar_t>
|
||||||
@@ -579,6 +611,7 @@ struct wxArgNormalizerWchar<const char*>
|
|||||||
const wxFormatString *fmt, unsigned index)
|
const wxFormatString *fmt, unsigned index)
|
||||||
: wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {}
|
: wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {}
|
||||||
};
|
};
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
#elif wxUSE_UNICODE_UTF8
|
#elif wxUSE_UNICODE_UTF8
|
||||||
|
|
||||||
@@ -591,6 +624,7 @@ struct wxArgNormalizerUtf8<const wchar_t*>
|
|||||||
: wxArgNormalizerWithBuffer<char>(wxConvUTF8.cWC2MB(s), fmt, index) {}
|
: wxArgNormalizerWithBuffer<char>(wxConvUTF8.cWC2MB(s), fmt, index) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
template<>
|
template<>
|
||||||
struct wxArgNormalizerUtf8<const char*>
|
struct wxArgNormalizerUtf8<const char*>
|
||||||
: public wxArgNormalizerWithBuffer<char>
|
: public wxArgNormalizerWithBuffer<char>
|
||||||
@@ -616,9 +650,10 @@ struct wxArgNormalizerUtf8<const char*>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
// UTF-8 build needs conversion to wchar_t* too:
|
// UTF-8 build needs conversion to wchar_t* too:
|
||||||
#if !wxUSE_UTF8_LOCALE_ONLY
|
#if !wxUSE_UTF8_LOCALE_ONLY && !defined wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
template<>
|
template<>
|
||||||
struct wxArgNormalizerWchar<const char*>
|
struct wxArgNormalizerWchar<const char*>
|
||||||
: public wxArgNormalizerWithBuffer<wchar_t>
|
: public wxArgNormalizerWithBuffer<wchar_t>
|
||||||
@@ -627,10 +662,11 @@ struct wxArgNormalizerWchar<const char*>
|
|||||||
const wxFormatString *fmt, unsigned index)
|
const wxFormatString *fmt, unsigned index)
|
||||||
: wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {}
|
: wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {}
|
||||||
};
|
};
|
||||||
#endif // !wxUSE_UTF8_LOCALE_ONLY
|
#endif // !wxUSE_UTF8_LOCALE_ONLY && !defined wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
#else // ANSI - FIXME-UTF8
|
#else // ANSI - FIXME-UTF8
|
||||||
|
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
template<>
|
template<>
|
||||||
struct wxArgNormalizerWchar<const wchar_t*>
|
struct wxArgNormalizerWchar<const wchar_t*>
|
||||||
: public wxArgNormalizerWithBuffer<char>
|
: public wxArgNormalizerWithBuffer<char>
|
||||||
@@ -639,10 +675,56 @@ struct wxArgNormalizerWchar<const wchar_t*>
|
|||||||
const wxFormatString *fmt, unsigned index)
|
const wxFormatString *fmt, unsigned index)
|
||||||
: wxArgNormalizerWithBuffer<char>(wxConvLibc.cWC2MB(s), fmt, index) {}
|
: wxArgNormalizerWithBuffer<char>(wxConvLibc.cWC2MB(s), fmt, index) {}
|
||||||
};
|
};
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
#endif // wxUSE_UNICODE_WCHAR/wxUSE_UNICODE_UTF8/ANSI
|
#endif // wxUSE_UNICODE_WCHAR/wxUSE_UNICODE_UTF8/ANSI
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
// wxArgNormalizer specializations that cannot be instanced
|
||||||
|
template<>
|
||||||
|
struct wxArgNormalizer<const char*> {
|
||||||
|
private:
|
||||||
|
wxArgNormalizer<const char*>(const char*, const wxFormatString *,
|
||||||
|
unsigned);
|
||||||
|
const char *get() const;
|
||||||
|
};
|
||||||
|
template<>
|
||||||
|
struct wxArgNormalizer<char*> {
|
||||||
|
private:
|
||||||
|
wxArgNormalizer<char*>(const char*, const wxFormatString *, unsigned);
|
||||||
|
char *get() const;
|
||||||
|
};
|
||||||
|
template<>
|
||||||
|
struct wxArgNormalizer<const std::string> {
|
||||||
|
private:
|
||||||
|
wxArgNormalizer<const std::string>(const std::string&,
|
||||||
|
const wxFormatString *, unsigned);
|
||||||
|
std::string get() const;
|
||||||
|
};
|
||||||
|
template<>
|
||||||
|
struct wxArgNormalizer<std::string> {
|
||||||
|
private:
|
||||||
|
wxArgNormalizer<std::string>(std::string&,
|
||||||
|
const wxFormatString *, unsigned);
|
||||||
|
std::string get() const;
|
||||||
|
};
|
||||||
|
template<>
|
||||||
|
struct wxArgNormalizer<wxCharBuffer> {
|
||||||
|
private:
|
||||||
|
wxArgNormalizer<wxCharBuffer>(wxCharBuffer&,
|
||||||
|
const wxFormatString *, unsigned);
|
||||||
|
std::string get() const;
|
||||||
|
};
|
||||||
|
template<>
|
||||||
|
struct wxArgNormalizer<wxScopedCharBuffer> {
|
||||||
|
private:
|
||||||
|
wxArgNormalizer<wxScopedCharBuffer>(wxScopedCharBuffer&,
|
||||||
|
const wxFormatString *, unsigned);
|
||||||
|
std::string get() const;
|
||||||
|
};
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
// this macro is used to implement specialization that are exactly same as
|
// this macro is used to implement specialization that are exactly same as
|
||||||
// some other specialization, i.e. to "forward" the implementation (e.g. for
|
// some other specialization, i.e. to "forward" the implementation (e.g. for
|
||||||
// T=wxString and T=const wxString&). Note that the ctor takes BaseT argument,
|
// T=wxString and T=const wxString&). Note that the ctor takes BaseT argument,
|
||||||
@@ -675,16 +757,22 @@ WX_ARG_NORMALIZER_FORWARD(wxString, const wxString&);
|
|||||||
WX_ARG_NORMALIZER_FORWARD(wxCStrData, const wxCStrData&);
|
WX_ARG_NORMALIZER_FORWARD(wxCStrData, const wxCStrData&);
|
||||||
|
|
||||||
// versions for passing non-const pointers:
|
// versions for passing non-const pointers:
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
WX_ARG_NORMALIZER_FORWARD(char*, const char*);
|
WX_ARG_NORMALIZER_FORWARD(char*, const char*);
|
||||||
|
#endif
|
||||||
WX_ARG_NORMALIZER_FORWARD(wchar_t*, const wchar_t*);
|
WX_ARG_NORMALIZER_FORWARD(wchar_t*, const wchar_t*);
|
||||||
|
|
||||||
// versions for passing wx[W]CharBuffer:
|
// versions for passing wx[W]CharBuffer:
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
WX_ARG_NORMALIZER_FORWARD(wxScopedCharBuffer, const char*);
|
WX_ARG_NORMALIZER_FORWARD(wxScopedCharBuffer, const char*);
|
||||||
WX_ARG_NORMALIZER_FORWARD(const wxScopedCharBuffer&, const char*);
|
WX_ARG_NORMALIZER_FORWARD(const wxScopedCharBuffer&, const char*);
|
||||||
|
#endif
|
||||||
WX_ARG_NORMALIZER_FORWARD(wxScopedWCharBuffer, const wchar_t*);
|
WX_ARG_NORMALIZER_FORWARD(wxScopedWCharBuffer, const wchar_t*);
|
||||||
WX_ARG_NORMALIZER_FORWARD(const wxScopedWCharBuffer&, const wchar_t*);
|
WX_ARG_NORMALIZER_FORWARD(const wxScopedWCharBuffer&, const wchar_t*);
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
WX_ARG_NORMALIZER_FORWARD(wxCharBuffer, const char*);
|
WX_ARG_NORMALIZER_FORWARD(wxCharBuffer, const char*);
|
||||||
WX_ARG_NORMALIZER_FORWARD(const wxCharBuffer&, const char*);
|
WX_ARG_NORMALIZER_FORWARD(const wxCharBuffer&, const char*);
|
||||||
|
#endif
|
||||||
WX_ARG_NORMALIZER_FORWARD(wxWCharBuffer, const wchar_t*);
|
WX_ARG_NORMALIZER_FORWARD(wxWCharBuffer, const wchar_t*);
|
||||||
WX_ARG_NORMALIZER_FORWARD(const wxWCharBuffer&, const wchar_t*);
|
WX_ARG_NORMALIZER_FORWARD(const wxWCharBuffer&, const wchar_t*);
|
||||||
|
|
||||||
@@ -694,6 +782,7 @@ WX_ARG_NORMALIZER_FORWARD(const wxWCharBuffer&, const wchar_t*);
|
|||||||
#include "wx/stringimpl.h"
|
#include "wx/stringimpl.h"
|
||||||
|
|
||||||
#if !wxUSE_UTF8_LOCALE_ONLY
|
#if !wxUSE_UTF8_LOCALE_ONLY
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
template<>
|
template<>
|
||||||
struct wxArgNormalizerWchar<const std::string&>
|
struct wxArgNormalizerWchar<const std::string&>
|
||||||
: public wxArgNormalizerWchar<const char*>
|
: public wxArgNormalizerWchar<const char*>
|
||||||
@@ -702,6 +791,7 @@ struct wxArgNormalizerWchar<const std::string&>
|
|||||||
const wxFormatString *fmt, unsigned index)
|
const wxFormatString *fmt, unsigned index)
|
||||||
: wxArgNormalizerWchar<const char*>(s.c_str(), fmt, index) {}
|
: wxArgNormalizerWchar<const char*>(s.c_str(), fmt, index) {}
|
||||||
};
|
};
|
||||||
|
#endif // NO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct wxArgNormalizerWchar<const wxStdWideString&>
|
struct wxArgNormalizerWchar<const wxStdWideString&>
|
||||||
@@ -714,6 +804,7 @@ struct wxArgNormalizerWchar<const wxStdWideString&>
|
|||||||
#endif // !wxUSE_UTF8_LOCALE_ONLY
|
#endif // !wxUSE_UTF8_LOCALE_ONLY
|
||||||
|
|
||||||
#if wxUSE_UNICODE_UTF8
|
#if wxUSE_UNICODE_UTF8
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
template<>
|
template<>
|
||||||
struct wxArgNormalizerUtf8<const std::string&>
|
struct wxArgNormalizerUtf8<const std::string&>
|
||||||
: public wxArgNormalizerUtf8<const char*>
|
: public wxArgNormalizerUtf8<const char*>
|
||||||
@@ -722,6 +813,7 @@ struct wxArgNormalizerUtf8<const std::string&>
|
|||||||
const wxFormatString *fmt, unsigned index)
|
const wxFormatString *fmt, unsigned index)
|
||||||
: wxArgNormalizerUtf8<const char*>(s.c_str(), fmt, index) {}
|
: wxArgNormalizerUtf8<const char*>(s.c_str(), fmt, index) {}
|
||||||
};
|
};
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct wxArgNormalizerUtf8<const wxStdWideString&>
|
struct wxArgNormalizerUtf8<const wxStdWideString&>
|
||||||
@@ -733,7 +825,9 @@ struct wxArgNormalizerUtf8<const wxStdWideString&>
|
|||||||
};
|
};
|
||||||
#endif // wxUSE_UNICODE_UTF8
|
#endif // wxUSE_UNICODE_UTF8
|
||||||
|
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
WX_ARG_NORMALIZER_FORWARD(std::string, const std::string&);
|
WX_ARG_NORMALIZER_FORWARD(std::string, const std::string&);
|
||||||
|
#endif
|
||||||
WX_ARG_NORMALIZER_FORWARD(wxStdWideString, const wxStdWideString&);
|
WX_ARG_NORMALIZER_FORWARD(wxStdWideString, const wxStdWideString&);
|
||||||
|
|
||||||
#endif // wxUSE_STD_STRING
|
#endif // wxUSE_STD_STRING
|
||||||
|
@@ -216,8 +216,10 @@ public:
|
|||||||
wxVariant& operator=(const wxString& value);
|
wxVariant& operator=(const wxString& value);
|
||||||
// these overloads are necessary to prevent the compiler from using bool
|
// these overloads are necessary to prevent the compiler from using bool
|
||||||
// version instead of wxString one:
|
// version instead of wxString one:
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxVariant& operator=(const char* value)
|
wxVariant& operator=(const char* value)
|
||||||
{ return *this = wxString(value); }
|
{ return *this = wxString(value); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxVariant& operator=(const wchar_t* value)
|
wxVariant& operator=(const wchar_t* value)
|
||||||
{ return *this = wxString(value); }
|
{ return *this = wxString(value); }
|
||||||
wxVariant& operator=(const wxCStrData& value)
|
wxVariant& operator=(const wxCStrData& value)
|
||||||
@@ -230,6 +232,7 @@ public:
|
|||||||
wxString GetString() const;
|
wxString GetString() const;
|
||||||
|
|
||||||
#if wxUSE_STD_STRING
|
#if wxUSE_STD_STRING
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
wxVariant(const std::string& val, const wxString& name = wxEmptyString);
|
wxVariant(const std::string& val, const wxString& name = wxEmptyString);
|
||||||
bool operator==(const std::string& value) const
|
bool operator==(const std::string& value) const
|
||||||
{ return operator==(wxString(value)); }
|
{ return operator==(wxString(value)); }
|
||||||
@@ -238,6 +241,7 @@ public:
|
|||||||
wxVariant& operator=(const std::string& value)
|
wxVariant& operator=(const std::string& value)
|
||||||
{ return operator=(wxString(value)); }
|
{ return operator=(wxString(value)); }
|
||||||
operator std::string() const { return (operator wxString()).ToStdString(); }
|
operator std::string() const { return (operator wxString()).ToStdString(); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
wxVariant(const wxStdWideString& val, const wxString& name = wxEmptyString);
|
wxVariant(const wxStdWideString& val, const wxString& name = wxEmptyString);
|
||||||
bool operator==(const wxStdWideString& value) const
|
bool operator==(const wxStdWideString& value) const
|
||||||
|
@@ -149,10 +149,12 @@ inline char* wxTmemset(char* szOut, char cIn, size_t len)
|
|||||||
WXDLLIMPEXP_BASE char* wxSetlocale(int category, const char *locale);
|
WXDLLIMPEXP_BASE char* wxSetlocale(int category, const char *locale);
|
||||||
inline char* wxSetlocale(int category, const wxScopedCharBuffer& locale)
|
inline char* wxSetlocale(int category, const wxScopedCharBuffer& locale)
|
||||||
{ return wxSetlocale(category, locale.data()); }
|
{ return wxSetlocale(category, locale.data()); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char* wxSetlocale(int category, const wxString& locale)
|
inline char* wxSetlocale(int category, const wxString& locale)
|
||||||
{ return wxSetlocale(category, locale.mb_str()); }
|
{ return wxSetlocale(category, locale.mb_str()); }
|
||||||
inline char* wxSetlocale(int category, const wxCStrData& locale)
|
inline char* wxSetlocale(int category, const wxCStrData& locale)
|
||||||
{ return wxSetlocale(category, locale.AsCharBuf()); }
|
{ return wxSetlocale(category, locale.AsCharBuf()); }
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// string functions
|
// string functions
|
||||||
@@ -202,17 +204,21 @@ inline size_t wxStrnlen(const wchar_t *str, size_t maxlen)
|
|||||||
// inline wchar_t* wxStrdup(const wchar_t *s) { return wxStrdupW(s); }
|
// inline wchar_t* wxStrdup(const wchar_t *s) { return wxStrdupW(s); }
|
||||||
inline char* wxStrdup(const wxScopedCharBuffer& s) { return wxStrdup(s.data()); }
|
inline char* wxStrdup(const wxScopedCharBuffer& s) { return wxStrdup(s.data()); }
|
||||||
inline wchar_t* wxStrdup(const wxScopedWCharBuffer& s) { return wxStrdup(s.data()); }
|
inline wchar_t* wxStrdup(const wxScopedWCharBuffer& s) { return wxStrdup(s.data()); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char* wxStrdup(const wxString& s) { return wxStrdup(s.mb_str()); }
|
inline char* wxStrdup(const wxString& s) { return wxStrdup(s.mb_str()); }
|
||||||
inline char* wxStrdup(const wxCStrData& s) { return wxStrdup(s.AsCharBuf()); }
|
inline char* wxStrdup(const wxCStrData& s) { return wxStrdup(s.AsCharBuf()); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
inline char *wxStrcpy(char *dest, const char *src)
|
inline char *wxStrcpy(char *dest, const char *src)
|
||||||
{ return wxCRT_StrcpyA(dest, src); }
|
{ return wxCRT_StrcpyA(dest, src); }
|
||||||
inline wchar_t *wxStrcpy(wchar_t *dest, const wchar_t *src)
|
inline wchar_t *wxStrcpy(wchar_t *dest, const wchar_t *src)
|
||||||
{ return wxCRT_StrcpyW(dest, src); }
|
{ return wxCRT_StrcpyW(dest, src); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrcpy(char *dest, const wxString& src)
|
inline char *wxStrcpy(char *dest, const wxString& src)
|
||||||
{ return wxCRT_StrcpyA(dest, src.mb_str()); }
|
{ return wxCRT_StrcpyA(dest, src.mb_str()); }
|
||||||
inline char *wxStrcpy(char *dest, const wxCStrData& src)
|
inline char *wxStrcpy(char *dest, const wxCStrData& src)
|
||||||
{ return wxCRT_StrcpyA(dest, src.AsCharBuf()); }
|
{ return wxCRT_StrcpyA(dest, src.AsCharBuf()); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrcpy(char *dest, const wxScopedCharBuffer& src)
|
inline char *wxStrcpy(char *dest, const wxScopedCharBuffer& src)
|
||||||
{ return wxCRT_StrcpyA(dest, src.data()); }
|
{ return wxCRT_StrcpyA(dest, src.data()); }
|
||||||
inline wchar_t *wxStrcpy(wchar_t *dest, const wxString& src)
|
inline wchar_t *wxStrcpy(wchar_t *dest, const wxString& src)
|
||||||
@@ -221,19 +227,23 @@ inline wchar_t *wxStrcpy(wchar_t *dest, const wxCStrData& src)
|
|||||||
{ return wxCRT_StrcpyW(dest, src.AsWCharBuf()); }
|
{ return wxCRT_StrcpyW(dest, src.AsWCharBuf()); }
|
||||||
inline wchar_t *wxStrcpy(wchar_t *dest, const wxScopedWCharBuffer& src)
|
inline wchar_t *wxStrcpy(wchar_t *dest, const wxScopedWCharBuffer& src)
|
||||||
{ return wxCRT_StrcpyW(dest, src.data()); }
|
{ return wxCRT_StrcpyW(dest, src.data()); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrcpy(char *dest, const wchar_t *src)
|
inline char *wxStrcpy(char *dest, const wchar_t *src)
|
||||||
{ return wxCRT_StrcpyA(dest, wxConvLibc.cWC2MB(src)); }
|
{ return wxCRT_StrcpyA(dest, wxConvLibc.cWC2MB(src)); }
|
||||||
inline wchar_t *wxStrcpy(wchar_t *dest, const char *src)
|
inline wchar_t *wxStrcpy(wchar_t *dest, const char *src)
|
||||||
{ return wxCRT_StrcpyW(dest, wxConvLibc.cMB2WC(src)); }
|
{ return wxCRT_StrcpyW(dest, wxConvLibc.cMB2WC(src)); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
inline char *wxStrncpy(char *dest, const char *src, size_t n)
|
inline char *wxStrncpy(char *dest, const char *src, size_t n)
|
||||||
{ return wxCRT_StrncpyA(dest, src, n); }
|
{ return wxCRT_StrncpyA(dest, src, n); }
|
||||||
inline wchar_t *wxStrncpy(wchar_t *dest, const wchar_t *src, size_t n)
|
inline wchar_t *wxStrncpy(wchar_t *dest, const wchar_t *src, size_t n)
|
||||||
{ return wxCRT_StrncpyW(dest, src, n); }
|
{ return wxCRT_StrncpyW(dest, src, n); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrncpy(char *dest, const wxString& src, size_t n)
|
inline char *wxStrncpy(char *dest, const wxString& src, size_t n)
|
||||||
{ return wxCRT_StrncpyA(dest, src.mb_str(), n); }
|
{ return wxCRT_StrncpyA(dest, src.mb_str(), n); }
|
||||||
inline char *wxStrncpy(char *dest, const wxCStrData& src, size_t n)
|
inline char *wxStrncpy(char *dest, const wxCStrData& src, size_t n)
|
||||||
{ return wxCRT_StrncpyA(dest, src.AsCharBuf(), n); }
|
{ return wxCRT_StrncpyA(dest, src.AsCharBuf(), n); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrncpy(char *dest, const wxScopedCharBuffer& src, size_t n)
|
inline char *wxStrncpy(char *dest, const wxScopedCharBuffer& src, size_t n)
|
||||||
{ return wxCRT_StrncpyA(dest, src.data(), n); }
|
{ return wxCRT_StrncpyA(dest, src.data(), n); }
|
||||||
inline wchar_t *wxStrncpy(wchar_t *dest, const wxString& src, size_t n)
|
inline wchar_t *wxStrncpy(wchar_t *dest, const wxString& src, size_t n)
|
||||||
@@ -242,10 +252,12 @@ inline wchar_t *wxStrncpy(wchar_t *dest, const wxCStrData& src, size_t n)
|
|||||||
{ return wxCRT_StrncpyW(dest, src.AsWCharBuf(), n); }
|
{ return wxCRT_StrncpyW(dest, src.AsWCharBuf(), n); }
|
||||||
inline wchar_t *wxStrncpy(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n)
|
inline wchar_t *wxStrncpy(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n)
|
||||||
{ return wxCRT_StrncpyW(dest, src.data(), n); }
|
{ return wxCRT_StrncpyW(dest, src.data(), n); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrncpy(char *dest, const wchar_t *src, size_t n)
|
inline char *wxStrncpy(char *dest, const wchar_t *src, size_t n)
|
||||||
{ return wxCRT_StrncpyA(dest, wxConvLibc.cWC2MB(src), n); }
|
{ return wxCRT_StrncpyA(dest, wxConvLibc.cWC2MB(src), n); }
|
||||||
inline wchar_t *wxStrncpy(wchar_t *dest, const char *src, size_t n)
|
inline wchar_t *wxStrncpy(wchar_t *dest, const char *src, size_t n)
|
||||||
{ return wxCRT_StrncpyW(dest, wxConvLibc.cMB2WC(src), n); }
|
{ return wxCRT_StrncpyW(dest, wxConvLibc.cMB2WC(src), n); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
// this is a function new in 2.9 so we don't care about backwards compatibility and
|
// this is a function new in 2.9 so we don't care about backwards compatibility and
|
||||||
// so don't need to support wchar_t/char overloads
|
// so don't need to support wchar_t/char overloads
|
||||||
@@ -281,10 +293,12 @@ inline char *wxStrcat(char *dest, const char *src)
|
|||||||
{ return wxCRT_StrcatA(dest, src); }
|
{ return wxCRT_StrcatA(dest, src); }
|
||||||
inline wchar_t *wxStrcat(wchar_t *dest, const wchar_t *src)
|
inline wchar_t *wxStrcat(wchar_t *dest, const wchar_t *src)
|
||||||
{ return wxCRT_StrcatW(dest, src); }
|
{ return wxCRT_StrcatW(dest, src); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrcat(char *dest, const wxString& src)
|
inline char *wxStrcat(char *dest, const wxString& src)
|
||||||
{ return wxCRT_StrcatA(dest, src.mb_str()); }
|
{ return wxCRT_StrcatA(dest, src.mb_str()); }
|
||||||
inline char *wxStrcat(char *dest, const wxCStrData& src)
|
inline char *wxStrcat(char *dest, const wxCStrData& src)
|
||||||
{ return wxCRT_StrcatA(dest, src.AsCharBuf()); }
|
{ return wxCRT_StrcatA(dest, src.AsCharBuf()); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrcat(char *dest, const wxScopedCharBuffer& src)
|
inline char *wxStrcat(char *dest, const wxScopedCharBuffer& src)
|
||||||
{ return wxCRT_StrcatA(dest, src.data()); }
|
{ return wxCRT_StrcatA(dest, src.data()); }
|
||||||
inline wchar_t *wxStrcat(wchar_t *dest, const wxString& src)
|
inline wchar_t *wxStrcat(wchar_t *dest, const wxString& src)
|
||||||
@@ -293,19 +307,23 @@ inline wchar_t *wxStrcat(wchar_t *dest, const wxCStrData& src)
|
|||||||
{ return wxCRT_StrcatW(dest, src.AsWCharBuf()); }
|
{ return wxCRT_StrcatW(dest, src.AsWCharBuf()); }
|
||||||
inline wchar_t *wxStrcat(wchar_t *dest, const wxScopedWCharBuffer& src)
|
inline wchar_t *wxStrcat(wchar_t *dest, const wxScopedWCharBuffer& src)
|
||||||
{ return wxCRT_StrcatW(dest, src.data()); }
|
{ return wxCRT_StrcatW(dest, src.data()); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrcat(char *dest, const wchar_t *src)
|
inline char *wxStrcat(char *dest, const wchar_t *src)
|
||||||
{ return wxCRT_StrcatA(dest, wxConvLibc.cWC2MB(src)); }
|
{ return wxCRT_StrcatA(dest, wxConvLibc.cWC2MB(src)); }
|
||||||
inline wchar_t *wxStrcat(wchar_t *dest, const char *src)
|
inline wchar_t *wxStrcat(wchar_t *dest, const char *src)
|
||||||
{ return wxCRT_StrcatW(dest, wxConvLibc.cMB2WC(src)); }
|
{ return wxCRT_StrcatW(dest, wxConvLibc.cMB2WC(src)); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
inline char *wxStrncat(char *dest, const char *src, size_t n)
|
inline char *wxStrncat(char *dest, const char *src, size_t n)
|
||||||
{ return wxCRT_StrncatA(dest, src, n); }
|
{ return wxCRT_StrncatA(dest, src, n); }
|
||||||
inline wchar_t *wxStrncat(wchar_t *dest, const wchar_t *src, size_t n)
|
inline wchar_t *wxStrncat(wchar_t *dest, const wchar_t *src, size_t n)
|
||||||
{ return wxCRT_StrncatW(dest, src, n); }
|
{ return wxCRT_StrncatW(dest, src, n); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrncat(char *dest, const wxString& src, size_t n)
|
inline char *wxStrncat(char *dest, const wxString& src, size_t n)
|
||||||
{ return wxCRT_StrncatA(dest, src.mb_str(), n); }
|
{ return wxCRT_StrncatA(dest, src.mb_str(), n); }
|
||||||
inline char *wxStrncat(char *dest, const wxCStrData& src, size_t n)
|
inline char *wxStrncat(char *dest, const wxCStrData& src, size_t n)
|
||||||
{ return wxCRT_StrncatA(dest, src.AsCharBuf(), n); }
|
{ return wxCRT_StrncatA(dest, src.AsCharBuf(), n); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrncat(char *dest, const wxScopedCharBuffer& src, size_t n)
|
inline char *wxStrncat(char *dest, const wxScopedCharBuffer& src, size_t n)
|
||||||
{ return wxCRT_StrncatA(dest, src.data(), n); }
|
{ return wxCRT_StrncatA(dest, src.data(), n); }
|
||||||
inline wchar_t *wxStrncat(wchar_t *dest, const wxString& src, size_t n)
|
inline wchar_t *wxStrncat(wchar_t *dest, const wxString& src, size_t n)
|
||||||
@@ -314,10 +332,12 @@ inline wchar_t *wxStrncat(wchar_t *dest, const wxCStrData& src, size_t n)
|
|||||||
{ return wxCRT_StrncatW(dest, src.AsWCharBuf(), n); }
|
{ return wxCRT_StrncatW(dest, src.AsWCharBuf(), n); }
|
||||||
inline wchar_t *wxStrncat(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n)
|
inline wchar_t *wxStrncat(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n)
|
||||||
{ return wxCRT_StrncatW(dest, src.data(), n); }
|
{ return wxCRT_StrncatW(dest, src.data(), n); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrncat(char *dest, const wchar_t *src, size_t n)
|
inline char *wxStrncat(char *dest, const wchar_t *src, size_t n)
|
||||||
{ return wxCRT_StrncatA(dest, wxConvLibc.cWC2MB(src), n); }
|
{ return wxCRT_StrncatA(dest, wxConvLibc.cWC2MB(src), n); }
|
||||||
inline wchar_t *wxStrncat(wchar_t *dest, const char *src, size_t n)
|
inline wchar_t *wxStrncat(wchar_t *dest, const char *src, size_t n)
|
||||||
{ return wxCRT_StrncatW(dest, wxConvLibc.cMB2WC(src), n); }
|
{ return wxCRT_StrncatW(dest, wxConvLibc.cMB2WC(src), n); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
|
|
||||||
#define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2)
|
#define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2)
|
||||||
@@ -333,6 +353,7 @@ inline wchar_t *wxStrncat(wchar_t *dest, const char *src, size_t n)
|
|||||||
// forString - function to call when the *first* argument is wxString;
|
// forString - function to call when the *first* argument is wxString;
|
||||||
// the second argument can be any string type, so this is
|
// the second argument can be any string type, so this is
|
||||||
// typically a template
|
// typically a template
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
#define WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \
|
#define WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \
|
||||||
inline rettype WX_STR_DECL(name, const char *, const char *) \
|
inline rettype WX_STR_DECL(name, const char *, const char *) \
|
||||||
{ return WX_STR_CALL(crtA, s1, s2); } \
|
{ return WX_STR_CALL(crtA, s1, s2); } \
|
||||||
@@ -395,9 +416,48 @@ inline wchar_t *wxStrncat(wchar_t *dest, const char *src, size_t n)
|
|||||||
{ return WX_STR_CALL(forString, s1.AsString(), s2); } \
|
{ return WX_STR_CALL(forString, s1.AsString(), s2); } \
|
||||||
inline rettype WX_STR_DECL(name, const wxCStrData&, const wxCStrData&) \
|
inline rettype WX_STR_DECL(name, const wxCStrData&, const wxCStrData&) \
|
||||||
{ return WX_STR_CALL(forString, s1.AsString(), s2); }
|
{ return WX_STR_CALL(forString, s1.AsString(), s2); }
|
||||||
|
#else // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
#define WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \
|
||||||
|
inline rettype WX_STR_DECL(name, const char *, const char *) \
|
||||||
|
{ return WX_STR_CALL(crtA, s1, s2); } \
|
||||||
|
\
|
||||||
|
inline rettype WX_STR_DECL(name, const wchar_t *, const wchar_t *) \
|
||||||
|
{ return WX_STR_CALL(crtW, s1, s2); } \
|
||||||
|
inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedWCharBuffer&) \
|
||||||
|
{ return WX_STR_CALL(crtW, s1, s2.data()); } \
|
||||||
|
\
|
||||||
|
inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const char *) \
|
||||||
|
{ return WX_STR_CALL(crtA, s1.data(), s2); } \
|
||||||
|
inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedCharBuffer&)\
|
||||||
|
{ return WX_STR_CALL(crtA, s1.data(), s2.data()); } \
|
||||||
|
\
|
||||||
|
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wchar_t *) \
|
||||||
|
{ return WX_STR_CALL(crtW, s1.data(), s2); } \
|
||||||
|
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedWCharBuffer&) \
|
||||||
|
{ return WX_STR_CALL(crtW, s1.data(), s2.data()); } \
|
||||||
|
\
|
||||||
|
inline rettype WX_STR_DECL(name, const wxString&, const wchar_t*) \
|
||||||
|
{ return WX_STR_CALL(forString, s1, s2); } \
|
||||||
|
inline rettype WX_STR_DECL(name, const wxString&, const wxScopedWCharBuffer&) \
|
||||||
|
{ return WX_STR_CALL(forString, s1, s2); } \
|
||||||
|
inline rettype WX_STR_DECL(name, const wxString&, const wxString&) \
|
||||||
|
{ return WX_STR_CALL(forString, s1, s2); } \
|
||||||
|
inline rettype WX_STR_DECL(name, const wxString&, const wxCStrData&) \
|
||||||
|
{ return WX_STR_CALL(forString, s1, s2); } \
|
||||||
|
\
|
||||||
|
inline rettype WX_STR_DECL(name, const wxCStrData&, const wchar_t*) \
|
||||||
|
{ return WX_STR_CALL(forString, s1.AsString(), s2); } \
|
||||||
|
inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedWCharBuffer&) \
|
||||||
|
{ return WX_STR_CALL(forString, s1.AsString(), s2); } \
|
||||||
|
inline rettype WX_STR_DECL(name, const wxCStrData&, const wxString&) \
|
||||||
|
{ return WX_STR_CALL(forString, s1.AsString(), s2); } \
|
||||||
|
inline rettype WX_STR_DECL(name, const wxCStrData&, const wxCStrData&) \
|
||||||
|
{ return WX_STR_CALL(forString, s1.AsString(), s2); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
// This defines strcmp-like function, i.e. one returning the result of
|
// This defines strcmp-like function, i.e. one returning the result of
|
||||||
// comparison; see WX_STR_FUNC_NO_INVERT for explanation of the arguments
|
// comparison; see WX_STR_FUNC_NO_INVERT for explanation of the arguments
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
#define WX_STRCMP_FUNC(name, crtA, crtW, forString) \
|
#define WX_STRCMP_FUNC(name, crtA, crtW, forString) \
|
||||||
WX_STR_FUNC_NO_INVERT(int, name, crtA, crtW, forString) \
|
WX_STR_FUNC_NO_INVERT(int, name, crtA, crtW, forString) \
|
||||||
\
|
\
|
||||||
@@ -420,11 +480,26 @@ inline wchar_t *wxStrncat(wchar_t *dest, const char *src, size_t n)
|
|||||||
{ return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \
|
{ return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \
|
||||||
inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \
|
inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \
|
||||||
{ return -WX_STR_CALL(forString, s2, s1.data()); }
|
{ return -WX_STR_CALL(forString, s2, s1.data()); }
|
||||||
|
#else // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
#define WX_STRCMP_FUNC(name, crtA, crtW, forString) \
|
||||||
|
WX_STR_FUNC_NO_INVERT(int, name, crtA, crtW, forString) \
|
||||||
|
\
|
||||||
|
inline int WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \
|
||||||
|
{ return -WX_STR_CALL(forString, s2.AsString(), s1); } \
|
||||||
|
inline int WX_STR_DECL(name, const wchar_t *, const wxString&) \
|
||||||
|
{ return -WX_STR_CALL(forString, s2, s1); } \
|
||||||
|
\
|
||||||
|
inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \
|
||||||
|
{ return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \
|
||||||
|
inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \
|
||||||
|
{ return -WX_STR_CALL(forString, s2, s1.data()); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
|
|
||||||
// This defines a string function that is *not* strcmp-like, i.e. doesn't
|
// This defines a string function that is *not* strcmp-like, i.e. doesn't
|
||||||
// return the result of comparison and so if the second argument is a string,
|
// return the result of comparison and so if the second argument is a string,
|
||||||
// it has to be converted to char* or wchar_t*
|
// it has to be converted to char* or wchar_t*
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
#define WX_STR_FUNC(rettype, name, crtA, crtW, forString) \
|
#define WX_STR_FUNC(rettype, name, crtA, crtW, forString) \
|
||||||
WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \
|
WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \
|
||||||
\
|
\
|
||||||
@@ -447,6 +522,20 @@ inline wchar_t *wxStrncat(wchar_t *dest, const char *src, size_t n)
|
|||||||
{ return WX_STR_CALL(crtW, s1.data(), s2.AsWCharBuf()); } \
|
{ return WX_STR_CALL(crtW, s1.data(), s2.AsWCharBuf()); } \
|
||||||
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \
|
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \
|
||||||
{ return WX_STR_CALL(crtW, s1.data(), s2.wc_str()); }
|
{ return WX_STR_CALL(crtW, s1.data(), s2.wc_str()); }
|
||||||
|
#else // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
#define WX_STR_FUNC(rettype, name, crtA, crtW, forString) \
|
||||||
|
WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \
|
||||||
|
\
|
||||||
|
inline rettype WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \
|
||||||
|
{ return WX_STR_CALL(crtW, s1, s2.AsWCharBuf()); } \
|
||||||
|
inline rettype WX_STR_DECL(name, const wchar_t *, const wxString&) \
|
||||||
|
{ return WX_STR_CALL(crtW, s1, s2.wc_str()); } \
|
||||||
|
\
|
||||||
|
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \
|
||||||
|
{ return WX_STR_CALL(crtW, s1.data(), s2.AsWCharBuf()); } \
|
||||||
|
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \
|
||||||
|
{ return WX_STR_CALL(crtW, s1.data(), s2.wc_str()); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline int wxStrcmp_String(const wxString& s1, const T& s2)
|
inline int wxStrcmp_String(const wxString& s1, const T& s2)
|
||||||
@@ -526,12 +615,16 @@ inline size_t wxStrxfrm(wchar_t *dest, const wchar_t *src, size_t n)
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline size_t wxStrxfrm(T *dest, const wxScopedCharTypeBuffer<T>& src, size_t n)
|
inline size_t wxStrxfrm(T *dest, const wxScopedCharTypeBuffer<T>& src, size_t n)
|
||||||
{ return wxStrxfrm(dest, src.data(), n); }
|
{ return wxStrxfrm(dest, src.data(), n); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline size_t wxStrxfrm(char *dest, const wxString& src, size_t n)
|
inline size_t wxStrxfrm(char *dest, const wxString& src, size_t n)
|
||||||
{ return wxCRT_StrxfrmA(dest, src.mb_str(), n); }
|
{ return wxCRT_StrxfrmA(dest, src.mb_str(), n); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline size_t wxStrxfrm(wchar_t *dest, const wxString& src, size_t n)
|
inline size_t wxStrxfrm(wchar_t *dest, const wxString& src, size_t n)
|
||||||
{ return wxCRT_StrxfrmW(dest, src.wc_str(), n); }
|
{ return wxCRT_StrxfrmW(dest, src.wc_str(), n); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline size_t wxStrxfrm(char *dest, const wxCStrData& src, size_t n)
|
inline size_t wxStrxfrm(char *dest, const wxCStrData& src, size_t n)
|
||||||
{ return wxCRT_StrxfrmA(dest, src.AsCharBuf(), n); }
|
{ return wxCRT_StrxfrmA(dest, src.AsCharBuf(), n); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline size_t wxStrxfrm(wchar_t *dest, const wxCStrData& src, size_t n)
|
inline size_t wxStrxfrm(wchar_t *dest, const wxCStrData& src, size_t n)
|
||||||
{ return wxCRT_StrxfrmW(dest, src.AsWCharBuf(), n); }
|
{ return wxCRT_StrxfrmW(dest, src.AsWCharBuf(), n); }
|
||||||
|
|
||||||
@@ -544,12 +637,16 @@ inline wchar_t *wxStrtok(wchar_t *str, const wchar_t *delim, wchar_t **saveptr)
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline T *wxStrtok(T *str, const wxScopedCharTypeBuffer<T>& delim, T **saveptr)
|
inline T *wxStrtok(T *str, const wxScopedCharTypeBuffer<T>& delim, T **saveptr)
|
||||||
{ return wxStrtok(str, delim.data(), saveptr); }
|
{ return wxStrtok(str, delim.data(), saveptr); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrtok(char *str, const wxCStrData& delim, char **saveptr)
|
inline char *wxStrtok(char *str, const wxCStrData& delim, char **saveptr)
|
||||||
{ return wxCRT_StrtokA(str, delim.AsCharBuf(), saveptr); }
|
{ return wxCRT_StrtokA(str, delim.AsCharBuf(), saveptr); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline wchar_t *wxStrtok(wchar_t *str, const wxCStrData& delim, wchar_t **saveptr)
|
inline wchar_t *wxStrtok(wchar_t *str, const wxCStrData& delim, wchar_t **saveptr)
|
||||||
{ return wxCRT_StrtokW(str, delim.AsWCharBuf(), saveptr); }
|
{ return wxCRT_StrtokW(str, delim.AsWCharBuf(), saveptr); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char *wxStrtok(char *str, const wxString& delim, char **saveptr)
|
inline char *wxStrtok(char *str, const wxString& delim, char **saveptr)
|
||||||
{ return wxCRT_StrtokA(str, delim.mb_str(), saveptr); }
|
{ return wxCRT_StrtokA(str, delim.mb_str(), saveptr); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline wchar_t *wxStrtok(wchar_t *str, const wxString& delim, wchar_t **saveptr)
|
inline wchar_t *wxStrtok(wchar_t *str, const wxString& delim, wchar_t **saveptr)
|
||||||
{ return wxCRT_StrtokW(str, delim.wc_str(), saveptr); }
|
{ return wxCRT_StrtokW(str, delim.wc_str(), saveptr); }
|
||||||
|
|
||||||
@@ -557,23 +654,29 @@ inline const char *wxStrstr(const char *haystack, const char *needle)
|
|||||||
{ return wxCRT_StrstrA(haystack, needle); }
|
{ return wxCRT_StrstrA(haystack, needle); }
|
||||||
inline const wchar_t *wxStrstr(const wchar_t *haystack, const wchar_t *needle)
|
inline const wchar_t *wxStrstr(const wchar_t *haystack, const wchar_t *needle)
|
||||||
{ return wxCRT_StrstrW(haystack, needle); }
|
{ return wxCRT_StrstrW(haystack, needle); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const char *wxStrstr(const char *haystack, const wxString& needle)
|
inline const char *wxStrstr(const char *haystack, const wxString& needle)
|
||||||
{ return wxCRT_StrstrA(haystack, needle.mb_str()); }
|
{ return wxCRT_StrstrA(haystack, needle.mb_str()); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const wchar_t *wxStrstr(const wchar_t *haystack, const wxString& needle)
|
inline const wchar_t *wxStrstr(const wchar_t *haystack, const wxString& needle)
|
||||||
{ return wxCRT_StrstrW(haystack, needle.wc_str()); }
|
{ return wxCRT_StrstrW(haystack, needle.wc_str()); }
|
||||||
// these functions return char* pointer into the non-temporary conversion buffer
|
// these functions return char* pointer into the non-temporary conversion buffer
|
||||||
// used by c_str()'s implicit conversion to char*, for ANSI build compatibility
|
// used by c_str()'s implicit conversion to char*, for ANSI build compatibility
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const char *wxStrstr(const wxString& haystack, const wxString& needle)
|
inline const char *wxStrstr(const wxString& haystack, const wxString& needle)
|
||||||
{ return wxCRT_StrstrA(haystack.c_str(), needle.mb_str()); }
|
{ return wxCRT_StrstrA(haystack.c_str(), needle.mb_str()); }
|
||||||
inline const char *wxStrstr(const wxCStrData& haystack, const wxString& needle)
|
inline const char *wxStrstr(const wxCStrData& haystack, const wxString& needle)
|
||||||
{ return wxCRT_StrstrA(haystack, needle.mb_str()); }
|
{ return wxCRT_StrstrA(haystack, needle.mb_str()); }
|
||||||
inline const char *wxStrstr(const wxCStrData& haystack, const wxCStrData& needle)
|
inline const char *wxStrstr(const wxCStrData& haystack, const wxCStrData& needle)
|
||||||
{ return wxCRT_StrstrA(haystack, needle.AsCharBuf()); }
|
{ return wxCRT_StrstrA(haystack, needle.AsCharBuf()); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
// if 'needle' is char/wchar_t, then the same is probably wanted as return value
|
// if 'needle' is char/wchar_t, then the same is probably wanted as return value
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const char *wxStrstr(const wxString& haystack, const char *needle)
|
inline const char *wxStrstr(const wxString& haystack, const char *needle)
|
||||||
{ return wxCRT_StrstrA(haystack.c_str(), needle); }
|
{ return wxCRT_StrstrA(haystack.c_str(), needle); }
|
||||||
inline const char *wxStrstr(const wxCStrData& haystack, const char *needle)
|
inline const char *wxStrstr(const wxCStrData& haystack, const char *needle)
|
||||||
{ return wxCRT_StrstrA(haystack, needle); }
|
{ return wxCRT_StrstrA(haystack, needle); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const wchar_t *wxStrstr(const wxString& haystack, const wchar_t *needle)
|
inline const wchar_t *wxStrstr(const wxString& haystack, const wchar_t *needle)
|
||||||
{ return wxCRT_StrstrW(haystack.c_str(), needle); }
|
{ return wxCRT_StrstrW(haystack.c_str(), needle); }
|
||||||
inline const wchar_t *wxStrstr(const wxCStrData& haystack, const wchar_t *needle)
|
inline const wchar_t *wxStrstr(const wxCStrData& haystack, const wchar_t *needle)
|
||||||
@@ -623,6 +726,7 @@ inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniCharRef
|
|||||||
{ return wxStrrchr(s.data(), (T)c); }
|
{ return wxStrrchr(s.data(), (T)c); }
|
||||||
// these functions return char* pointer into the non-temporary conversion buffer
|
// these functions return char* pointer into the non-temporary conversion buffer
|
||||||
// used by c_str()'s implicit conversion to char*, for ANSI build compatibility
|
// used by c_str()'s implicit conversion to char*, for ANSI build compatibility
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const char* wxStrchr(const wxString& s, char c)
|
inline const char* wxStrchr(const wxString& s, char c)
|
||||||
{ return wxCRT_StrchrA((const char*)s.c_str(), c); }
|
{ return wxCRT_StrchrA((const char*)s.c_str(), c); }
|
||||||
inline const char* wxStrrchr(const wxString& s, char c)
|
inline const char* wxStrrchr(const wxString& s, char c)
|
||||||
@@ -639,10 +743,12 @@ inline const char* wxStrchr(const wxString& s, const wxUniCharRef& uc)
|
|||||||
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; }
|
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; }
|
||||||
inline const char* wxStrrchr(const wxString& s, const wxUniCharRef& uc)
|
inline const char* wxStrrchr(const wxString& s, const wxUniCharRef& uc)
|
||||||
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; }
|
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const wchar_t* wxStrchr(const wxString& s, wchar_t c)
|
inline const wchar_t* wxStrchr(const wxString& s, wchar_t c)
|
||||||
{ return wxCRT_StrchrW((const wchar_t*)s.c_str(), c); }
|
{ return wxCRT_StrchrW((const wchar_t*)s.c_str(), c); }
|
||||||
inline const wchar_t* wxStrrchr(const wxString& s, wchar_t c)
|
inline const wchar_t* wxStrrchr(const wxString& s, wchar_t c)
|
||||||
{ return wxCRT_StrrchrW((const wchar_t*)s.c_str(), c); }
|
{ return wxCRT_StrrchrW((const wchar_t*)s.c_str(), c); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const char* wxStrchr(const wxCStrData& s, char c)
|
inline const char* wxStrchr(const wxCStrData& s, char c)
|
||||||
{ return wxCRT_StrchrA(s.AsChar(), c); }
|
{ return wxCRT_StrchrA(s.AsChar(), c); }
|
||||||
inline const char* wxStrrchr(const wxCStrData& s, char c)
|
inline const char* wxStrrchr(const wxCStrData& s, char c)
|
||||||
@@ -659,6 +765,7 @@ inline const char* wxStrchr(const wxCStrData& s, const wxUniCharRef& uc)
|
|||||||
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
|
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
|
||||||
inline const char* wxStrrchr(const wxCStrData& s, const wxUniCharRef& uc)
|
inline const char* wxStrrchr(const wxCStrData& s, const wxUniCharRef& uc)
|
||||||
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
|
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const wchar_t* wxStrchr(const wxCStrData& s, wchar_t c)
|
inline const wchar_t* wxStrchr(const wxCStrData& s, wchar_t c)
|
||||||
{ return wxCRT_StrchrW(s.AsWChar(), c); }
|
{ return wxCRT_StrchrW(s.AsWChar(), c); }
|
||||||
inline const wchar_t* wxStrrchr(const wxCStrData& s, wchar_t c)
|
inline const wchar_t* wxStrrchr(const wxCStrData& s, wchar_t c)
|
||||||
@@ -668,30 +775,38 @@ inline const char *wxStrpbrk(const char *s, const char *accept)
|
|||||||
{ return wxCRT_StrpbrkA(s, accept); }
|
{ return wxCRT_StrpbrkA(s, accept); }
|
||||||
inline const wchar_t *wxStrpbrk(const wchar_t *s, const wchar_t *accept)
|
inline const wchar_t *wxStrpbrk(const wchar_t *s, const wchar_t *accept)
|
||||||
{ return wxCRT_StrpbrkW(s, accept); }
|
{ return wxCRT_StrpbrkW(s, accept); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const char *wxStrpbrk(const char *s, const wxString& accept)
|
inline const char *wxStrpbrk(const char *s, const wxString& accept)
|
||||||
{ return wxCRT_StrpbrkA(s, accept.mb_str()); }
|
{ return wxCRT_StrpbrkA(s, accept.mb_str()); }
|
||||||
inline const char *wxStrpbrk(const char *s, const wxCStrData& accept)
|
inline const char *wxStrpbrk(const char *s, const wxCStrData& accept)
|
||||||
{ return wxCRT_StrpbrkA(s, accept.AsCharBuf()); }
|
{ return wxCRT_StrpbrkA(s, accept.AsCharBuf()); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxString& accept)
|
inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxString& accept)
|
||||||
{ return wxCRT_StrpbrkW(s, accept.wc_str()); }
|
{ return wxCRT_StrpbrkW(s, accept.wc_str()); }
|
||||||
inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxCStrData& accept)
|
inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxCStrData& accept)
|
||||||
{ return wxCRT_StrpbrkW(s, accept.AsWCharBuf()); }
|
{ return wxCRT_StrpbrkW(s, accept.AsWCharBuf()); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const char *wxStrpbrk(const wxString& s, const wxString& accept)
|
inline const char *wxStrpbrk(const wxString& s, const wxString& accept)
|
||||||
{ return wxCRT_StrpbrkA(s.c_str(), accept.mb_str()); }
|
{ return wxCRT_StrpbrkA(s.c_str(), accept.mb_str()); }
|
||||||
inline const char *wxStrpbrk(const wxString& s, const char *accept)
|
inline const char *wxStrpbrk(const wxString& s, const char *accept)
|
||||||
{ return wxCRT_StrpbrkA(s.c_str(), accept); }
|
{ return wxCRT_StrpbrkA(s.c_str(), accept); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const wchar_t *wxStrpbrk(const wxString& s, const wchar_t *accept)
|
inline const wchar_t *wxStrpbrk(const wxString& s, const wchar_t *accept)
|
||||||
{ return wxCRT_StrpbrkW(s.wc_str(), accept); }
|
{ return wxCRT_StrpbrkW(s.wc_str(), accept); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const char *wxStrpbrk(const wxString& s, const wxCStrData& accept)
|
inline const char *wxStrpbrk(const wxString& s, const wxCStrData& accept)
|
||||||
{ return wxCRT_StrpbrkA(s.c_str(), accept.AsCharBuf()); }
|
{ return wxCRT_StrpbrkA(s.c_str(), accept.AsCharBuf()); }
|
||||||
inline const char *wxStrpbrk(const wxCStrData& s, const wxString& accept)
|
inline const char *wxStrpbrk(const wxCStrData& s, const wxString& accept)
|
||||||
{ return wxCRT_StrpbrkA(s.AsChar(), accept.mb_str()); }
|
{ return wxCRT_StrpbrkA(s.AsChar(), accept.mb_str()); }
|
||||||
inline const char *wxStrpbrk(const wxCStrData& s, const char *accept)
|
inline const char *wxStrpbrk(const wxCStrData& s, const char *accept)
|
||||||
{ return wxCRT_StrpbrkA(s.AsChar(), accept); }
|
{ return wxCRT_StrpbrkA(s.AsChar(), accept); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const wchar_t *wxStrpbrk(const wxCStrData& s, const wchar_t *accept)
|
inline const wchar_t *wxStrpbrk(const wxCStrData& s, const wchar_t *accept)
|
||||||
{ return wxCRT_StrpbrkW(s.AsWChar(), accept); }
|
{ return wxCRT_StrpbrkW(s.AsWChar(), accept); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline const char *wxStrpbrk(const wxCStrData& s, const wxCStrData& accept)
|
inline const char *wxStrpbrk(const wxCStrData& s, const wxCStrData& accept)
|
||||||
{ return wxCRT_StrpbrkA(s.AsChar(), accept.AsCharBuf()); }
|
{ return wxCRT_StrpbrkA(s.AsChar(), accept.AsCharBuf()); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
template <typename S, typename T>
|
template <typename S, typename T>
|
||||||
inline const T *wxStrpbrk(const S& s, const wxScopedCharTypeBuffer<T>& accept)
|
inline const T *wxStrpbrk(const S& s, const wxScopedCharTypeBuffer<T>& accept)
|
||||||
{ return wxStrpbrk(s, accept.data()); }
|
{ return wxStrpbrk(s, accept.data()); }
|
||||||
@@ -771,24 +886,29 @@ inline int wxUngetc(int c, FILE *stream) { return wxCRT_UngetcA(c, stream); }
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// stdlib.h functions
|
// stdlib.h functions
|
||||||
|
//
|
||||||
|
// We only use wxConvLibc here because if the string is non-ASCII,
|
||||||
|
// then it's fine for the conversion to yield empty string, as atoi()
|
||||||
|
// will return 0 for it, which is the correct thing to do in this
|
||||||
|
// case.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef wxCRT_AtoiW
|
#ifdef wxCRT_AtoiW
|
||||||
inline int wxAtoi(const wxString& str) { return wxCRT_AtoiW(str.wc_str()); }
|
inline int wxAtoi(const wxString& str) { return wxCRT_AtoiW(str.wc_str()); }
|
||||||
#else
|
#else
|
||||||
inline int wxAtoi(const wxString& str) { return wxCRT_AtoiA(str.mb_str()); }
|
inline int wxAtoi(const wxString& str) { return wxCRT_AtoiA(str.mb_str(wxConvLibc)); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef wxCRT_AtolW
|
#ifdef wxCRT_AtolW
|
||||||
inline long wxAtol(const wxString& str) { return wxCRT_AtolW(str.wc_str()); }
|
inline long wxAtol(const wxString& str) { return wxCRT_AtolW(str.wc_str()); }
|
||||||
#else
|
#else
|
||||||
inline long wxAtol(const wxString& str) { return wxCRT_AtolA(str.mb_str()); }
|
inline long wxAtol(const wxString& str) { return wxCRT_AtolA(str.mb_str(wxConvLibc)); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef wxCRT_AtofW
|
#ifdef wxCRT_AtofW
|
||||||
inline double wxAtof(const wxString& str) { return wxCRT_AtofW(str.wc_str()); }
|
inline double wxAtof(const wxString& str) { return wxCRT_AtofW(str.wc_str()); }
|
||||||
#else
|
#else
|
||||||
inline double wxAtof(const wxString& str) { return wxCRT_AtofA(str.mb_str()); }
|
inline double wxAtof(const wxString& str) { return wxCRT_AtofA(str.mb_str(wxConvLibc)); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline double wxStrtod(const char *nptr, char **endptr)
|
inline double wxStrtod(const char *nptr, char **endptr)
|
||||||
@@ -913,15 +1033,17 @@ WX_STRTOX_FUNC(wxULongLong_t, wxStrtoull, wxCRT_StrtoullA, wxCRT_StrtoullW)
|
|||||||
// functions in their wide versions
|
// functions in their wide versions
|
||||||
#ifdef wxCRT_SystemW
|
#ifdef wxCRT_SystemW
|
||||||
inline int wxSystem(const wxString& str) { return wxCRT_SystemW(str.wc_str()); }
|
inline int wxSystem(const wxString& str) { return wxCRT_SystemW(str.wc_str()); }
|
||||||
#else
|
#elif !defined wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline int wxSystem(const wxString& str) { return wxCRT_SystemA(str.mb_str()); }
|
inline int wxSystem(const wxString& str) { return wxCRT_SystemA(str.mb_str()); }
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline char* wxGetenv(const char *name) { return wxCRT_GetenvA(name); }
|
inline char* wxGetenv(const char *name) { return wxCRT_GetenvA(name); }
|
||||||
inline wchar_t* wxGetenv(const wchar_t *name) { return wxCRT_GetenvW(name); }
|
inline wchar_t* wxGetenv(const wchar_t *name) { return wxCRT_GetenvW(name); }
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char* wxGetenv(const wxString& name) { return wxCRT_GetenvA(name.mb_str()); }
|
inline char* wxGetenv(const wxString& name) { return wxCRT_GetenvA(name.mb_str()); }
|
||||||
inline char* wxGetenv(const wxCStrData& name) { return wxCRT_GetenvA(name.AsCharBuf()); }
|
inline char* wxGetenv(const wxCStrData& name) { return wxCRT_GetenvA(name.AsCharBuf()); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline char* wxGetenv(const wxScopedCharBuffer& name) { return wxCRT_GetenvA(name.data()); }
|
inline char* wxGetenv(const wxScopedCharBuffer& name) { return wxCRT_GetenvA(name.data()); }
|
||||||
inline wchar_t* wxGetenv(const wxScopedWCharBuffer& name) { return wxCRT_GetenvW(name.data()); }
|
inline wchar_t* wxGetenv(const wxScopedWCharBuffer& name) { return wxCRT_GetenvW(name.data()); }
|
||||||
|
|
||||||
@@ -929,9 +1051,11 @@ inline wchar_t* wxGetenv(const wxScopedWCharBuffer& name) { return wxCRT_GetenvW
|
|||||||
// time.h functions
|
// time.h functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
inline size_t wxStrftime(char *s, size_t max,
|
inline size_t wxStrftime(char *s, size_t max,
|
||||||
const wxString& format, const struct tm *tm)
|
const wxString& format, const struct tm *tm)
|
||||||
{ return wxCRT_StrftimeA(s, max, format.mb_str(), tm); }
|
{ return wxCRT_StrftimeA(s, max, format.mb_str(), tm); }
|
||||||
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
inline size_t wxStrftime(wchar_t *s, size_t max,
|
inline size_t wxStrftime(wchar_t *s, size_t max,
|
||||||
const wxString& format, const struct tm *tm)
|
const wxString& format, const struct tm *tm)
|
||||||
|
@@ -280,14 +280,14 @@ WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxPrintf, 1, (const wxFormatString&),
|
|||||||
wxCRT_PrintfNative, wxCRT_PrintfA)
|
wxCRT_PrintfNative, wxCRT_PrintfA)
|
||||||
inline int wxPrintf(const wxFormatString& s)
|
inline int wxPrintf(const wxFormatString& s)
|
||||||
{
|
{
|
||||||
return wxPrintf("%s", s.InputAsString());
|
return wxPrintf(wxASCII_STR("%s"), s.InputAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxFprintf, 2, (FILE*, const wxFormatString&),
|
WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxFprintf, 2, (FILE*, const wxFormatString&),
|
||||||
wxCRT_FprintfNative, wxCRT_FprintfA)
|
wxCRT_FprintfNative, wxCRT_FprintfA)
|
||||||
inline int wxFprintf(FILE *f, const wxFormatString& s)
|
inline int wxFprintf(FILE *f, const wxFormatString& s)
|
||||||
{
|
{
|
||||||
return wxFprintf(f, "%s", s.InputAsString());
|
return wxFprintf(f, wxASCII_STR("%s"), s.InputAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// va_list versions of printf functions simply forward to the respective
|
// va_list versions of printf functions simply forward to the respective
|
||||||
@@ -440,12 +440,16 @@ WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedCharBuffer& str, const char *form
|
|||||||
wxCRT_SscanfA, (str.data(), format))
|
wxCRT_SscanfA, (str.data(), format))
|
||||||
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedWCharBuffer& str, const wchar_t *format),
|
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedWCharBuffer& str, const wchar_t *format),
|
||||||
wxCRT_SscanfW, (str.data(), wxScanfConvertFormatW(format)))
|
wxCRT_SscanfW, (str.data(), wxScanfConvertFormatW(format)))
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const char *format),
|
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const char *format),
|
||||||
wxCRT_SscanfA, (str.mb_str(), format))
|
wxCRT_SscanfA, (str.mb_str(), format))
|
||||||
|
#endif
|
||||||
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const wchar_t *format),
|
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const wchar_t *format),
|
||||||
wxCRT_SscanfW, (str.wc_str(), wxScanfConvertFormatW(format)))
|
wxCRT_SscanfW, (str.wc_str(), wxScanfConvertFormatW(format)))
|
||||||
|
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const char *format),
|
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const char *format),
|
||||||
wxCRT_SscanfA, (str.AsCharBuf(), format))
|
wxCRT_SscanfA, (str.AsCharBuf(), format))
|
||||||
|
#endif
|
||||||
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const wchar_t *format),
|
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const wchar_t *format),
|
||||||
wxCRT_SscanfW, (str.AsWCharBuf(), wxScanfConvertFormatW(format)))
|
wxCRT_SscanfW, (str.AsWCharBuf(), wxScanfConvertFormatW(format)))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user