+/*
+ * 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(ostream& str) const;
+#endif
+ virtual bool Write(wxString& str) const;
+#if wxUSE_STD_IOSTREAM
+ virtual bool Read(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(ostream& 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(istream& WXUNUSED(str))
+{
+ // Not implemented
+ return FALSE;
+}
+#endif
+
+
+bool wxVariantDataDateTime::Read(wxString& str)
+{
+ if(! m_value.ParseDateTime(str))
+ return FALSE;
+ return TRUE;
+}
+