X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/574c939ef1c1b835a8bc65c0fe724548fa04ec49..008a56c968ed7e0694e32e93c2dbf95dde2ba5c8:/src/common/variant.cpp diff --git a/src/common/variant.cpp b/src/common/variant.cpp index 859f722a79..48d54c7ec1 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -1390,6 +1390,7 @@ wxVariant::wxVariant(const wxArrayString& val, const wxString& name) // Strings } wxVariant::wxVariant(const wxVariant& variant) + : wxObject() { if (!variant.IsNull()) { @@ -1436,8 +1437,10 @@ void wxVariant::operator= (const wxVariant& variant) delete m_data; m_data = (wxVariantData*) variant.GetData()->GetClassInfo()->CreateObject(); } -// GetData()->Copy(* variant.GetData()); + variant.GetData()->Copy(* GetData()); + + m_name = variant.m_name; } // Assignment using data, e.g. @@ -2051,6 +2054,12 @@ wxStringList& wxVariant::GetStringList() const return (wxStringList&) ((wxVariantDataStringList*) m_data)->GetValue(); } +// Make empty list +void wxVariant::NullList() +{ + SetData(new wxVariantDataList()); +}; + // Append to list void wxVariant::Append(const wxVariant& value) { @@ -2235,9 +2244,11 @@ bool wxVariant::Convert(wxDateTime* value) const { wxString type(GetType()); if (type == wxT("datetime")) + { *value = ((wxVariantDataDateTime*)GetData())->GetValue(); - else - return FALSE; - - return TRUE; + return TRUE; + } + // Fallback to string conversion + wxString val; + return Convert(&val) && (value->ParseDate(val)); }