wxStream: wxInputStream and wxOutputStream don't inherit from wxObject anymore.
[wxWidgets.git] / src / common / stream.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: stream.cpp
3 // Purpose: wxStream base classes
4 // Author: Guilhem Lavaux
5 // Modified by:
6 // Created: 11/07/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "stream.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18 #include <wx/stream.h>
19
20 #ifdef __BORLANDC__
21 #pragma hdrstop
22 #endif
23
24 wxInputStream::wxInputStream()
25 {
26 }
27
28 wxInputStream::~wxInputStream()
29 {
30 }
31
32 #define BUF_TEMP_SIZE 10000
33
34 wxInputStream& wxInputStream::Read(wxOutputStream& stream_out)
35 {
36 char buf[BUF_TEMP_SIZE];
37 size_t bytes_read = BUF_TEMP_SIZE;
38
39 while (bytes_read == BUF_TEMP_SIZE && !stream_out.Bad()) {
40 bytes_read = Read(buf, bytes_read).LastRead();
41
42 stream_out.Write(buf, bytes_read);
43 }
44 return *this;
45 }
46
47 wxOutputStream::wxOutputStream()
48 {
49 }
50
51 wxOutputStream::~wxOutputStream()
52 {
53 }
54
55 wxOutputStream& wxOutputStream::Write(wxInputStream& stream_in)
56 {
57 stream_in.Read(*this);
58 return *this;
59 }
60
61 wxFilterInputStream::wxFilterInputStream(wxInputStream& stream)
62 : wxInputStream()
63 {
64 m_parent_i_stream = &stream;
65 }
66
67 wxFilterInputStream::~wxFilterInputStream()
68 {
69 }
70
71 wxFilterOutputStream::wxFilterOutputStream(wxOutputStream& stream)
72 : wxOutputStream()
73 {
74 m_parent_o_stream = &stream;
75 }
76
77 wxFilterOutputStream::~wxFilterOutputStream()
78 {
79 }