Work on streams of all sorts. More to come.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2908 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1999-06-27 10:39:38 +00:00
parent abe2606b70
commit 3883022093
20 changed files with 263 additions and 99 deletions

View File

@ -92,7 +92,9 @@ public:
friend bool WXDLLEXPORT operator == (const wxDate &dt1, const wxDate &dt2);
friend bool WXDLLEXPORT operator != (const wxDate &dt1, const wxDate &dt2);
#if wxUSE_STD_IOSTREAM
friend ostream WXDLLEXPORT & operator << (ostream &os, const wxDate &dt);
#endif
wxString FormatDate (int type=-1) const;
void SetFormat (int format);

View File

@ -29,10 +29,6 @@
#include <iostream>
#endif
#else
#define NO_TEXT_WINDOW_STREAM
#endif
//-----------------------------------------------------------------------------
@ -51,7 +47,7 @@ extern const char *wxTextCtrlNameStr;
// wxTextCtrl
//-----------------------------------------------------------------------------
#ifndef NO_TEXT_WINDOW_STREAM
#if wxUSE_STD_IOSTREAM
class wxTextCtrl: public wxControl, public streambuf
#else
class wxTextCtrl: public wxControl
@ -130,10 +126,11 @@ class wxTextCtrl: public wxControl
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
#ifndef NO_TEXT_WINDOW_STREAM
#if wxUSE_STD_IOSTREAM
int overflow(int i);
int sync();
int underflow();
#endif
wxTextCtrl& operator<<(const wxString& s);
wxTextCtrl& operator<<(int i);
@ -141,7 +138,6 @@ class wxTextCtrl: public wxControl
wxTextCtrl& operator<<(float f);
wxTextCtrl& operator<<(double d);
wxTextCtrl& operator<<(const char c);
#endif
bool SetFont( const wxFont &font );
bool SetForegroundColour(const wxColour &colour);

View File

@ -29,10 +29,6 @@
#include <iostream>
#endif
#else
#define NO_TEXT_WINDOW_STREAM
#endif
//-----------------------------------------------------------------------------
@ -51,7 +47,7 @@ extern const char *wxTextCtrlNameStr;
// wxTextCtrl
//-----------------------------------------------------------------------------
#ifndef NO_TEXT_WINDOW_STREAM
#if wxUSE_STD_IOSTREAM
class wxTextCtrl: public wxControl, public streambuf
#else
class wxTextCtrl: public wxControl
@ -130,10 +126,11 @@ class wxTextCtrl: public wxControl
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
#ifndef NO_TEXT_WINDOW_STREAM
#if wxUSE_STD_IOSTREAM
int overflow(int i);
int sync();
int underflow();
#endif
wxTextCtrl& operator<<(const wxString& s);
wxTextCtrl& operator<<(int i);
@ -141,7 +138,6 @@ class wxTextCtrl: public wxControl
wxTextCtrl& operator<<(float f);
wxTextCtrl& operator<<(double d);
wxTextCtrl& operator<<(const char c);
#endif
bool SetFont( const wxFont &font );
bool SetForegroundColour(const wxColour &colour);

View File

@ -9,6 +9,8 @@
// Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////////
#if wxUSE_STD_IOSTREAM
#if wxUSE_IOSTREAMH
// N.B. BC++ doesn't have istream.h, ostream.h
# include <iostream.h>
@ -18,3 +20,6 @@
using namespace std;
# endif
#endif
#endif
// wxUSE_STD_IOSTREAM

View File

@ -16,6 +16,8 @@
#pragma interface "log.h"
#endif
#include "wx/setup.h"
// ----------------------------------------------------------------------------
// forward declarations
// ----------------------------------------------------------------------------
@ -87,15 +89,7 @@ enum
#define wxTraceOleCalls 0x0100 // OLE interface calls
#endif
#if wxUSE_IOSTREAMH
// N.B. BC++ doesn't have istream.h, ostream.h
# include <iostream.h>
#else
# include <ostream>
# if defined(__VISUALC__) || defined(__MWERKS__)
using namespace std;
# endif
#endif
#include "wx/ioswrap.h"
// ----------------------------------------------------------------------------
// derive from this class to redirect (or suppress, or ...) log messages

