if (IsNull() || variant.IsNull())
return (IsNull() == variant.IsNull());
+ if (GetType() != variant.GetType())
+ return false;
+
return (GetData()->Eq(* variant.GetData()));
}
// wxVariantBoolData
// -----------------------------------------------------------------
-#ifdef HAVE_BOOL
-
class WXDLLIMPEXP_BASE wxVariantDataBool: public wxVariantData
{
public:
}
}
-#endif // HAVE_BOOL
-
// -----------------------------------------------------------------
// wxVariantDataChar
// -----------------------------------------------------------------
bool wxVariantDataWxObjectPtr::Write(wxString& str) const
{
- str.Printf(wxT("%s(%p)"), GetType().c_str(), wx_static_cast(void*, m_value));
+ str.Printf(wxT("%s(%p)"), GetType().c_str(), static_cast<void*>(m_value));
return true;
}
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; }
m_name = name;
}
-#if wxUSE_ODBC
-wxVariant::wxVariant(const TIME_STRUCT* valptr, const wxString& name) // Date
-{
- m_data = new wxVariantDataDateTime(valptr);
- m_name = name;
-}
-
-wxVariant::wxVariant(const TIMESTAMP_STRUCT* valptr, const wxString& name) // Date
-{
- m_data = new wxVariantDataDateTime(valptr);
- m_name = name;
-}
-
-wxVariant::wxVariant(const DATE_STRUCT* valptr, const wxString& name) // Date
-{
- m_data = new wxVariantDataDateTime(valptr);
- m_name = name;
-}
-#endif // wxUSE_ODBC
-
bool wxVariant::operator== (const wxDateTime& value) const
{
wxDateTime thisValue;
}
}
-#if wxUSE_ODBC
-void wxVariant::operator= (const DATE_STRUCT* value)
-{
- UnRef();
- m_data = new wxVariantDataDateTime(value);
-}
-
-void wxVariant::operator= (const TIME_STRUCT* value)
-{
- UnRef();
- m_data = new wxVariantDataDateTime(value);
-}
-
-void wxVariant::operator= (const TIMESTAMP_STRUCT* value)
-{
- UnRef();
- m_data = new wxVariantDataDateTime(value);
-}
-
-#endif // wxUSE_ODBC
-
wxDateTime wxVariant::GetDateTime() const
{
wxDateTime value;
*value = (long) (((wxVariantDoubleData*)GetData())->GetValue());
else if (type == wxT("long"))
*value = ((wxVariantDataLong*)GetData())->GetValue();
-#ifdef HAVE_BOOL
else if (type == wxT("bool"))
*value = (long) (((wxVariantDataBool*)GetData())->GetValue());
-#endif
else if (type == wxT("string"))
*value = wxAtol(((wxVariantDataString*)GetData())->GetValue());
else
*value = ((int) (((wxVariantDoubleData*)GetData())->GetValue()) != 0);
else if (type == wxT("long"))
*value = (((wxVariantDataLong*)GetData())->GetValue() != 0);
-#ifdef HAVE_BOOL
else if (type == wxT("bool"))
*value = ((wxVariantDataBool*)GetData())->GetValue();
-#endif
else if (type == wxT("string"))
{
wxString val(((wxVariantDataString*)GetData())->GetValue());
*value = ((wxVariantDoubleData*)GetData())->GetValue();
else if (type == wxT("long"))
*value = (double) (((wxVariantDataLong*)GetData())->GetValue());
-#ifdef HAVE_BOOL
else if (type == wxT("bool"))
*value = (double) (((wxVariantDataBool*)GetData())->GetValue());
-#endif
else if (type == wxT("string"))
*value = (double) wxAtof(((wxVariantDataString*)GetData())->GetValue());
else
*value = ((wxVariantDataChar*)GetData())->GetValue();
else if (type == wxT("long"))
*value = (char) (((wxVariantDataLong*)GetData())->GetValue());
-#ifdef HAVE_BOOL
else if (type == wxT("bool"))
*value = (char) (((wxVariantDataBool*)GetData())->GetValue());
-#endif
else
return false;