]>
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/object.h"
15 #include "wx/stream.h"
17 class wxMemoryStreamBase
: public wxStream
{
18 DECLARE_CLASS(wxMemoryStreamBase
)
20 wxMemoryStreamBase(char *data
, size_t length
, int iolimit
);
21 virtual ~wxMemoryStreamBase();
24 wxInputStream
& Read(void *buffer
, size_t size
);
25 size_t SeekI(int pos
, wxWhenceType whence
= wxBeginPosition
);
26 size_t TellI() const { return m_position_i
; }
28 bool Eof() const { return m_eof
; }
29 size_t LastRead() const { return m_lastread
; }
32 wxOutputStream
& Write(const void *buffer
, size_t size
);
33 size_t SeekO(int pos
, wxWhenceType whence
= wxBeginPosition
);
34 size_t TellO() const { return m_position_o
; }
36 bool Bad() const { return m_bad
; }
37 size_t LastWrite() const { return m_lastwrite
; }
41 bool ChangeBufferSize(size_t new_length
);
44 bool m_bad
, m_eof
, m_persistent
;
45 size_t m_lastread
, m_lastwrite
;
47 size_t m_position_i
, m_position_o
;
53 class wxMemoryInputStream
: public wxMemoryStreamBase
{
54 DECLARE_CLASS(wxMemoryInputStream
)
56 wxMemoryInputStream(char *data
, size_t length
)
57 : wxMemoryStreamBase(data
, length
, 1)
61 class wxMemoryOutputStream
: public wxMemoryStreamBase
{
62 DECLARE_DYNAMIC_CLASS(wxMemoryOutputStream
)
64 wxMemoryOutputStream(char *data
= NULL
, size_t length
= 0)
65 : wxMemoryStreamBase(data
, length
, 2)
69 class wxMemoryStream
: public wxMemoryStreamBase
{
70 DECLARE_DYNAMIC_CLASS(wxMemoryStream
)
72 wxMemoryStream(char *data
= NULL
, size_t length
= 0)
73 : wxMemoryStreamBase(data
, length
, 0)