Allow wxAny to contain 'const char*' or 'const wchar_t*'. This was previously not possible since these pointers were converted to wxString, as convenient means to work with string literals. Now pointers (to string literals) are stored instead, and As<wxString>(), comparison operators do the type conversion.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -879,6 +879,26 @@ protected:
|
||||
|
||||
IMPLEMENT_TRIVIAL_WXANY_CONVERSION(wxString, wxVariantDataString)
|
||||
|
||||
#if wxUSE_ANY
|
||||
// This allows converting string literal wxAnys to string variants
|
||||
wxVariantData* wxVariantDataFromConstCharPAny(const wxAny& any)
|
||||
{
|
||||
return new wxVariantDataString(wxANY_AS(any, const char*));
|
||||
}
|
||||
|
||||
wxVariantData* wxVariantDataFromConstWchar_tPAny(const wxAny& any)
|
||||
{
|
||||
return new wxVariantDataString(wxANY_AS(any, const wchar_t*));
|
||||
}
|
||||
|
||||
_REGISTER_WXANY_CONVERSION(const char*,
|
||||
ConstCharP,
|
||||
wxVariantDataFromConstCharPAny)
|
||||
_REGISTER_WXANY_CONVERSION(const wchar_t*,
|
||||
ConstWchar_tP,
|
||||
wxVariantDataFromConstWchar_tPAny)
|
||||
#endif
|
||||
|
||||
bool wxVariantDataString::Eq(wxVariantData& data) const
|
||||
{
|
||||
wxASSERT_MSG( (data.GetType() == wxT("string")), wxT("wxVariantDataString::Eq: argument mismatch") );
|
||||
|
Reference in New Issue
Block a user