]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/stream.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: "wxWindows stream" base classes
4 // Author: Guilhem Lavaux
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WXSTREAM_H__
13 #define __WXSTREAM_H__
20 #include <wx/object.h>
21 #include <wx/string.h>
24 * wxStream: base classes
28 wxBeginPosition
= 0, wxCurrentPosition
= 1, wxEndPosition
= 2
32 class wxInputStream
: public wxObject
{
33 DECLARE_ABSTRACT_CLASS(wxInputStream
)
36 virtual ~wxInputStream();
38 virtual wxInputStream
& Read(void *buffer
, size_t size
) = 0;
39 wxInputStream
& Read(wxOutputStream
& stream_out
);
41 virtual size_t SeekI(int pos
, wxWhenceType whence
= wxBeginPosition
) = 0;
42 virtual size_t TellI() const = 0;
44 virtual bool Eof() const = 0;
45 virtual size_t LastRead() const = 0;
48 class wxOutputStream
: public wxObject
{
49 DECLARE_ABSTRACT_CLASS(wxOutputStream
)
52 virtual ~wxOutputStream();
54 virtual wxOutputStream
& Write(const void *buffer
, size_t size
) = 0;
55 wxOutputStream
& Write(wxInputStream
& stream_in
);
57 virtual size_t SeekO(int pos
, wxWhenceType whence
= wxBeginPosition
) = 0;
58 virtual size_t TellO() const = 0;
60 virtual bool Bad() const = 0;
61 virtual size_t LastWrite() const = 0;
63 virtual void Sync() {}
66 class wxStream
: public wxInputStream
, public wxOutputStream
{
67 DECLARE_ABSTRACT_CLASS(wxStream
)
69 wxStream() : wxInputStream(), wxOutputStream() {}
70 virtual ~wxStream() {}
77 class wxFilterInputStream
: public wxInputStream
{
78 DECLARE_CLASS(wxFilterInputStream
)
80 wxFilterInputStream(wxInputStream
& stream
);
81 virtual ~wxFilterInputStream();
83 virtual wxInputStream
& Read(void *buffer
, size_t size
)
84 { return m_parent_i_stream
->Read(buffer
, size
); }
85 virtual size_t SeekI(int pos
, wxWhenceType whence
= wxBeginPosition
)
86 { return m_parent_i_stream
->SeekI(pos
, whence
); }
88 virtual bool Eof() const { return m_parent_i_stream
->Eof(); }
89 virtual size_t LastRead() const { return m_parent_i_stream
->LastRead(); }
91 wxInputStream
*m_parent_i_stream
;
94 class wxFilterOutputStream
: public wxOutputStream
{
95 DECLARE_CLASS(wxFilterOutputStream
)
97 wxFilterOutputStream(wxOutputStream
& stream
);
98 virtual ~wxFilterOutputStream();
100 virtual wxOutputStream
& Write(const void *buffer
, size_t size
)
101 { return m_parent_o_stream
->Write(buffer
, size
); }
102 virtual size_t SeekO(int pos
, wxWhenceType whence
= wxBeginPosition
)
103 { return m_parent_o_stream
->SeekO(pos
, whence
); }
105 virtual bool Bad() const { return m_parent_o_stream
->Bad(); }
106 virtual size_t LastWrite() const { return m_parent_o_stream
->LastWrite(); }
109 wxOutputStream
*m_parent_o_stream
;