]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/stream.h
692d522305a6b3b30a8489b52418abce253431ef
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>
28 * wxStream: base classes
32 wxFromStart
, wxFromCurrent
, wxFromEnd
36 class wxInputStream
: virtual public wxObject
{
37 DECLARE_ABSTRACT_CLASS(wxInputStream
)
40 virtual ~wxInputStream();
42 virtual wxInputStream
& Read(void *buffer
, size_t size
) = 0;
43 wxInputStream
& Read(wxOutputStream
& stream_out
);
45 virtual off_t
SeekI(off_t pos
, wxSeekMode mode
= wxFromStart
) = 0;
46 virtual off_t
TellI() const = 0;
48 virtual bool Eof() const = 0;
49 virtual size_t LastRead() const = 0;
51 wxInputStream
& operator>>(wxOutputStream
& out
) { return Read(out
); }
54 class wxOutputStream
: virtual public wxObject
{
55 DECLARE_ABSTRACT_CLASS(wxOutputStream
)
58 virtual ~wxOutputStream();
60 virtual wxOutputStream
& Write(const void *buffer
, size_t size
) = 0;
61 wxOutputStream
& Write(wxInputStream
& stream_in
);
63 virtual off_t
SeekO(off_t pos
, wxSeekMode mode
= wxFromStart
) = 0;
64 virtual off_t
TellO() const = 0;
66 virtual bool Bad() const = 0;
67 virtual size_t LastWrite() const = 0;
69 virtual void Sync() {}
76 class wxFilterInputStream
: public wxInputStream
{
77 DECLARE_CLASS(wxFilterInputStream
)
79 wxFilterInputStream(wxInputStream
& stream
);
80 virtual ~wxFilterInputStream();
82 virtual wxInputStream
& Read(void *buffer
, size_t size
)
83 { return m_parent_i_stream
->Read(buffer
, size
); }
84 virtual off_t
SeekI(off_t pos
, wxSeekMode mode
= wxFromStart
)
85 { return m_parent_i_stream
->SeekI(pos
, mode
); }
86 virtual off_t
TellI() const
87 { return m_parent_i_stream
->TellI(); }
89 virtual bool Eof() const { return m_parent_i_stream
->Eof(); }
90 virtual size_t LastRead() const { return m_parent_i_stream
->LastRead(); }
93 wxInputStream
*m_parent_i_stream
;
96 class wxFilterOutputStream
: public wxOutputStream
{
97 DECLARE_CLASS(wxFilterOutputStream
)
99 wxFilterOutputStream(wxOutputStream
& stream
);
100 virtual ~wxFilterOutputStream();
102 virtual wxOutputStream
& Write(const void *buffer
, size_t size
)
103 { return m_parent_o_stream
->Write(buffer
, size
); }
104 virtual off_t
SeekO(off_t pos
, wxSeekMode mode
= wxFromStart
)
105 { return m_parent_o_stream
->SeekO(pos
, mode
); }
106 virtual off_t
TellO() const
107 { return m_parent_o_stream
->TellO(); }
109 virtual bool Bad() const { return m_parent_o_stream
->Bad(); }
110 virtual size_t LastWrite() const { return m_parent_o_stream
->LastWrite(); }
113 wxOutputStream
*m_parent_o_stream
;