wxVariant::wxVariant()
{
- m_data = (wxVariantData*) NULL;
+ m_data = NULL;
}
bool wxVariant::IsNull() const
{
- return (m_data == (wxVariantData*) NULL);
+ return (m_data == NULL);
}
void wxVariant::MakeNull()
wxVariant::wxVariant(const wxVariant& variant)
: wxObject()
{
- m_data = (wxVariantData*) NULL;
+ m_data = NULL;
if (!variant.IsNull())
Ref(variant);
// 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;
}
bool wxVariantDataDateTime::Write(wxString& str) const
{
- str = m_value.Format();
+ if ( m_value.IsValid() )
+ str = m_value.Format();
+ else
+ str = wxS("Invalid");
return true;
}
bool wxVariantDataDateTime::Read(wxString& str)
{
+ if ( str == wxS("Invalid") )
+ {
+ m_value = wxInvalidDateTime;
+ return true;
+ }
+
if(! m_value.ParseDateTime(str.c_str()/*FIXME-UTF8*/))
return false;
return true;
*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;