1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStream base classes
4 // Author: Guilhem Lavaux
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "stream.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18 #include <wx/stream.h>
24 // ----------------------------------------------------------------------------
26 // ----------------------------------------------------------------------------
28 wxInputStream
::wxInputStream()
32 wxInputStream
::~wxInputStream()
36 #define BUF_TEMP_SIZE 10000
38 wxInputStream
& wxInputStream
::Read(wxOutputStream
& stream_out
)
40 char buf
[BUF_TEMP_SIZE
];
41 size_t bytes_read
= BUF_TEMP_SIZE
;
43 while (bytes_read
== BUF_TEMP_SIZE
&& !stream_out
.Bad()) {
44 bytes_read
= Read(buf
, bytes_read
).LastRead();
46 stream_out
.Write(buf
, bytes_read
);
51 int wxInputStream
::Scanf(const wxString
& format
, ...)
55 va_start(params
, format
);
59 wxInputStream
& wxInputStream
::operator>>(wxString
& line
)
61 wxDataInputStream
s(*this);
67 wxInputStream
& wxInputStream
::operator>>(char& c
)
72 wxInputStream
& wxInputStream
::operator>>(short& i
)
78 wxInputStream
& wxInputStream
::operator>>(long& i
)
84 wxInputStream
& wxInputStream
::operator>>(float& f
)
90 // ----------------------------------------------------------------------------
92 // ----------------------------------------------------------------------------
93 wxOutputStream
::wxOutputStream()
97 wxOutputStream
::~wxOutputStream()
101 wxOutputStream
& wxOutputStream
::Write(wxInputStream
& stream_in
)
103 stream_in
.Read(*this);
107 // ----------------------------------------------------------------------------
108 // wxFilterInputStream
109 // ----------------------------------------------------------------------------
110 wxFilterInputStream
::wxFilterInputStream(wxInputStream
& stream
)
113 m_parent_i_stream
= &stream
;
116 wxFilterInputStream
::~wxFilterInputStream()
120 // ----------------------------------------------------------------------------
121 // wxFilterOutputStream
122 // ----------------------------------------------------------------------------
123 wxFilterOutputStream
::wxFilterOutputStream(wxOutputStream
& stream
)
126 m_parent_o_stream
= &stream
;
129 wxFilterOutputStream
::~wxFilterOutputStream()