]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/stream.h
d22e9c0f9e83a8d778072d4fb33c38758e5c0bee
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"
22 #include "wx/filefn.h" // for off_t and wxSeekMode
25 * wxStream: base classes
28 class wxInputStream
: virtual public wxObject
{
29 DECLARE_ABSTRACT_CLASS(wxInputStream
)
32 virtual ~wxInputStream();
34 virtual wxInputStream
& Read(void *buffer
, size_t size
) = 0;
35 wxInputStream
& Read(wxOutputStream
& stream_out
);
37 virtual off_t
SeekI(off_t pos
, wxSeekMode mode
= wxFromStart
) = 0;
38 virtual off_t
TellI() const = 0;
40 virtual bool Eof() const = 0;
41 virtual size_t LastRead() const = 0;
43 wxInputStream
& operator>>(wxOutputStream
& out
) { return Read(out
); }
46 class wxOutputStream
: virtual public wxObject
{
47 DECLARE_ABSTRACT_CLASS(wxOutputStream
)
50 virtual ~wxOutputStream();
52 virtual wxOutputStream
& Write(const void *buffer
, size_t size
) = 0;
53 wxOutputStream
& Write(wxInputStream
& stream_in
);
55 virtual off_t
SeekO(off_t pos
, wxSeekMode mode
= wxFromStart
) = 0;
56 virtual off_t
TellO() const = 0;
58 virtual bool Bad() const = 0;
59 virtual size_t LastWrite() const = 0;
61 virtual void Sync() {}
68 class wxFilterInputStream
: public wxInputStream
{
69 DECLARE_CLASS(wxFilterInputStream
)
71 wxFilterInputStream(wxInputStream
& stream
);
72 virtual ~wxFilterInputStream();
74 virtual wxInputStream
& Read(void *buffer
, size_t size
)
75 { return m_parent_i_stream
->Read(buffer
, size
); }
76 virtual off_t
SeekI(off_t pos
, wxSeekMode mode
= wxFromStart
)
77 { return m_parent_i_stream
->SeekI(pos
, mode
); }
78 virtual off_t
TellI() const
79 { return m_parent_i_stream
->TellI(); }
81 virtual bool Eof() const { return m_parent_i_stream
->Eof(); }
82 virtual size_t LastRead() const { return m_parent_i_stream
->LastRead(); }
85 wxInputStream
*m_parent_i_stream
;
88 class wxFilterOutputStream
: public wxOutputStream
{
89 DECLARE_CLASS(wxFilterOutputStream
)
91 wxFilterOutputStream(wxOutputStream
& stream
);
92 virtual ~wxFilterOutputStream();
94 virtual wxOutputStream
& Write(const void *buffer
, size_t size
)
95 { return m_parent_o_stream
->Write(buffer
, size
); }
96 virtual off_t
SeekO(off_t pos
, wxSeekMode mode
= wxFromStart
)
97 { return m_parent_o_stream
->SeekO(pos
, mode
); }
98 virtual off_t
TellO() const
99 { return m_parent_o_stream
->TellO(); }
101 virtual bool Bad() const { return m_parent_o_stream
->Bad(); }
102 virtual size_t LastWrite() const { return m_parent_o_stream
->LastWrite(); }
105 wxOutputStream
*m_parent_o_stream
;