+/*
+ * 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;
+
+ DECLARE_NO_COPY_CLASS(wxVariantDataVoidPtr)
+};
+
+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("%p"), 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;
+}
+
+/*
+ * wxVariantDataWxObjectPtr
+ */
+
+class wxVariantDataWxObjectPtr: public wxVariantData
+{
+DECLARE_DYNAMIC_CLASS(wxVariantDataWxObjectPtr)
+public:
+ wxVariantDataWxObjectPtr() { }
+ wxVariantDataWxObjectPtr(wxObject* value) { m_value = value; }
+
+ inline wxObject* GetValue() const { return m_value; }
+ inline void SetValue(wxObject* 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 ;
+ virtual wxVariantData* Clone() { return new wxVariantDataWxObjectPtr; }
+
+ virtual wxClassInfo* GetValueClassInfo() ;
+protected:
+ wxObject* m_value;
+
+ DECLARE_NO_COPY_CLASS(wxVariantDataWxObjectPtr)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxVariantDataWxObjectPtr, wxVariantData)
+
+void wxVariantDataWxObjectPtr::Copy(wxVariantData& data)
+{
+ wxASSERT_MSG( wxIsKindOf((&data), wxVariantDataWxObjectPtr) ,\
+ wxT("wxVariantDataWxObjectPtr::Copy: Can't copy to this type of data") \
+ );
+
+ wxVariantDataWxObjectPtr& otherData = (wxVariantDataWxObjectPtr&) data;
+
+ otherData.m_value = m_value;
+}
+
+bool wxVariantDataWxObjectPtr::Eq(wxVariantData& data) const
+{
+ wxASSERT_MSG( wxIsKindOf((&data), wxVariantDataWxObjectPtr), wxT("wxVariantDataWxObjectPtr::Eq: argument mismatch") );
+
+ wxVariantDataWxObjectPtr& otherData = (wxVariantDataWxObjectPtr&) data;
+
+ return (otherData.m_value == m_value);
+}
+
+wxString wxVariantDataWxObjectPtr::GetType() const
+{
+ wxString returnVal(wxT("wxObject"));
+ if (m_value) {
+ returnVal = m_value->GetClassInfo()->GetClassName();
+ }
+ return returnVal;
+}
+
+wxClassInfo* wxVariantDataWxObjectPtr::GetValueClassInfo()
+{
+ wxClassInfo* returnVal=NULL;
+
+ if (m_value) returnVal = m_value->GetClassInfo();
+
+ return returnVal;
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataWxObjectPtr::Write(wxSTD ostream& str) const
+{
+ wxString s;
+ Write(s);
+ str << (const char*) s.mb_str();
+ return true;
+}
+#endif
+
+bool wxVariantDataWxObjectPtr::Write(wxString& str) const
+{
+ str.Printf(wxT("%s(%p)"), GetType().c_str(), m_value);
+ return true;
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataWxObjectPtr::Read(wxSTD istream& WXUNUSED(str))
+{
+ // Not implemented
+ return false;
+}
+#endif
+
+bool wxVariantDataWxObjectPtr::Read(wxString& WXUNUSED(str))
+{
+ // Not implemented
+ return false;
+}
+
+
+/*
+ * wxVariantDataDateTime
+ */
+
+#if wxUSE_DATETIME
+
+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, (wxDateTime::wxDateTime_t)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
+{
+ wxASSERT_MSG( (data.GetType() == wxT("datetime")), wxT("wxVariantDataDateTime::Eq: argument mismatch") );
+
+ wxVariantDataDateTime& otherData = (wxVariantDataDateTime&) data;
+
+ return (otherData.m_value == m_value);
+}
+
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataDateTime::Write(wxSTD ostream& WXUNUSED(str)) const
+{
+ // Not implemented
+ return false;
+}
+#endif
+
+
+bool wxVariantDataDateTime::Write(wxString& str) const
+{
+ str = m_value.Format();
+ return true;
+}
+
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataDateTime::Read(wxSTD istream& WXUNUSED(str))
+{
+ // Not implemented
+ return false;
+}
+#endif
+
+
+bool wxVariantDataDateTime::Read(wxString& str)
+{
+ if(! m_value.ParseDateTime(str))
+ return false;
+ return true;
+}
+
+#endif // wxUSE_DATETIME
+
+// ----------------------------------------------------------------------------
+// wxVariantDataArrayString
+// ----------------------------------------------------------------------------
+
+class wxVariantDataArrayString: public wxVariantData
+{
+public:
+ wxVariantDataArrayString() { }
+ wxVariantDataArrayString(const wxArrayString& value) { m_value = value; }
+
+ wxArrayString GetValue() const { return m_value; }
+ void SetValue(const wxArrayString& 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("arrstring"); };
+ virtual wxVariantData* Clone() { return new wxVariantDataArrayString; }
+
+protected:
+ wxArrayString m_value;
+
+ DECLARE_DYNAMIC_CLASS(wxVariantDataArrayString)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxVariantDataArrayString, wxVariantData)
+
+void wxVariantDataArrayString::Copy(wxVariantData& data)
+{
+ wxASSERT_MSG( data.GetType() == GetType(), wxT("wxVariantDataArrayString::Copy: Can't copy to this type of data") );
+
+ wxVariantDataArrayString& otherData = (wxVariantDataArrayString&) data;
+
+ otherData.m_value = m_value;
+}
+
+
+bool wxVariantDataArrayString::Eq(wxVariantData& data) const
+{
+ wxASSERT_MSG( data.GetType() == GetType(), wxT("wxVariantDataArrayString::Eq: argument mismatch") );
+
+ wxVariantDataArrayString& otherData = (wxVariantDataArrayString&) data;
+
+ return otherData.m_value == m_value;
+}
+
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataArrayString::Write(wxSTD ostream& WXUNUSED(str)) const
+{
+ // Not implemented
+ return false;
+}
+#endif
+
+
+bool wxVariantDataArrayString::Write(wxString& str) const
+{
+ size_t count = m_value.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ if ( n )
+ str += _T(';');
+
+ str += m_value[n];
+ }
+
+ return true;
+}
+
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDataArrayString::Read(wxSTD istream& WXUNUSED(str))
+{
+ // Not implemented
+ return false;
+}
+#endif
+
+
+bool wxVariantDataArrayString::Read(wxString& str)
+{
+ wxStringTokenizer tk(str, _T(";"));
+ while ( tk.HasMoreTokens() )
+ {
+ m_value.Add(tk.GetNextToken());
+ }
+
+ return true;
+}
+
+
+