X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/581b9f53aefbe5c6399d8383816fcc61fc26c693..cbc9145c04bd3ea0a228906c8363fa8f47e3acf9:/src/common/variant.cpp?ds=sidebyside diff --git a/src/common/variant.cpp b/src/common/variant.cpp index b21b9965f2..b17b2c1f66 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -18,6 +18,8 @@ #include "wx/variant.h" +#if wxUSE_VARIANT + #ifndef WX_PRECOMP #include "wx/string.h" #include "wx/math.h" @@ -219,6 +221,9 @@ public: virtual bool Write(wxSTD ostream& str) const; #endif virtual bool Write(wxString& str) const; +#if wxUSE_STD_IOSTREAM + virtual bool Read(wxSTD istream& str); +#endif virtual bool Read(wxString& str); virtual wxString GetType() const { return wxT("stringlist"); }; @@ -735,7 +740,7 @@ public: virtual bool Read(wxString& str); virtual bool Write(wxString& str) const; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); + virtual bool Read(wxSTD istream& WXUNUSED(str)) { return false; }; #endif #if wxUSE_STREAMS virtual bool Read(wxInputStream& str); @@ -1623,6 +1628,23 @@ void wxVariant::operator= (void* value) } } +bool wxVariant::operator== (wxObject* value) const +{ + return (value == ((wxVariantDataWxObjectPtr*)GetData())->GetValue()); +} + +bool wxVariant::operator!= (wxObject* value) const +{ + return (!((*this) == (void*) value)); +} + +void wxVariant::operator= (wxObject* value) +{ + if (m_data) + delete m_data; + m_data = new wxVariantDataWxObjectPtr(value); +} + #if wxUSE_DATETIME bool wxVariant::operator== (const wxDateTime& value) const { @@ -1889,7 +1911,7 @@ void* wxVariant::GetVoidPtr() const return (void*) ((wxVariantDataVoidPtr*) m_data)->GetValue(); } -wxObject* wxVariant::GetWxObjectPtr() +wxObject* wxVariant::GetWxObjectPtr() const { wxASSERT(wxIsKindOf(m_data, wxVariantDataWxObjectPtr)); return (wxObject*) ((wxVariantDataWxObjectPtr*) m_data)->GetValue(); @@ -2100,3 +2122,5 @@ bool wxVariant::Convert(wxDateTime* value) const (value->ParseDateTime(val) || value->ParseDate(val) || value->ParseTime(val)); } #endif // wxUSE_DATETIME + +#endif // wxUSE_VARIANT