View File

@ -40,14 +40,8 @@ class WXDLLEXPORT wxObjectOutputStream;
class WXDLLEXPORT wxHashTable;
class WXDLLEXPORT wxObject_Serialize;
#if wxUSE_IOSTREAMH
// N.B. BC++ doesn't have istream.h, ostream.h
# include <iostream.h>
#else
# include <ostream>
# if defined(__VISUALC__) || defined(__MWERKS__)
using namespace std;
# endif
#if wxUSE_STD_IOSTREAM && (defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT)
#include "wx/ioswrap.h"
#endif
/*
@ -225,7 +219,7 @@ class WXDLLEXPORT wxObject
#endif // Debug & memory tracing
#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT
#if wxUSE_STD_IOSTREAM && (defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT)
virtual void Dump(ostream& str);
#endif

View File

@ -169,19 +169,18 @@ class WXDLLEXPORT wxInputStream: public wxStreamBase {
wxInputStream& operator>>(wxOutputStream& out) { return Read(out); }
wxInputStream& operator>>(wxString& line);
wxInputStream& operator>>(char& c);
wxInputStream& operator>>(short& i);
wxInputStream& operator>>(int& i);
wxInputStream& operator>>(long& i);
wxInputStream& operator>>(signed short& i);
wxInputStream& operator>>(signed int& i);
wxInputStream& operator>>(signed long& i);
wxInputStream& operator>>(unsigned char& c);
wxInputStream& operator>>(unsigned short& i);
wxInputStream& operator>>(unsigned int& i);
wxInputStream& operator>>(unsigned long& i);
wxInputStream& operator>>(double& i);
wxInputStream& operator>>(float& f) { double d; operator>>((double&)d); f = (float)d; return *this; }
#if wxUSE_SERIAL
wxInputStream& operator>>(wxObject *& obj);
#endif
wxInputStream& operator>>(float& f) { double d; operator>>((double&)d); f = (float)d; return *this; }
wxInputStream& operator>>(unsigned char& c) { return operator>>((char&)c); }
wxInputStream& operator>>(unsigned short& i) { return operator>>((short&)i); }
wxInputStream& operator>>(unsigned int& i) { return operator>>((int&)i); }
wxInputStream& operator>>(unsigned long& i) { return operator>>((long&)i); }
wxInputStream& operator>>( __wxInputManip func) { return func(*this); }
protected:
@ -210,19 +209,18 @@ class WXDLLEXPORT wxOutputStream: public wxStreamBase {
wxOutputStream& operator<<(const char *string);
wxOutputStream& operator<<(wxString& string);
wxOutputStream& operator<<(char c);
wxOutputStream& operator<<(short i);
wxOutputStream& operator<<(int i);
wxOutputStream& operator<<(long i);
wxOutputStream& operator<<(signed short i);
wxOutputStream& operator<<(signed int i);
wxOutputStream& operator<<(signed long i);
wxOutputStream& operator<<(unsigned char c);
wxOutputStream& operator<<(unsigned short i);
wxOutputStream& operator<<(unsigned int i);
wxOutputStream& operator<<(unsigned long i);
wxOutputStream& operator<<(double f);
wxOutputStream& operator<<(float f) { return operator<<((double)f); }
#if wxUSE_SERIAL
wxOutputStream& operator<<(wxObject& obj);
#endif
wxOutputStream& operator<<(float f) { return operator<<((double)f); }
wxOutputStream& operator<<(unsigned char c) { return operator<<((char)c); }
wxOutputStream& operator<<(unsigned short i) { return operator<<((short)i); }
wxOutputStream& operator<<(unsigned int i) { return operator<<((int)i); }
wxOutputStream& operator<<(unsigned long i) { return operator<<((long)i); }
wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); }
protected:

View File

@ -1076,7 +1076,7 @@ inline wxString WXDLLEXPORT operator+(const wxCharBuffer& buf, const wxString& s
// Implementation only from here until the end of file
// ---------------------------------------------------------------------------
#ifdef wxSTD_STRING_COMPATIBILITY
#if defined(wxSTD_STRING_COMPATIBILITY) && wxUSE_STD_IOSTREAM
#include "wx/ioswrap.h"

View File

@ -26,8 +26,6 @@
#include "wx/window.h"
#include "wx/filefn.h"
#include "wx/ioswrap.h"
#ifdef __X__
#include <dirent.h>
#include <unistd.h>

View File

@ -54,9 +54,13 @@ public:
// Copy to data
virtual void Copy(wxVariantData& data) = 0;
virtual bool Eq(wxVariantData& data) const = 0;
#if wxUSE_STD_IOSTREAM
virtual bool Write(ostream& str) const = 0;
#endif
virtual bool Write(wxString& str) const = 0;
#if wxUSE_STD_IOSTREAM
virtual bool Read(istream& str) = 0;
#endif
virtual bool Read(wxString& str) = 0;
// What type is it? Return a string name.
virtual wxString GetType() const = 0;

View File

@ -34,6 +34,17 @@
#include "mondrian.xpm"
#endif
#include "wx/ioswrap.h"
#if wxUSE_IOSTREAMH
#include <fstream.h>
#else
#include <fstream>
#endif
#include "wx/wfstream.h"
// Create a new application object
IMPLEMENT_APP (MyApp)
@ -47,6 +58,7 @@ BEGIN_EVENT_TABLE(MyApp, wxApp)
#if wxUSE_UNICODE
EVT_MENU(TYPES_UNICODE, MyApp::DoUnicodeDemo)
#endif
EVT_MENU(TYPES_STREAM, MyApp::DoStreamDemo)
END_EVENT_TABLE()
bool MyApp::OnInit(void)
@ -70,6 +82,7 @@ bool MyApp::OnInit(void)
#if wxUSE_UNICODE
file_menu->Append(TYPES_UNICODE, "&Unicode test");
#endif
file_menu->Append(TYPES_STREAM, "&Stream test");
file_menu->AppendSeparator();
file_menu->Append(TYPES_QUIT, "E&xit");
wxMenuBar *menu_bar = new wxMenuBar;
@ -86,6 +99,45 @@ bool MyApp::OnInit(void)
return TRUE;
}
void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event))
{
wxTextCtrl& textCtrl = * GetTextCtrl();
textCtrl.Clear();
textCtrl << "\nTest fstream vs. wxFileStream:\n\n";
ofstream std_file_output( "test_std.dat" );
wxFileOutputStream file_output( "test_wx.dat" );
textCtrl.WriteText( "Writig to fstream:\n" );
wxString tmp;
signed int si = 0xFFFFFFFF;
tmp.Printf( "Signed int: %d\n", si );
textCtrl.WriteText( tmp );
file_output << si << "\n";
std_file_output << si << "\n";
unsigned int ui = 0xFFFFFFFF;
tmp.Printf( "Unsigned int: %u\n", ui );
textCtrl.WriteText( tmp );
file_output << ui << "\n";
std_file_output << ui << "\n";
double d = 2.01234567890123456789;
tmp.Printf( "Double: %f\n", d );
textCtrl.WriteText( tmp );
file_output << d << "\n";
std_file_output << d << "\n";
wxString str( "Hello!" );
tmp.Printf( "String: %s\n", str.c_str() );
textCtrl.WriteText( tmp );
file_output << str << "\n";
std_file_output << str.c_str() << "\n";
}
#if wxUSE_UNICODE
void MyApp::DoUnicodeDemo(wxCommandEvent& WXUNUSED(event))
{

View File

@ -26,6 +26,7 @@ public:
void DoTimeDemo(wxCommandEvent& event);
void DoVariantDemo(wxCommandEvent& event);
void DoByteOrderDemo(wxCommandEvent& event);
void DoStreamDemo(wxCommandEvent& event);
#if wxUSE_UNICODE
void DoUnicodeDemo(wxCommandEvent& event);
#endif
@ -66,6 +67,7 @@ public:
#define TYPES_VARIANT 105
#define TYPES_BYTEORDER 106
#define TYPES_UNICODE 107
#define TYPES_STREAM 108
#endif
// _WX_TYPETEST_H_

View File

@ -29,17 +29,13 @@
#if wxUSE_TIMEDATE
#include "wx/date.h"
#include <wx/intl.h>
#include "wx/intl.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#if wxUSE_IOSTREAMH
#include <iostream.h>
#else
#include <iostream>
#endif
#include "wx/ioswrap.h"
#include <time.h>
#include <string.h>
@ -274,6 +270,9 @@ bool WXDLLEXPORT operator != (const wxDate &dt1, const wxDate &dt2)
return ( dt1.julian != dt2.julian );
}
#if wxUSE_STD_IOSTREAM
////////////////////////////////////////////////////////////////
// Ostream operations
////////////////////////////////////////////////////////////////
@ -283,6 +282,8 @@ ostream WXDLLEXPORT & operator << (ostream &os, const wxDate &dt)
return os << dt.FormatDate().mb_str();
}
#endif
//////////////////////////////////////////////////////////////
// Conversion routines
//////////////////////////////////////////////////////////////

View File

@ -99,7 +99,7 @@ void wxObject::CopyObject(wxObject& object_dest) const
wxASSERT(object_dest.GetClassInfo()->IsKindOf(GetClassInfo()));
}
#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT
#if wxUSE_STD_IOSTREAM && (defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT)
void wxObject::Dump(ostream& str)
{
if (GetClassInfo() && GetClassInfo()->GetClassName())

View File

@ -603,28 +603,29 @@ wxInputStream& wxInputStream::operator>>(char& c)
return *this;
}
wxInputStream& wxInputStream::operator>>(short& i)
wxInputStream& wxInputStream::operator>>(signed short& i)
{
long l;
signed long l;
*this >> l;
i = (short)l;
i = (signed short)l;
return *this;
}
wxInputStream& wxInputStream::operator>>(int& i)
wxInputStream& wxInputStream::operator>>(signed int& i)
{
long l;
signed long l;
*this >> l;
i = (short)l;
i = (signed int)l;
return *this;
}
wxInputStream& wxInputStream::operator>>(long& i)
wxInputStream& wxInputStream::operator>>(signed long& i)
{
/* I only implemented a simple integer parser */
int c, sign;
char c;
int sign;
while (isspace( c = GetC() ) )
/* Do nothing */ ;
@ -651,6 +652,46 @@ wxInputStream& wxInputStream::operator>>(long& i)
return *this;
}
wxInputStream& wxInputStream::operator>>(unsigned short& i)
{
unsigned long l;
*this >> l;
i = (unsigned short)l;
return *this;
}
wxInputStream& wxInputStream::operator>>(unsigned int& i)
{
unsigned long l;
*this >> l;
i = (unsigned int)l;
return *this;
}
wxInputStream& wxInputStream::operator>>(unsigned long& i)
{
/* I only implemented a simple integer parser */
char c;
while (isspace( c = GetC() ) )
/* Do nothing */ ;
i = 0;
if (!isdigit(c)) {
InputStreamBuffer()->WriteBack(c);
return *this;
}
while (isdigit(c)) {
i = i*10 + c;
c = GetC();
}
return *this;
}
wxInputStream& wxInputStream::operator>>(double& f)
{
/* I only implemented a simple float parser */
@ -772,27 +813,41 @@ wxOutputStream& wxOutputStream::operator<<(char c)
return Write(&c, 1);
}
wxOutputStream& wxOutputStream::operator<<(short i)
wxOutputStream& wxOutputStream::operator<<(signed short i)
{
wxString strint;
strint.Printf(_T("%i"), i);
return *this << strint;
signed long l = (signed long)i;
return *this << l;
}
wxOutputStream& wxOutputStream::operator<<(int i)
wxOutputStream& wxOutputStream::operator<<(signed int i)
{
wxString strint;
strint.Printf(_T("%i"), i);
return *this << strint;
signed long l = (signed long)i;
return *this << l;
}
wxOutputStream& wxOutputStream::operator<<(long i)
wxOutputStream& wxOutputStream::operator<<(signed long i)
{
wxString strlong;
strlong.Printf(_T("%ld"), i);
return *this << strlong;
}
strlong.Printf(_T("%i"), i);
wxOutputStream& wxOutputStream::operator<<(unsigned short i)
{
unsigned long l = (unsigned long)i;
return *this << l;
}
wxOutputStream& wxOutputStream::operator<<(unsigned int i)
{
unsigned long l = (unsigned long)i;
return *this << l;
}
wxOutputStream& wxOutputStream::operator<<(unsigned long i)
{
wxString strlong;
strlong.Printf(_T("%lu"), i);
return *this << strlong;
}

