+bool wxVariantDataChar::Eq(wxVariantData& data) const
+{
+ wxASSERT_MSG( (data.GetType() == wxT("char")), wxT("wxVariantDataChar::Eq: argument mismatch") );
+
+ wxVariantDataChar& otherData = (wxVariantDataChar&) data;
+
+ return (otherData.m_value == m_value);
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataChar::Write(wxSTD ostream& str) const
+{
+ wxString s;
+ Write(s);
+ str << (const char*) s.mb_str();
+ return TRUE;
+}
+#endif
+
+bool wxVariantDataChar::Write(wxString& str) const
+{
+ str.Printf(wxT("%c"), m_value);
+ return TRUE;
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataChar::Read(wxSTD istream& WXUNUSED(str))
+{
+ wxFAIL_MSG(wxT("Unimplemented"));
+// str >> m_value;
+ return FALSE;
+}
+#endif
+
+#if wxUSE_STREAMS
+bool wxVariantDataChar::Write(wxOutputStream& str) const
+{
+ wxTextOutputStream s(str);
+
+ s.Write8(m_value);
+ return TRUE;
+}
+
+bool wxVariantDataChar::Read(wxInputStream& str)
+{
+ wxTextInputStream s(str);
+
+ m_value = s.Read8();
+ return TRUE;
+}
+#endif // wxUSE_STREAMS
+
+bool wxVariantDataChar::Read(wxString& str)
+{
+ m_value = str[(size_t)0];
+ return TRUE;
+}
+
+/*
+ * wxVariantDataString
+ */
+
+#if defined(__BORLANDC__) && defined(__WIN16__)
+// Change name because of truncation
+#define wxVariantDataString wxVariantStringData
+#endif
+
+class WXDLLEXPORT wxVariantDataString: public wxVariantData
+{
+#if defined(__BORLANDC__) && defined(__WIN16__)
+DECLARE_DYNAMIC_CLASS(wxVariantStringData)
+#else
+DECLARE_DYNAMIC_CLASS(wxVariantDataString)
+#endif
+public:
+ wxVariantDataString() { }
+ wxVariantDataString(const wxString& value) { m_value = value; }
+
+ inline wxString GetValue() const { return m_value; }
+ inline void SetValue(const wxString& value) { m_value = value; }
+
+ virtual void Copy(wxVariantData& data);
+ virtual bool Eq(wxVariantData& data) const;
+#if wxUSE_STD_IOSTREAM
+ virtual bool Write(wxSTD ostream& str) const;
+#endif
+ virtual bool Read(wxString& str);
+ virtual bool Write(wxString& str) const;
+#if wxUSE_STD_IOSTREAM
+ virtual bool Read(wxSTD istream& str);
+#endif
+#if wxUSE_STREAMS
+ virtual bool Read(wxInputStream& str);
+ virtual bool Write(wxOutputStream& str) const;
+#endif // wxUSE_STREAMS
+ virtual wxString GetType() const { return wxT("string"); };
+
+protected:
+ wxString m_value;
+};
+
+void wxVariantDataString::Copy(wxVariantData& data)
+{
+ wxASSERT_MSG( (data.GetType() == wxT("string")), wxT("wxVariantDataString::Copy: Can't copy to this type of data") );
+
+ wxVariantDataString& otherData = (wxVariantDataString&) data;
+
+ otherData.m_value = m_value;
+}
+
+bool wxVariantDataString::Eq(wxVariantData& data) const
+{
+ wxASSERT_MSG( (data.GetType() == wxT("string")), wxT("wxVariantDataString::Eq: argument mismatch") );
+
+ wxVariantDataString& otherData = (wxVariantDataString&) data;
+
+ return (otherData.m_value == m_value);
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataString::Write(wxSTD ostream& str) const
+{
+ str << (const char*) m_value.mb_str();
+ return TRUE;
+}
+#endif
+
+bool wxVariantDataString::Write(wxString& str) const
+{
+ str = m_value;
+ return TRUE;
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataString::Read(wxSTD istream& str)
+{
+ str >> m_value;
+ return TRUE;
+}
+#endif
+
+#if wxUSE_STREAMS
+bool wxVariantDataString::Write(wxOutputStream& str) const
+{
+ // why doesn't wxOutputStream::operator<< take "const wxString&"
+ wxTextOutputStream s(str);
+ s.WriteString(m_value);
+ return TRUE;
+}
+
+bool wxVariantDataString::Read(wxInputStream& str)
+{
+ wxTextInputStream s(str);
+
+ m_value = s.ReadString();
+ return TRUE;
+}
+#endif // wxUSE_STREAMS
+
+bool wxVariantDataString::Read(wxString& str)
+{
+ m_value = str;
+ return TRUE;
+}
+
+#if defined(__BORLANDC__) && defined(__WIN16__)
+IMPLEMENT_DYNAMIC_CLASS(wxVariantStringData, wxVariantData)
+#else
+IMPLEMENT_DYNAMIC_CLASS(wxVariantDataString, wxVariantData)
+#endif
+
+/*
+ * wxVariantDataTime
+ */
+
+// For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled
+#if wxUSE_TIMEDATE && !defined(__WATCOMC__)
+
+class wxVariantDataTime: public wxVariantData
+{
+ DECLARE_DYNAMIC_CLASS(wxVariantDataTime)
+public:
+ wxVariantDataTime() { }
+ wxVariantDataTime(const wxTime& value) { m_value = value; }
+
+ inline wxTime GetValue() const { return m_value; }
+ inline void SetValue(const wxTime& value) { m_value = value; }
+
+ virtual void Copy(wxVariantData& data);
+ virtual bool Eq(wxVariantData& data) const;
+#if wxUSE_STD_IOSTREAM
+ 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("time"); };
+ virtual wxVariantData* Clone() { return new wxVariantDataTime; }
+
+protected:
+ wxTime m_value;
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxVariantDataTime, wxVariantData)
+
+void wxVariantDataTime::Copy(wxVariantData& data)
+{
+ wxASSERT_MSG( (data.GetType() == wxT("time")), wxT("wxVariantDataTime::Copy: Can't copy to this type of data") );
+
+ wxVariantDataTime& otherData = (wxVariantDataTime&) data;
+
+ otherData.m_value = m_value;
+}
+
+bool wxVariantDataTime::Eq(wxVariantData& data) const
+{
+ wxASSERT_MSG( (data.GetType() == wxT("time")), wxT("wxVariantDataTime::Eq: argument mismatch") );
+
+ wxVariantDataTime& otherData = (wxVariantDataTime&) data;
+
+ return (otherData.m_value == m_value);
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataTime::Write(wxSTD ostream& str) const
+{
+ wxString s;
+ Write(s);
+ str << (const char*) s.mb_str();
+ return TRUE;
+}
+#endif
+
+bool wxVariantDataTime::Write(wxString& str) const
+{
+ wxChar*s = m_value.FormatTime();
+ str = s;
+ return TRUE;
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataTime::Read(wxSTD istream& WXUNUSED(str))
+{
+ // Not implemented
+ return FALSE;
+}
+#endif
+
+bool wxVariantDataTime::Read(wxString& WXUNUSED(str))
+{
+ // Not implemented
+ return FALSE;
+}
+
+/*
+ * wxVariantDataDate
+ */
+
+class wxVariantDataDate: public wxVariantData
+{
+ DECLARE_DYNAMIC_CLASS(wxVariantDataDate)
+public:
+ wxVariantDataDate() { }
+ wxVariantDataDate(const wxDate& value) { m_value = value; }
+
+ inline wxDate GetValue() const { return m_value; }
+ inline void SetValue(const wxDate& value) { m_value = value; }
+
+ virtual void Copy(wxVariantData& data);
+ virtual bool Eq(wxVariantData& data) const;
+#if wxUSE_STD_IOSTREAM
+ 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("date"); };
+ virtual wxVariantData* Clone() { return new wxVariantDataDate; }
+
+protected:
+ wxDate m_value;
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxVariantDataDate, wxVariantData)
+
+void wxVariantDataDate::Copy(wxVariantData& data)
+{
+ wxASSERT_MSG( (data.GetType() == wxT("date")), wxT("wxVariantDataDate::Copy: Can't copy to this type of data") );
+
+ wxVariantDataDate& otherData = (wxVariantDataDate&) data;
+
+ otherData.m_value = m_value;
+}
+
+bool wxVariantDataDate::Eq(wxVariantData& data) const
+{
+ wxASSERT_MSG( (data.GetType() == wxT("date")), wxT("wxVariantDataDate::Eq: argument mismatch") );
+
+ wxVariantDataDate& otherData = (wxVariantDataDate&) data;
+
+ return (otherData.m_value == m_value);
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataDate::Write(wxSTD ostream& str) const
+{
+ wxString s;
+ Write(s);
+ str << (const char*) s.mb_str();
+ return TRUE;
+}
+#endif
+
+bool wxVariantDataDate::Write(wxString& str) const
+{
+ str = m_value.FormatDate();
+ return TRUE;
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataDate::Read(wxSTD istream& WXUNUSED(str))
+{
+ // Not implemented
+ return FALSE;
+}
+#endif
+
+bool wxVariantDataDate::Read(wxString& WXUNUSED(str))
+{
+ // Not implemented
+ return FALSE;
+}
+#endif
+ // wxUSE_TIMEDATE
+
+/*
+ * wxVariantDataVoidPtr
+ */
+
+class wxVariantDataVoidPtr: public wxVariantData
+{
+DECLARE_DYNAMIC_CLASS(wxVariantDataVoidPtr)
+public:
+ wxVariantDataVoidPtr() { }
+ wxVariantDataVoidPtr(void* value) { m_value = value; }
+
+ inline void* GetValue() const { return m_value; }
+ inline void SetValue(void* value) { m_value = value; }
+
+ virtual void Copy(wxVariantData& data);
+ virtual bool Eq(wxVariantData& data) const;
+#if wxUSE_STD_IOSTREAM
+ 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("void*"); };
+ virtual wxVariantData* Clone() { return new wxVariantDataVoidPtr; }
+
+protected:
+ void* m_value;
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxVariantDataVoidPtr, wxVariantData)
+
+void wxVariantDataVoidPtr::Copy(wxVariantData& data)
+{
+ wxASSERT_MSG( (data.GetType() == wxT("void*")), wxT("wxVariantDataVoidPtr::Copy: Can't copy to this type of data") );
+
+ wxVariantDataVoidPtr& otherData = (wxVariantDataVoidPtr&) data;
+
+ otherData.m_value = m_value;
+}
+
+bool wxVariantDataVoidPtr::Eq(wxVariantData& data) const
+{
+ wxASSERT_MSG( (data.GetType() == wxT("void*")), wxT("wxVariantDataVoidPtr::Eq: argument mismatch") );
+
+ wxVariantDataVoidPtr& otherData = (wxVariantDataVoidPtr&) data;
+
+ return (otherData.m_value == m_value);
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataVoidPtr::Write(wxSTD ostream& str) const
+{
+ wxString s;
+ Write(s);
+ str << (const char*) s.mb_str();
+ return TRUE;
+}
+#endif
+
+bool wxVariantDataVoidPtr::Write(wxString& str) const
+{
+ str.Printf(wxT("%ld"), (long) m_value);
+ return TRUE;
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataVoidPtr::Read(wxSTD istream& WXUNUSED(str))
+{
+ // Not implemented
+ return FALSE;
+}
+#endif
+
+bool wxVariantDataVoidPtr::Read(wxString& WXUNUSED(str))
+{
+ // Not implemented
+ return FALSE;
+}
+
+/*
+ * wxVariantDataDateTime
+ */
+
+class wxVariantDataDateTime: public wxVariantData
+{
+ DECLARE_DYNAMIC_CLASS(wxVariantDataDateTime)
+
+public:
+ wxVariantDataDateTime() { }
+ wxVariantDataDateTime(const wxDateTime& value) { m_value = value; }
+#if wxUSE_ODBC
+ wxVariantDataDateTime(const TIME_STRUCT* valptr)
+ { m_value = wxDateTime(valptr->hour, valptr->minute, valptr->second); }
+ wxVariantDataDateTime(const DATE_STRUCT* valptr)
+ { m_value = wxDateTime(valptr->day, (wxDateTime::Month) (valptr->month - 1),valptr->year); }
+ wxVariantDataDateTime(const TIMESTAMP_STRUCT* valptr)
+ { m_value = wxDateTime(valptr->day, (wxDateTime::Month) (valptr->month - 1), valptr->year,
+ valptr->hour, valptr->minute, valptr->second, valptr->fraction ); }
+#endif //ODBC
+
+ inline wxDateTime GetValue() const { return m_value; }
+ inline void SetValue(const wxDateTime& value) { m_value = value; }
+
+ virtual void Copy(wxVariantData& data);
+ virtual bool Eq(wxVariantData& data) const;
+#if wxUSE_STD_IOSTREAM
+ 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("datetime"); };
+ virtual wxVariantData* Clone() { return new wxVariantDataDateTime; }
+
+protected:
+ wxDateTime m_value;
+};
+
+
+IMPLEMENT_DYNAMIC_CLASS(wxVariantDataDateTime, wxVariantData)
+
+void wxVariantDataDateTime::Copy(wxVariantData& data)
+{
+ wxASSERT_MSG( (data.GetType() == wxT("datetime")), wxT("wxVariantDataDateTime::Copy: Can't copy to this type of data") );
+
+ wxVariantDataDateTime& otherData = (wxVariantDataDateTime&) data;
+
+ otherData.m_value = m_value;
+}
+
+
+bool wxVariantDataDateTime::Eq(wxVariantData& data) const