X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6589f1a49aa258f25f4f06cefd7dadb3097bcdee..a5655d37db9baabce654849fd66173f95f74e230:/src/common/variant.cpp diff --git a/src/common/variant.cpp b/src/common/variant.cpp index f5a417ce37..207c3a4f30 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -986,6 +986,20 @@ wxVariant::wxVariant(const wxScopedWCharBuffer& val, const wxString& name) m_name = name; } +#if wxUSE_STD_STRING +wxVariant::wxVariant(const std::string& val, const wxString& name) +{ + m_refData = new wxVariantDataString(wxString(val)); + m_name = name; +} + +wxVariant::wxVariant(const wxStdWideString& val, const wxString& name) +{ + m_refData = new wxVariantDataString(wxString(val)); + m_name = name; +} +#endif // wxUSE_STD_STRING + bool wxVariant::operator== (const wxString& value) const { wxString thisValue; @@ -2346,6 +2360,15 @@ bool wxVariant::Convert(wxUniChar* value) const *value = (char) (((wxVariantDataLong*)GetData())->GetValue()); else if (type == wxT("bool")) *value = (char) (((wxVariantDataBool*)GetData())->GetValue()); + else if (type == wxS("string")) + { + // Also accept strings of length 1 + const wxString& str = (((wxVariantDataString*)GetData())->GetValue()); + if ( str.length() == 1 ) + *value = str[0]; + else + return false; + } else return false;