View File

@ -36,7 +36,7 @@ seconds since January 1, 1901, GMT.
#include "wx/ioswrap.h"
#if wxUSE_IOSTREAMH
#if wxUSE_IOSTREAMH && wxUSE_STD_IOSTREAM
#include <iomanip.h>
#else
#include <iomanip>

View File

@ -30,14 +30,6 @@
#include "wx/textdlg.h"
#endif
#include "wx/ioswrap.h"
#if wxUSE_IOSTREAMH
#include <fstream.h>
#else
#include <fstream>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -20,7 +20,7 @@
#pragma hdrstop
#endif
#if wxUSE_IOSTREAMH
#if wxUSE_IOSTREAMH && wxUSE_STD_IOSTREAM
# include <fstream.h>
#else
# include <fstream>
@ -51,9 +51,13 @@ public:
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"); };
@ -135,6 +139,7 @@ bool wxVariantDataList::Eq(wxVariantData& data) const
return TRUE;
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataList::Write(ostream& str) const
{
wxString s;
@ -142,6 +147,7 @@ bool wxVariantDataList::Write(ostream& str) const
str << (const char*) s.mb_str();
return TRUE;
}
#endif
bool wxVariantDataList::Write(wxString& str) const
{
@ -160,12 +166,14 @@ 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))
{
@ -190,9 +198,13 @@ public:
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"); };
@ -236,6 +248,7 @@ bool wxVariantDataStringList::Eq(wxVariantData& data) const
return TRUE;
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataStringList::Write(ostream& str) const
{
wxString s;
@ -243,6 +256,7 @@ bool wxVariantDataStringList::Write(ostream& str) const
str << (const char*) s.mb_str();
return TRUE;
}
#endif
bool wxVariantDataStringList::Write(wxString& str) const
{
@ -260,12 +274,14 @@ 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))
{
@ -293,9 +309,10 @@ public:
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;
@ -327,6 +344,7 @@ bool wxVariantDataLong::Eq(wxVariantData& data) const
return (otherData.m_value == m_value);
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataLong::Write(ostream& str) const
{
wxString s;
@ -334,6 +352,7 @@ bool wxVariantDataLong::Write(ostream& str) const
str << (const char*) s.mb_str();
return TRUE;
}
#endif
bool wxVariantDataLong::Write(wxString& str) const
{
@ -341,11 +360,13 @@ 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
@ -384,9 +405,13 @@ public:
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;
@ -417,6 +442,7 @@ bool wxVariantDataReal::Eq(wxVariantData& data) const
return (otherData.m_value == m_value);
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataReal::Write(ostream& str) const
{
wxString s;
@ -424,6 +450,7 @@ bool wxVariantDataReal::Write(ostream& str) const
str << (const char*) s.mb_str();
return TRUE;
}
#endif
bool wxVariantDataReal::Write(wxString& str) const
{
@ -431,11 +458,13 @@ 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
@ -474,10 +503,14 @@ public:
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;
@ -508,6 +541,7 @@ bool wxVariantDataBool::Eq(wxVariantData& data) const
return (otherData.m_value == m_value);
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataBool::Write(ostream& str) const
{
wxString s;
@ -515,6 +549,7 @@ bool wxVariantDataBool::Write(ostream& str) const
str << (const char*) s.mb_str();
return TRUE;
}
#endif
bool wxVariantDataBool::Write(wxString& str) const
{
@ -522,12 +557,14 @@ 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
@ -566,8 +603,10 @@ public:
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
@ -600,6 +639,7 @@ bool wxVariantDataChar::Eq(wxVariantData& data) const
return (otherData.m_value == m_value);
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataChar::Write(ostream& str) const
{
wxString s;
@ -607,6 +647,7 @@ bool wxVariantDataChar::Write(ostream& str) const
str << (const char*) s.mb_str();
return TRUE;
}
#endif
bool wxVariantDataChar::Write(wxString& str) const
{
@ -614,12 +655,14 @@ 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
@ -666,10 +709,14 @@ public:
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;
@ -698,11 +745,13 @@ bool wxVariantDataString::Eq(wxVariantData& data) 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
{
@ -710,11 +759,13 @@ 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
@ -761,9 +812,13 @@ public:
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; }
@ -792,6 +847,7 @@ bool wxVariantDataTime::Eq(wxVariantData& data) const
return (otherData.m_value == m_value);
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataTime::Write(ostream& str) const
{
wxString s;
@ -799,6 +855,7 @@ bool wxVariantDataTime::Write(ostream& str) const
str << (const char*) s.mb_str();
return TRUE;
}
#endif
bool wxVariantDataTime::Write(wxString& str) const
{
@ -807,11 +864,13 @@ 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))
{
@ -835,9 +894,13 @@ public:
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; }
@ -866,6 +929,7 @@ bool wxVariantDataDate::Eq(wxVariantData& data) const
return (otherData.m_value == m_value);
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataDate::Write(ostream& str) const
{
wxString s;
@ -873,6 +937,7 @@ bool wxVariantDataDate::Write(ostream& str) const
str << (const char*) s.mb_str();
return TRUE;
}
#endif
bool wxVariantDataDate::Write(wxString& str) const
{
@ -880,11 +945,13 @@ 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))
{
@ -910,9 +977,13 @@ public:
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; }
@ -941,6 +1012,7 @@ bool wxVariantDataVoidPtr::Eq(wxVariantData& data) const
return (otherData.m_value == m_value);
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataVoidPtr::Write(ostream& str) const
{
wxString s;
@ -948,6 +1020,7 @@ bool wxVariantDataVoidPtr::Write(ostream& str) const
str << (const char*) s.mb_str();
return TRUE;
}
#endif
bool wxVariantDataVoidPtr::Write(wxString& str) const
{
@ -955,11 +1028,13 @@ 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))
{

View File

@ -94,7 +94,7 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
END_EVENT_TABLE()
#ifndef NO_TEXT_WINDOW_STREAM
#if wxUSE_STD_IOSTREAM
wxTextCtrl::wxTextCtrl() : streambuf()
{
if (allocate()) setp(base(),ebuf());
@ -108,7 +108,7 @@ wxTextCtrl::wxTextCtrl()
}
#endif
#ifndef NO_TEXT_WINDOW_STREAM
#if wxUSE_STD_IOSTREAM
wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size,
int style, const wxValidator& validator, const wxString &name ) : streambuf()
@ -913,7 +913,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
key_event.Skip();
}
#ifndef NO_TEXT_WINDOW_STREAM
#if wxUSE_STD_IOSTREAM
int wxTextCtrl::overflow( int WXUNUSED(c) )
{
int len = pptr() - pbase();
@ -942,6 +942,7 @@ int wxTextCtrl::underflow()
{
return EOF;
}
#endif
wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
{
@ -990,7 +991,6 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
AppendText(buf);
return *this;
}
#endif
GtkWidget* wxTextCtrl::GetConnectWidget()
{

View File

@ -94,7 +94,7 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
END_EVENT_TABLE()
#ifndef NO_TEXT_WINDOW_STREAM
#if wxUSE_STD_IOSTREAM
wxTextCtrl::wxTextCtrl() : streambuf()
{
if (allocate()) setp(base(),ebuf());
@ -108,7 +108,7 @@ wxTextCtrl::wxTextCtrl()
}
#endif
#ifndef NO_TEXT_WINDOW_STREAM
#if wxUSE_STD_IOSTREAM
wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size,
int style, const wxValidator& validator, const wxString &name ) : streambuf()
@ -913,7 +913,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
key_event.Skip();
}
#ifndef NO_TEXT_WINDOW_STREAM
#if wxUSE_STD_IOSTREAM
int wxTextCtrl::overflow( int WXUNUSED(c) )
{
int len = pptr() - pbase();
@ -942,6 +942,7 @@ int wxTextCtrl::underflow()
{
return EOF;
}
#endif
wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
{
@ -990,7 +991,6 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
AppendText(buf);
return *this;
}
#endif
GtkWidget* wxTextCtrl::GetConnectWidget()
{