]>
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 #include "wx/object.h"
17 #include "wx/stream.h"
19 #if !USE_SHARED_LIBRARY
20 IMPLEMENT_ABSTRACT_CLASS(wxInputStream
, wxObject
)
21 IMPLEMENT_ABSTRACT_CLASS(wxOutputStream
, wxObject
)
22 IMPLEMENT_ABSTRACT_CLASS2(wxStream
, wxInputStream
, wxOutputStream
)
23 IMPLEMENT_CLASS(wxFilterInputStream
, wxInputStream
)
26 wxInputStream::wxInputStream()
31 wxInputStream::~wxInputStream()
35 #define BUF_TEMP_SIZE 10000
37 wxInputStream
& wxInputStream::Read(wxOutputStream
& stream_out
)
39 char buf
[BUF_TEMP_SIZE
];
40 size_t bytes_read
= BUF_TEMP_SIZE
;
42 while (bytes_read
== BUF_TEMP_SIZE
&& !stream_out
.Bad()) {
43 bytes_read
= Read(buf
, bytes_read
).LastRead();
45 stream_out
.Write(buf
, bytes_read
);
50 wxOutputStream::wxOutputStream()
55 wxOutputStream::~wxOutputStream()
59 wxOutputStream
& wxOutputStream::Write(wxInputStream
& stream_in
)
61 stream_in
.Read(*this);
65 wxFilterInputStream::wxFilterInputStream(wxInputStream
& stream
)
68 m_parent_i_stream
= &stream
;
71 wxFilterInputStream::~wxFilterInputStream()
75 wxFilterOutputStream::wxFilterOutputStream(wxOutputStream
& stream
)
78 m_parent_o_stream
= &stream
;
81 wxFilterOutputStream::~wxFilterOutputStream()