]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/variant.cpp
wait4() replaced by waitpid() which is POSIX
[wxWidgets.git] / src / common / variant.cpp
index 86da34aa78803542c7773e4106da4043ad90c915..48a709bd5ffd8ceb260aca113f2c864bc371d0e6 100644 (file)
@@ -6,7 +6,7 @@
 // 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"
@@ -299,10 +296,10 @@ public:
     virtual bool Read(istream& str);
     virtual bool Write(ostream& str) const;
 
-#if wxUSE_STREAM
+#if wxUSE_STREAMS
     virtual bool Read(wxInputStream& str);
     virtual bool Write(wxOutputStream &str) const;
-#endif // wxUSE_STREAM
+#endif // wxUSE_STREAMS
 
     virtual wxString GetType() const { return "long"; };
 
@@ -350,7 +347,7 @@ bool wxVariantDataLong::Read(istream& str)
     return TRUE;
 }
 
-#if wxUSE_STREAM
+#if wxUSE_STREAMS
 bool wxVariantDataLong::Write(wxOutputStream& str) const
 {
     str << m_value;
@@ -362,7 +359,7 @@ bool wxVariantDataLong::Read(wxInputStream& str)
    str >> m_value;
    return TRUE;
 }
-#endif // wxUSE_STREAM
+#endif // wxUSE_STREAMS
 
 bool wxVariantDataLong::Read(wxString& str)
 {
@@ -390,10 +387,10 @@ public:
     virtual bool Write(ostream& str) const;
     virtual bool Write(wxString& str) const;
     virtual bool Read(istream& str);
-#if wxUSE_STREAM
+#if wxUSE_STREAMS
     virtual bool Read(wxInputStream& str);
     virtual bool Write(wxOutputStream &str) const;
-#endif // wxUSE_STREAM
+#endif // wxUSE_STREAMS
     virtual wxString GetType() const { return "double"; };
 
 protected:
@@ -440,7 +437,7 @@ bool wxVariantDataReal::Read(istream& str)
     return TRUE;
 }
 
-#if wxUSE_STREAM
+#if wxUSE_STREAMS
 bool wxVariantDataReal::Write(wxOutputStream& str) const
 {
     str << m_value;
@@ -452,7 +449,7 @@ bool wxVariantDataReal::Read(wxInputStream& str)
     str >> (float&)m_value;
     return TRUE;
 }
-#endif // wxUSE_STREAM
+#endif // wxUSE_STREAMS
 
 bool wxVariantDataReal::Read(wxString& str)
 {
@@ -460,6 +457,7 @@ bool wxVariantDataReal::Read(wxString& str)
     return TRUE;
 }
 
+#ifdef HAVE_BOOL
 /*
  * wxVariantDataBool
  */
@@ -480,10 +478,10 @@ public:
     virtual bool Write(wxString& str) const;
     virtual bool Read(wxString& str);
     virtual bool Read(istream& str);
-#if wxUSE_STREAM
+#if wxUSE_STREAMS
     virtual bool Read(wxInputStream& str);
     virtual bool Write(wxOutputStream& str) const;
-#endif // wxUSE_STREAM
+#endif // wxUSE_STREAMS
     virtual wxString GetType() const { return "bool"; };
 
 protected:
@@ -531,7 +529,7 @@ bool wxVariantDataBool::Read(istream& WXUNUSED(str))
     return FALSE;
 }
 
-#if wxUSE_STREAM
+#if wxUSE_STREAMS
 bool wxVariantDataBool::Write(wxOutputStream& str) const
 {
     str << (char)m_value;
@@ -543,13 +541,14 @@ bool wxVariantDataBool::Read(wxInputStream& str)
     str >> (char&)m_value;
     return TRUE;
 }
-#endif // wxUSE_STREAM
+#endif // wxUSE_STREAMS
 
 bool wxVariantDataBool::Read(wxString& str)
 {
     m_value = (atol((const char*) str) != 0);
     return TRUE;
 }
