X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0bf14ab8b14d3a999fe1159d2bec33740e066a53..a8a3ccb853083fef8c96ba7cb422790a8852dbde:/include/wx/variant.h diff --git a/include/wx/variant.h b/include/wx/variant.h index 2f54c1b404..f3b1aca1ad 100644 --- a/include/wx/variant.h +++ b/include/wx/variant.h @@ -230,6 +230,26 @@ public: inline operator wxString () const { return MakeString(); } wxString GetString() const; +#if wxUSE_STD_STRING + wxVariant(const std::string& val, const wxString& name = wxEmptyString); + bool operator==(const std::string& value) const + { return operator==(wxString(value)); } + bool operator!=(const std::string& value) const + { return operator!=(wxString(value)); } + wxVariant& operator=(const std::string& value) + { return operator=(wxString(value)); } + operator std::string() const { return (operator wxString()).ToStdString(); } + + wxVariant(const wxStdWideString& val, const wxString& name = wxEmptyString); + bool operator==(const wxStdWideString& value) const + { return operator==(wxString(value)); } + bool operator!=(const wxStdWideString& value) const + { return operator!=(wxString(value)); } + wxVariant& operator=(const wxStdWideString& value) + { return operator=(wxString(value)); } + operator wxStdWideString() const { return (operator wxString()).ToStdWstring(); } +#endif // wxUSE_STD_STRING + // wxUniChar wxVariant(const wxUniChar& val, const wxString& name = wxEmptyString); wxVariant(const wxUniCharRef& val, const wxString& name = wxEmptyString); @@ -376,6 +396,7 @@ class WXDLLIMPEXP_BASE wxAnyToVariantRegistration { public: wxAnyToVariantRegistration(wxVariantDataFactory factory); + virtual ~wxAnyToVariantRegistration(); virtual wxAnyValueType* GetAssociatedType() = 0; wxVariantDataFactory GetFactory() const { return m_factory; } @@ -403,10 +424,13 @@ private: virtual bool GetAsAny(wxAny* any) const; \ static wxVariantData* VariantDataFactory(const wxAny& any); -#define REGISTER_WXANY_CONVERSION(T, CLASSNAME) \ +#define _REGISTER_WXANY_CONVERSION(T, CLASSNAME, FUNC) \ static wxAnyToVariantRegistrationImpl \ gs_##CLASSNAME##AnyToVariantRegistration = \ - wxAnyToVariantRegistrationImpl(&CLASSNAME::VariantDataFactory); + wxAnyToVariantRegistrationImpl(&FUNC); + +#define REGISTER_WXANY_CONVERSION(T, CLASSNAME) \ +_REGISTER_WXANY_CONVERSION(T, CLASSNAME, CLASSNAME::VariantDataFactory) #define IMPLEMENT_TRIVIAL_WXANY_CONVERSION(T, CLASSNAME) \ bool CLASSNAME::GetAsAny(wxAny* any) const \