]>
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"
22 #include "wx/filefn.h" // for off_t and wxSeekMode
25 * wxStream: base classes
31 virtual ~wxInputStream();
33 virtual wxInputStream
& Read(void *buffer
, size_t size
) = 0;
34 wxInputStream
& Read(wxOutputStream
& stream_out
);
36 virtual off_t
SeekI(off_t pos
, wxSeekMode mode
= wxFromStart
) = 0;
37 virtual off_t
TellI() const = 0;
39 virtual bool Eof() const = 0;
40 virtual size_t LastRead() const = 0;
42 wxInputStream
& operator>>(wxOutputStream
& out
) { return Read(out
); }
45 class wxOutputStream
{
48 virtual ~wxOutputStream();
50 virtual wxOutputStream
& Write(const void *buffer
, size_t size
) = 0;
51 wxOutputStream
& Write(wxInputStream
& stream_in
);
53 virtual off_t
SeekO(off_t pos
, wxSeekMode mode
= wxFromStart
) = 0;
54 virtual off_t
TellO() const = 0;
56 virtual bool Bad() const = 0;
57 virtual size_t LastWrite() const = 0;
59 virtual void Sync() {}
66 class wxFilterInputStream
: public wxInputStream
{
68 wxFilterInputStream(wxInputStream
& stream
);
69 virtual ~wxFilterInputStream();
71 virtual wxInputStream
& Read(void *buffer
, size_t size
)
72 { return m_parent_i_stream
->Read(buffer
, size
); }
73 virtual off_t
SeekI(off_t pos
, wxSeekMode mode
= wxFromStart
)
74 { return m_parent_i_stream
->SeekI(pos
, mode
); }
75 virtual off_t
TellI() const
76 { return m_parent_i_stream
->TellI(); }
78 virtual bool Eof() const { return m_parent_i_stream
->Eof(); }
79 virtual size_t LastRead() const { return m_parent_i_stream
->LastRead(); }
82 wxInputStream
*m_parent_i_stream
;
85 class wxFilterOutputStream
: public wxOutputStream
{
87 wxFilterOutputStream(wxOutputStream
& stream
);
88 virtual ~wxFilterOutputStream();
90 virtual wxOutputStream
& Write(const void *buffer
, size_t size
)
91 { return m_parent_o_stream
->Write(buffer
, size
); }
92 virtual off_t
SeekO(off_t pos
, wxSeekMode mode
= wxFromStart
)
93 { return m_parent_o_stream
->SeekO(pos
, mode
); }
94 virtual off_t
TellO() const
95 { return m_parent_o_stream
->TellO(); }
97 virtual bool Bad() const { return m_parent_o_stream
->Bad(); }
98 virtual size_t LastWrite() const { return m_parent_o_stream
->LastWrite(); }
101 wxOutputStream
*m_parent_o_stream
;