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;