]>
Commit | Line | Data |
---|---|---|
3d4c6a21 GL |
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 | ||
db138a4c JS |
16 | // For compilers that support precompilation, includes "wx.h". |
17 | #include "wx/wxprec.h" | |
79c3e0e1 | 18 | #include <wx/stream.h> |
db138a4c JS |
19 | |
20 | #ifdef __BORLANDC__ | |
21 | #pragma hdrstop | |
22 | #endif | |
23 | ||
3d4c6a21 GL |
24 | #if !USE_SHARED_LIBRARY |
25 | IMPLEMENT_ABSTRACT_CLASS(wxInputStream, wxObject) | |
26 | IMPLEMENT_ABSTRACT_CLASS(wxOutputStream, wxObject) | |
3d4c6a21 | 27 | IMPLEMENT_CLASS(wxFilterInputStream, wxInputStream) |
f0b07807 | 28 | IMPLEMENT_CLASS(wxFilterOutputStream, wxOutputStream) |
3d4c6a21 GL |
29 | #endif |
30 | ||
31 | wxInputStream::wxInputStream() | |
32 | : wxObject() | |
33 | { | |
34 | } | |
35 | ||
36 | wxInputStream::~wxInputStream() | |
37 | { | |
38 | } | |
39 | ||
40 | #define BUF_TEMP_SIZE 10000 | |
41 | ||
42 | wxInputStream& wxInputStream::Read(wxOutputStream& stream_out) | |
43 | { | |
44 | char buf[BUF_TEMP_SIZE]; | |
45 | size_t bytes_read = BUF_TEMP_SIZE; | |
46 | ||
47 | while (bytes_read == BUF_TEMP_SIZE && !stream_out.Bad()) { | |
48 | bytes_read = Read(buf, bytes_read).LastRead(); | |
49 | ||
50 | stream_out.Write(buf, bytes_read); | |
51 | } | |
52 | return *this; | |
53 | } | |
54 | ||
55 | wxOutputStream::wxOutputStream() | |
56 | : wxObject() | |
57 | { | |
58 | } | |
59 | ||
60 | wxOutputStream::~wxOutputStream() | |
61 | { | |
62 | } | |
63 | ||
64 | wxOutputStream& wxOutputStream::Write(wxInputStream& stream_in) | |
65 | { | |
66 | stream_in.Read(*this); | |
67 | return *this; | |
68 | } | |
69 | ||
70 | wxFilterInputStream::wxFilterInputStream(wxInputStream& stream) | |
71 | : wxInputStream() | |
72 | { | |
219f895a | 73 | m_parent_i_stream = &stream; |
3d4c6a21 GL |
74 | } |
75 | ||
76 | wxFilterInputStream::~wxFilterInputStream() | |
77 | { | |
78 | } | |
219f895a RR |
79 | |
80 | wxFilterOutputStream::wxFilterOutputStream(wxOutputStream& stream) | |
81 | : wxOutputStream() | |
82 | { | |
83 | m_parent_o_stream = &stream; | |
84 | } | |
85 | ||
86 | wxFilterOutputStream::~wxFilterOutputStream() | |
87 | { | |
88 | } |