// Created: 10/09/98
// RCS-ID: $Id$
// Copyright: (c)
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
#if wxUSE_IOSTREAMH
# include <fstream.h>
#else
# include <fstream>
-# ifdef _MSC_VER
- using namespace std;
-# endif
#endif
#include "wx/stream.h"
IMPLEMENT_ABSTRACT_CLASS(wxVariantData, wxObject)
-wxVariant wxNullVariant;
+wxVariant WXDLLEXPORT wxNullVariant;
/*
* wxVariantDataList
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
- virtual bool Write(ostream& str) const;
+
+ virtual bool Read(wxString& str);
virtual bool Write(wxString& str) const;
- virtual bool Write(wxOutputStream &str) const;
virtual bool Read(istream& str);
+ virtual bool Write(ostream& str) const;
+
+#if wxUSE_STREAMS
virtual bool Read(wxInputStream& str);
- virtual bool Read(wxString& str);
+ virtual bool Write(wxOutputStream &str) const;
+#endif // wxUSE_STREAMS
+
virtual wxString GetType() const { return "long"; };
protected:
return TRUE;
}
-bool wxVariantDataLong::Write(wxOutputStream& str) const
-{
- str << m_value;
- return TRUE;
-}
-
bool wxVariantDataLong::Write(wxString& str) const
{
str.Printf("%ld", m_value);
return TRUE;
}
+#if wxUSE_STREAMS
+bool wxVariantDataLong::Write(wxOutputStream& str) const
+{
+ str << m_value;
+ return TRUE;
+}
+
bool wxVariantDataLong::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
+#endif // wxUSE_STREAMS
bool wxVariantDataLong::Read(wxString& str)
{
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
+ virtual bool Read(wxString& str);
virtual bool Write(ostream& str) const;
virtual bool Write(wxString& str) const;
- virtual bool Write(wxOutputStream &str) const;
virtual bool Read(istream& str);
+#if wxUSE_STREAMS
virtual bool Read(wxInputStream& str);
- virtual bool Read(wxString& str);
+ virtual bool Write(wxOutputStream &str) const;
+#endif // wxUSE_STREAMS
virtual wxString GetType() const { return "double"; };
protected:
return TRUE;
}
-bool wxVariantDataReal::Write(wxOutputStream& str) const
-{
- str << m_value;
- return TRUE;
-}
-
bool wxVariantDataReal::Write(wxString& str) const
{
str.Printf("%.4f", m_value);
return TRUE;
}
+#if wxUSE_STREAMS
+bool wxVariantDataReal::Write(wxOutputStream& str) const
+{
+ str << m_value;
+ return TRUE;
+}
+
bool wxVariantDataReal::Read(wxInputStream& str)
{
str >> (float&)m_value;
return TRUE;
}
+#endif // wxUSE_STREAMS
bool wxVariantDataReal::Read(wxString& str)
{
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const;
- virtual bool Write(wxOutputStream& str) const;
virtual bool Write(wxString& str) const;
+ virtual bool Read(wxString& str);
virtual bool Read(istream& str);
+#if wxUSE_STREAMS
virtual bool Read(wxInputStream& str);
- virtual bool Read(wxString& str);
+ virtual bool Write(wxOutputStream& str) const;
+#endif // wxUSE_STREAMS
virtual wxString GetType() const { return "bool"; };
protected:
return TRUE;
}
-bool wxVariantDataBool::Write(wxOutputStream& str) const
-{
- str << (char)m_value;
- return TRUE;
-}
-
bool wxVariantDataBool::Write(wxString& str) const
{
str.Printf("%d", (int) m_value);
return FALSE;
}
+#if wxUSE_STREAMS
+bool wxVariantDataBool::Write(wxOutputStream& str) const
+{
+ str << (char)m_value;
+ return TRUE;
+}
+
bool wxVariantDataBool::Read(wxInputStream& str)
{
str >> (char&)m_value;
return TRUE;
}
+#endif // wxUSE_STREAMS
bool wxVariantDataBool::Read(wxString& str)
{
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
+ virtual bool Read(istream& str);
virtual bool Write(ostream& str) const;
- virtual bool Write(wxOutputStream& str) const;
+ virtual bool Read(wxString& str);
virtual bool Write(wxString& str) const;
- virtual bool Read(istream& str);
+#if wxUSE_STREAMS
virtual bool Read(wxInputStream& str);
- virtual bool Read(wxString& str);
+ virtual bool Write(wxOutputStream& str) const;
+#endif // wxUSE_STREAMS
virtual wxString GetType() const { return "char"; };
protected:
return TRUE;
}
-bool wxVariantDataChar::Write(wxOutputStream& str) const
-{
- str << m_value;
- return TRUE;
-}
-
bool wxVariantDataChar::Write(wxString& str) const
{
str.Printf("%c", m_value);
return FALSE;
}
+#if wxUSE_STREAMS
+bool wxVariantDataChar::Write(wxOutputStream& str) const
+{
+ str << m_value;
+ return TRUE;
+}
+
bool wxVariantDataChar::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
+#endif // wxUSE_STREAMS
bool wxVariantDataChar::Read(wxString& str)
{
* wxVariantDataString
*/
+#if defined(__BORLANDC__) && defined(__WIN16__)
+// Change name because of truncation
+#define wxVariantDataString wxVariantStringData
+#endif
+
class WXDLLEXPORT wxVariantDataString: public wxVariantData
{
+#if defined(__BORLANDC__) && defined(__WIN16__)
+DECLARE_DYNAMIC_CLASS(wxVariantStringData)
+#else
DECLARE_DYNAMIC_CLASS(wxVariantDataString)
+#endif
public:
wxVariantDataString() { }
wxVariantDataString(const wxString& value) { m_value = value; }
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const;
- virtual bool Write(wxOutputStream& str) const;
+ virtual bool Read(wxString& str);
virtual bool Write(wxString& str) const;
virtual bool Read(istream& str);
+#if wxUSE_STREAMS
virtual bool Read(wxInputStream& str);
- virtual bool Read(wxString& str);
+ virtual bool Write(wxOutputStream& str) const;
+#endif // wxUSE_STREAMS
virtual wxString GetType() const { return "string"; };
protected:
return TRUE;
}
-bool wxVariantDataString::Write(wxOutputStream& str) const
-{
- str << (const char*) m_value;
- return TRUE;
-}
-
bool wxVariantDataString::Write(wxString& str) const
{
str = m_value;
return TRUE;
}
+#if wxUSE_STREAMS
+bool wxVariantDataString::Write(wxOutputStream& str) const
+{
+ str << (const char*) m_value;
+ return TRUE;
+}
+
bool wxVariantDataString::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
+#endif // wxUSE_STREAMS
bool wxVariantDataString::Read(wxString& str)
{
return TRUE;
}
+#if defined(__BORLANDC__) && defined(__WIN16__)
+IMPLEMENT_DYNAMIC_CLASS(wxVariantStringData, wxVariantData)
+#else
IMPLEMENT_DYNAMIC_CLASS(wxVariantDataString, wxVariantData)
+#endif
/*
* wxVariantDataTime
return TRUE;
}
-bool wxVariantDataTime::Read(istream& str)
+bool wxVariantDataTime::Read(istream& WXUNUSED(str))
{
// Not implemented
return FALSE;
}
-bool wxVariantDataTime::Read(wxString& str)
+bool wxVariantDataTime::Read(wxString& WXUNUSED(str))
{
// Not implemented
return FALSE;
return TRUE;
}
-bool wxVariantDataDate::Read(istream& str)
+bool wxVariantDataDate::Read(istream& WXUNUSED(str))
{
// Not implemented
return FALSE;
}
-bool wxVariantDataDate::Read(wxString& str)
+bool wxVariantDataDate::Read(wxString& WXUNUSED(str))
{
// Not implemented
return FALSE;
return TRUE;
}
-bool wxVariantDataVoidPtr::Read(istream& str)
+bool wxVariantDataVoidPtr::Read(istream& WXUNUSED(str))
{
// Not implemented
return FALSE;
}
-bool wxVariantDataVoidPtr::Read(wxString& str)
+bool wxVariantDataVoidPtr::Read(wxString& WXUNUSED(str))
{
// Not implemented
return FALSE;