stream compile fixes
[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 #include "wx/object.h"
17 #include "wx/stream.h"
18
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)
24 #endif
25
26 wxInputStream::wxInputStream()
27 : wxObject()
28 {
29 }
30
31 wxInputStream::~wxInputStream()
32 {
33 }
34
35 #define BUF_TEMP_SIZE 10000
36
37 wxInputStream& wxInputStream::Read(wxOutputStream& stream_out)
38 {
39 char buf[BUF_TEMP_SIZE];
40 size_t bytes_read = BUF_TEMP_SIZE;
41
42 while (bytes_read == BUF_TEMP_SIZE && !stream_out.Bad()) {
43 bytes_read = Read(buf, bytes_read).LastRead();
44
45 stream_out.Write(buf, bytes_read);
46 }
47 return *this;
48 }
49
50 wxOutputStream::wxOutputStream()
51 : wxObject()
52 {
53 }
54
55 wxOutputStream::~wxOutputStream()
56 {
57 }
58
59 wxOutputStream& wxOutputStream::Write(wxInputStream& stream_in)
60 {
61 stream_in.Read(*this);
62 return *this;
63 }
64
65 wxFilterInputStream::wxFilterInputStream(wxInputStream& stream)
66 : wxInputStream()
67 {
68 m_parent_i_stream = &stream;
69 }
70
71 wxFilterInputStream::~wxFilterInputStream()
72 {
73 }
74
75 wxFilterOutputStream::wxFilterOutputStream(wxOutputStream& stream)
76 : wxOutputStream()
77 {
78 m_parent_o_stream = &stream;
79 }
80
81 wxFilterOutputStream::~wxFilterOutputStream()
82 {
83 }