]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/mstream.h
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
: public wxStream
{
18 wxMemoryStreamBase(char *data
, size_t length
, int iolimit
);
19 virtual ~wxMemoryStreamBase();
22 wxInputStream
& Read(void *buffer
, size_t size
);
23 size_t SeekI(int pos
, wxWhenceType whence
= wxBeginPosition
);
24 size_t TellI() const { return m_position_i
; }
26 bool Eof() const { return m_eof
; }
27 size_t LastRead() const { return m_lastread
; }
30 wxOutputStream
& Write(const void *buffer
, size_t size
);
31 size_t SeekO(int pos
, wxWhenceType whence
= wxBeginPosition
);
32 size_t TellO() const { return m_position_o
; }
34 bool Bad() const { return m_bad
; }
35 size_t LastWrite() const { return m_lastwrite
; }
39 bool ChangeBufferSize(size_t new_length
);
42 bool m_bad
, m_eof
, m_persistent
;
43 size_t m_lastread
, m_lastwrite
;
45 size_t m_position_i
, m_position_o
;
51 class wxMemoryInputStream
: public wxMemoryStreamBase
{
53 wxMemoryInputStream(char *data
, size_t length
)
54 : wxMemoryStreamBase(data
, length
, 1)
58 class wxMemoryOutputStream
: public wxMemoryStreamBase
{
60 wxMemoryOutputStream(char *data
= NULL
, size_t length
= 0)
61 : wxMemoryStreamBase(data
, length
, 2)
65 class wxMemoryStream
: public wxMemoryStreamBase
{
67 wxMemoryStream(char *data
= NULL
, size_t length
= 0)
68 : wxMemoryStreamBase(data
, length
, 0)