]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/variant.cpp
Use the data scheme to load resources in the WebKitGTK+ implementation, rather than...
[wxWidgets.git] / src / common / variant.cpp
index f5a417ce37ab02cb9f7b04d8c296d6d5376f8ab7..5f7daabe9a6f5b91d25f3992402a6f6f37c702fc 100644 (file)
@@ -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;
@@ -1963,8 +1977,6 @@ protected:
 // Convert to/from list of wxAnys
 //
 
-WX_DEFINE_LIST(wxAnyList)
-
 bool wxVariantDataList::GetAsAny(wxAny* any) const
 {
     wxAnyList dst;
@@ -2346,6 +2358,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;