+#endif // HAVE_BOOL
 
 /*
  * wxVariantDataChar
@@ -571,10 +570,10 @@ public:
     virtual bool Write(ostream& str) const;
     virtual bool Read(wxString& str);
     virtual bool Write(wxString& str) const;
-#if wxUSE_STREAM
+#if wxUSE_STREAMS
     virtual bool Read(wxInputStream& str);
     virtual bool Write(wxOutputStream& str) const;
-#endif // wxUSE_STREAM
+#endif // wxUSE_STREAMS
     virtual wxString GetType() const { return "char"; };
 
 protected:
@@ -622,7 +621,7 @@ bool wxVariantDataChar::Read(istream& WXUNUSED(str))
     return FALSE;
 }
 
-#if wxUSE_STREAM
+#if wxUSE_STREAMS
 bool wxVariantDataChar::Write(wxOutputStream& str) const
 {
     str << m_value;
@@ -634,7 +633,7 @@ bool wxVariantDataChar::Read(wxInputStream& str)
     str >> m_value;
     return TRUE;
 }
-#endif // wxUSE_STREAM
+#endif // wxUSE_STREAMS
 
 bool wxVariantDataChar::Read(wxString& str)
 {
@@ -671,10 +670,10 @@ public:
     virtual bool Read(wxString& str);
     virtual bool Write(wxString& str) const;
     virtual bool Read(istream& str);
-#if wxUSE_STREAM
+#if wxUSE_STREAMS
     virtual bool Read(wxInputStream& str);
     virtual bool Write(wxOutputStream& str) const;
-#endif // wxUSE_STREAM
+#endif // wxUSE_STREAMS
     virtual wxString GetType() const { return "string"; };
 
 protected:
@@ -717,7 +716,7 @@ bool wxVariantDataString::Read(istream& str)
     return TRUE;
 }
 
-#if wxUSE_STREAM
+#if wxUSE_STREAMS
 bool wxVariantDataString::Write(wxOutputStream& str) const
 {
     str << (const char*) m_value;
@@ -729,7 +728,7 @@ bool wxVariantDataString::Read(wxInputStream& str)
     str >> m_value;
     return TRUE;
 }
-#endif // wxUSE_STREAM
+#endif // wxUSE_STREAMS
 
 bool wxVariantDataString::Read(wxString& str)
 {
@@ -994,11 +993,13 @@ wxVariant::wxVariant(long val, const wxString& name)
     m_name = name;
 }
 
+#ifdef HAVE_BOOL
 wxVariant::wxVariant(bool val, const wxString& name)
 {
     m_data = new wxVariantDataBool(val);
     m_name = name;
 }
+#endif
 
 wxVariant::wxVariant(char val, const wxString& name)
 {
@@ -1208,6 +1209,7 @@ void wxVariant::operator= (char value)
     }
 }
 
+#ifdef HAVE_BOOL
 bool wxVariant::operator== (bool value) const
 {
     bool thisValue;
@@ -1235,6 +1237,7 @@ void wxVariant::operator= (bool value)
         m_data = new wxVariantDataBool(value);
     }
 }
+#endif // HAVE_BOOL
 
 bool wxVariant::operator== (const wxString& value) const
 {
@@ -1683,8 +1686,10 @@ bool wxVariant::Convert(long* value) const
         *value = (long) (((wxVariantDataReal*)GetData())->GetValue());
     else if (type == "long")
         *value = ((wxVariantDataLong*)GetData())->GetValue();
+#ifdef HAVE_BOOL
     else if (type == "bool")
         *value = (long) (((wxVariantDataBool*)GetData())->GetValue());
+#endif
     else if (type == "string")
         *value = atol((const char*) ((wxVariantDataString*)GetData())->GetValue());
     else
@@ -1700,8 +1705,10 @@ bool wxVariant::Convert(bool* value) const
         *value = ((int) (((wxVariantDataReal*)GetData())->GetValue()) != 0);
     else if (type == "long")
         *value = (((wxVariantDataLong*)GetData())->GetValue() != 0);
+#ifdef HAVE_BOOL
     else if (type == "bool")
         *value = ((wxVariantDataBool*)GetData())->GetValue();
+#endif
     else if (type == "string")
     {
         wxString val(((wxVariantDataString*)GetData())->GetValue());
@@ -1726,8 +1733,10 @@ bool wxVariant::Convert(double* value) const
         *value = ((wxVariantDataReal*)GetData())->GetValue();
     else if (type == "long")
         *value = (double) (((wxVariantDataLong*)GetData())->GetValue());
+#ifdef HAVE_BOOL
     else if (type == "bool")
         *value = (double) (((wxVariantDataBool*)GetData())->GetValue());
+#endif
     else if (type == "string")
         *value = (double) atof((const char*) ((wxVariantDataString*)GetData())->GetValue());
     else
@@ -1743,8 +1752,10 @@ bool wxVariant::Convert(char* value) const
         *value = ((wxVariantDataChar*)GetData())->GetValue();
     else if (type == "long")
         *value = (char) (((wxVariantDataLong*)GetData())->GetValue());
+#ifdef HAVE_BOOL
     else if (type == "bool")
         *value = (char) (((wxVariantDataBool*)GetData())->GetValue());
+#endif
     else
         return FALSE;