X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6589f1a49aa258f25f4f06cefd7dadb3097bcdee..2f36b4d22beeb7f4f0cedf922c0c26d037f54477:/src/common/variant.cpp?ds=sidebyside diff --git a/src/common/variant.cpp b/src/common/variant.cpp index f5a417ce37..5fc1931bba 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: // Created: 10/09/98 -// RCS-ID: $Id$ // Copyright: (c) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -37,11 +36,6 @@ #endif #endif -#if defined(__MWERKS__) && __MSL__ >= 0x6000 -namespace std {} -using namespace std ; -#endif - #if wxUSE_STREAMS #include "wx/txtstrm.h" #endif @@ -986,6 +980,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; @@ -1963,8 +1971,6 @@ protected: // Convert to/from list of wxAnys // -WX_DEFINE_LIST(wxAnyList) - bool wxVariantDataList::GetAsAny(wxAny* any) const { wxAnyList dst; @@ -2346,6 +2352,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;