]>
git.saurik.com Git - wxWidgets.git/blob - src/common/stream.cpp
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"
27 #include "wx/object.h"
28 #include "wx/stream.h"
30 #if !USE_SHARED_LIBRARY
31 IMPLEMENT_ABSTRACT_CLASS(wxInputStream
, wxObject
)
32 IMPLEMENT_ABSTRACT_CLASS(wxOutputStream
, wxObject
)
33 IMPLEMENT_ABSTRACT_CLASS2(wxStream
, wxInputStream
, wxOutputStream
)
34 IMPLEMENT_CLASS(wxFilterInputStream
, wxInputStream
)
35 IMPLEMENT_CLASS(wxFilterOutputStream
, wxOutputStream
)
38 wxInputStream::wxInputStream()
43 wxInputStream::~wxInputStream()
47 #define BUF_TEMP_SIZE 10000
49 wxInputStream
& wxInputStream::Read(wxOutputStream
& stream_out
)
51 char buf
[BUF_TEMP_SIZE
];
52 size_t bytes_read
= BUF_TEMP_SIZE
;
54 while (bytes_read
== BUF_TEMP_SIZE
&& !stream_out
.Bad()) {
55 bytes_read
= Read(buf
, bytes_read
).LastRead();
57 stream_out
.Write(buf
, bytes_read
);
62 wxOutputStream::wxOutputStream()
67 wxOutputStream::~wxOutputStream()
71 wxOutputStream
& wxOutputStream::Write(wxInputStream
& stream_in
)
73 stream_in
.Read(*this);
77 wxFilterInputStream::wxFilterInputStream(wxInputStream
& stream
)
80 m_parent_i_stream
= &stream
;
83 wxFilterInputStream::~wxFilterInputStream()
87 wxFilterOutputStream::wxFilterOutputStream(wxOutputStream
& stream
)
90 m_parent_o_stream
= &stream
;
93 wxFilterOutputStream::~wxFilterOutputStream()