Removed streams from VC++ makefile for now; corrected typo in log.h
[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
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WX_PRECOMP
24 #include "wx/setup.h"
25 #endif
26
27 #include "wx/object.h"
28 #include "wx/stream.h"
29
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 #endif
36
37 wxInputStream::wxInputStream()
38 : wxObject()
39 {
40 }
41
42 wxInputStream::~wxInputStream()
43 {
44 }
45
46 #define BUF_TEMP_SIZE 10000
47
48 wxInputStream& wxInputStream::Read(wxOutputStream& stream_out)
49 {
50 char buf[BUF_TEMP_SIZE];
51 size_t bytes_read = BUF_TEMP_SIZE;
52
53 while (bytes_read == BUF_TEMP_SIZE && !stream_out.Bad()) {
54 bytes_read = Read(buf, bytes_read).LastRead();
55
56 stream_out.Write(buf, bytes_read);
57 }
58 return *this;
59 }
60
61 wxOutputStream::wxOutputStream()
62 : wxObject()
63 {
64 }
65
66 wxOutputStream::~wxOutputStream()
67 {
68 }
69
70 wxOutputStream& wxOutputStream::Write(wxInputStream& stream_in)
71 {
72 stream_in.Read(*this);
73 return *this;
74 }
75
76 wxFilterInputStream::wxFilterInputStream(wxInputStream& stream)
77 : wxInputStream()
78 {
79 m_parent_i_stream = &stream;
80 }
81
82 wxFilterInputStream::~wxFilterInputStream()
83 {
84 }
85
86 wxFilterOutputStream::wxFilterOutputStream(wxOutputStream& stream)
87 : wxOutputStream()
88 {
89 m_parent_o_stream = &stream;
90 }
91
92 wxFilterOutputStream::~wxFilterOutputStream()
93 {
94 }