]>
git.saurik.com Git - wxWidgets.git/blob - src/common/stream.cpp
a9c76aff5bb3a2bcb0cb6d758e4087c7c67f511d
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 #if !USE_SHARED_LIBRARY
25 IMPLEMENT_ABSTRACT_CLASS(wxInputStream
, wxObject
)
26 IMPLEMENT_ABSTRACT_CLASS(wxOutputStream
, wxObject
)
27 IMPLEMENT_CLASS(wxFilterInputStream
, wxInputStream
)
28 IMPLEMENT_CLASS(wxFilterOutputStream
, wxOutputStream
)
31 wxInputStream::wxInputStream()
36 wxInputStream::~wxInputStream()
40 #define BUF_TEMP_SIZE 10000
42 wxInputStream
& wxInputStream::Read(wxOutputStream
& stream_out
)
44 char buf
[BUF_TEMP_SIZE
];
45 size_t bytes_read
= BUF_TEMP_SIZE
;
47 while (bytes_read
== BUF_TEMP_SIZE
&& !stream_out
.Bad()) {
48 bytes_read
= Read(buf
, bytes_read
).LastRead();
50 stream_out
.Write(buf
, bytes_read
);
55 wxOutputStream::wxOutputStream()
60 wxOutputStream::~wxOutputStream()
64 wxOutputStream
& wxOutputStream::Write(wxInputStream
& stream_in
)
66 stream_in
.Read(*this);
70 wxFilterInputStream::wxFilterInputStream(wxInputStream
& stream
)
73 m_parent_i_stream
= &stream
;
76 wxFilterInputStream::~wxFilterInputStream()
80 wxFilterOutputStream::wxFilterOutputStream(wxOutputStream
& stream
)
83 m_parent_o_stream
= &stream
;
86 wxFilterOutputStream::~wxFilterOutputStream()