]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/mstream.h
641c0d42447fd967e1e12fe0aa3667d3fbb1497d
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Memory stream classes
4 // Author: Guilhem Lavaux
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __WXMMSTREAM_H__
12 #define __WXMMSTREAM_H__
14 #include <wx/stream.h>
16 class wxMemoryStreamBase
{
19 virtual ~wxMemoryStreamBase();
21 bool ChangeBufferSize(size_t new_length
);
30 class wxMemoryInputStream
: virtual public wxMemoryStreamBase
, public wxInputStream
{
31 DECLARE_CLASS(wxMemoryInputStream
)
33 wxMemoryInputStream(const char *data
, size_t length
);
34 virtual ~wxMemoryInputStream();
36 wxInputStream
& Read(void *buffer
, size_t size
);
37 off_t
SeekI(off_t pos
, wxSeekMode mode
);
38 off_t
TellI() const { return m_position_i
; }
40 bool Eof() const { return m_eof
; }
41 size_t LastRead() const { return m_lastread
; }
49 class wxMemoryOutputStream
: virtual public wxMemoryStreamBase
, public wxOutputStream
{
50 DECLARE_CLASS(wxMemoryOutputStream
)
52 wxMemoryOutputStream(char *data
= NULL
, size_t length
= 0);
53 virtual ~wxMemoryOutputStream();
55 wxOutputStream
& Write(const void *buffer
, size_t size
);
56 off_t
SeekO(off_t pos
, wxSeekMode mode
);
57 off_t
TellO() const { return m_position_o
; }
59 bool Bad() const { return m_bad
; }
60 size_t LastWrite() const { return m_lastwrite
; }
62 char *GetData() { return m_buffer
; }
63 size_t GetLength() { return m_length
; }
71 class wxMemoryStream
: public wxMemoryInputStream
, public wxMemoryOutputStream
{
72 DECLARE_CLASS(wxMemoryStream
)
74 wxMemoryStream(char *data
= NULL
, size_t length
= 0);
75 virtual ~wxMemoryStream();