X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0aaed451fd4af3e87499d5eb69433f7edbe06225..61f09f569358d7b2752733c4a24d1bd10daefae2:/src/common/variant.cpp diff --git a/src/common/variant.cpp b/src/common/variant.cpp index 0470d2d4b3..1820f4b8d5 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -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") );