#pragma hdrstop
#endif
-#if wxUSE_IOSTREAMH
+#if wxUSE_IOSTREAMH && wxUSE_STD_IOSTREAM
# include <fstream.h>
#else
# include <fstream>
#endif
+#if wxUSE_STREAMS
#include "wx/stream.h"
+#include "wx/txtstrm.h"
+#endif
+
#include "wx/string.h"
#include "wx/variant.h"
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 _T("list"); };
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataList::Write(ostream& str) const
{
wxString s;
str << (const char*) s.mb_str();
return TRUE;
}
+#endif
bool wxVariantDataList::Write(wxString& str) const
{
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataList::Read(istream& WXUNUSED(str))
{
wxFAIL_MSG(_T("Unimplemented"));
// TODO
return FALSE;
}
+#endif
bool wxVariantDataList::Read(wxString& WXUNUSED(str))
{
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 _T("stringlist"); };
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataStringList::Write(ostream& str) const
{
wxString s;
str << (const char*) s.mb_str();
return TRUE;
}
+#endif
bool wxVariantDataStringList::Write(wxString& str) const
{
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataStringList::Read(istream& WXUNUSED(str))
{
wxFAIL_MSG(_T("Unimplemented"));
// TODO
return FALSE;
}
+#endif
bool wxVariantDataStringList::Read(wxString& WXUNUSED(str))
{
virtual bool Read(wxString& str);
virtual bool Write(wxString& str) const;
+#if wxUSE_STD_IOSTREAM
virtual bool Read(istream& str);
virtual bool Write(ostream& str) const;
-
+#endif
#if wxUSE_STREAMS
virtual bool Read(wxInputStream& str);
virtual bool Write(wxOutputStream &str) const;
return (otherData.m_value == m_value);
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataLong::Write(ostream& str) const
{
wxString s;
str << (const char*) s.mb_str();
return TRUE;
}
+#endif
bool wxVariantDataLong::Write(wxString& str) const
{
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataLong::Read(istream& str)
{
str >> m_value;
return TRUE;
}
+#endif
#if wxUSE_STREAMS
bool wxVariantDataLong::Write(wxOutputStream& str) const
{
- str << m_value;
+ wxTextOutputStream s(str);
+
+ s.Write32(m_value);
return TRUE;
}
bool wxVariantDataLong::Read(wxInputStream& str)
{
- str >> m_value;
+ wxTextInputStream s(str);
+ m_value = s.Read32();
return TRUE;
}
#endif // wxUSE_STREAMS
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
virtual bool Read(wxString& str);
+#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
#if wxUSE_STREAMS
virtual bool Read(wxInputStream& str);
virtual bool Write(wxOutputStream &str) const;
return (otherData.m_value == m_value);
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataReal::Write(ostream& str) const
{
wxString s;
str << (const char*) s.mb_str();
return TRUE;
}
+#endif
bool wxVariantDataReal::Write(wxString& str) const
{
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataReal::Read(istream& str)
{
str >> m_value;
return TRUE;
}
+#endif
#if wxUSE_STREAMS
bool wxVariantDataReal::Write(wxOutputStream& str) const
{
- str << m_value;
+ wxTextOutputStream s(str);
+ s.WriteDouble((double)m_value);
return TRUE;
}
bool wxVariantDataReal::Read(wxInputStream& str)
{
- str >> (float&)m_value;
+ wxTextInputStream s(str);
+ m_value = (float)s.ReadDouble();
return TRUE;
}
#endif // wxUSE_STREAMS
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;
virtual bool Read(wxString& str);
+#if wxUSE_STD_IOSTREAM
virtual bool Read(istream& str);
+#endif
#if wxUSE_STREAMS
virtual bool Read(wxInputStream& str);
virtual bool Write(wxOutputStream& str) const;
return (otherData.m_value == m_value);
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataBool::Write(ostream& str) const
{
wxString s;
str << (const char*) s.mb_str();
return TRUE;
}
+#endif
bool wxVariantDataBool::Write(wxString& str) const
{
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataBool::Read(istream& WXUNUSED(str))
{
wxFAIL_MSG(_T("Unimplemented"));
// str >> (long) m_value;
return FALSE;
}
+#endif
#if wxUSE_STREAMS
bool wxVariantDataBool::Write(wxOutputStream& str) const
{
- str << (char)m_value;
+ wxTextOutputStream s(str);
+
+ s.Write8(m_value);
return TRUE;
}
bool wxVariantDataBool::Read(wxInputStream& str)
{
- str >> (char&)m_value;
+ wxTextInputStream s(str);
+
+ m_value = s.Read8() != 0;
return TRUE;
}
#endif // wxUSE_STREAMS
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
+#if wxUSE_STD_IOSTREAM
virtual bool Read(istream& str);
virtual bool Write(ostream& str) const;
+#endif
virtual bool Read(wxString& str);
virtual bool Write(wxString& str) const;
#if wxUSE_STREAMS
return (otherData.m_value == m_value);
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataChar::Write(ostream& str) const
{
wxString s;
str << (const char*) s.mb_str();
return TRUE;
}
+#endif
bool wxVariantDataChar::Write(wxString& str) const
{
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataChar::Read(istream& WXUNUSED(str))
{
wxFAIL_MSG(_T("Unimplemented"));
// str >> m_value;
return FALSE;
}
+#endif
#if wxUSE_STREAMS
bool wxVariantDataChar::Write(wxOutputStream& str) const
{
- str << m_value;
+ wxTextOutputStream s(str);
+
+ s.Write8(m_value);
return TRUE;
}
bool wxVariantDataChar::Read(wxInputStream& str)
{
- str >> m_value;
+ wxTextInputStream s(str);
+
+ m_value = s.Read8();
return TRUE;
}
#endif // wxUSE_STREAMS
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
+#if wxUSE_STD_IOSTREAM
virtual bool Write(ostream& str) const;
+#endif
virtual bool Read(wxString& str);
virtual bool Write(wxString& str) const;
+#if wxUSE_STD_IOSTREAM
virtual bool Read(istream& str);
+#endif
#if wxUSE_STREAMS
virtual bool Read(wxInputStream& str);
virtual bool Write(wxOutputStream& str) const;
return (otherData.m_value == m_value);
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataString::Write(ostream& str) const
{
str << (const char*) m_value.mb_str();
return TRUE;
}
+#endif
bool wxVariantDataString::Write(wxString& str) const
{
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataString::Read(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&"
- str << (const char*) m_value.mb_str();
+ wxTextOutputStream s(str);
+ s.WriteString(m_value);
return TRUE;
}
bool wxVariantDataString::Read(wxInputStream& str)
{
- str >> m_value;
+ wxTextInputStream s(str);
+
+ m_value = s.ReadString();
return TRUE;
}
#endif // wxUSE_STREAMS
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 _T("time"); };
virtual wxVariantData* Clone() { return new wxVariantDataTime; }
return (otherData.m_value == m_value);
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataTime::Write(ostream& str) const
{
wxString s;
str << (const char*) s.mb_str();
return TRUE;
}
+#endif
bool wxVariantDataTime::Write(wxString& str) const
{
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataTime::Read(istream& WXUNUSED(str))
{
// Not implemented
return FALSE;
}
+#endif
bool wxVariantDataTime::Read(wxString& WXUNUSED(str))
{
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 _T("date"); };
virtual wxVariantData* Clone() { return new wxVariantDataDate; }
return (otherData.m_value == m_value);
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataDate::Write(ostream& str) const
{
wxString s;
str << (const char*) s.mb_str();
return TRUE;
}
+#endif
bool wxVariantDataDate::Write(wxString& str) const
{
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataDate::Read(istream& WXUNUSED(str))
{
// Not implemented
return FALSE;
}
+#endif
bool wxVariantDataDate::Read(wxString& WXUNUSED(str))
{
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 _T("void*"); };
virtual wxVariantData* Clone() { return new wxVariantDataVoidPtr; }
return (otherData.m_value == m_value);
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataVoidPtr::Write(ostream& str) const
{
wxString s;
str << (const char*) s.mb_str();
return TRUE;
}
+#endif
bool wxVariantDataVoidPtr::Write(wxString& str) const
{
return TRUE;
}
+#if wxUSE_STD_IOSTREAM
bool wxVariantDataVoidPtr::Read(istream& WXUNUSED(str))
{
// Not implemented
return FALSE;
}
+#endif
bool wxVariantDataVoidPtr::Read(wxString& WXUNUSED(str))
{