]>
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
{
19 virtual ~wxMemoryStreamBase();
21 bool ChangeBufferSize(size_t new_length
);
30 class wxMemoryInputStream
: virtual public wxMemoryStreamBase
, public wxInputStream
{
32 wxMemoryInputStream(const char *data
, size_t length
);
33 virtual ~wxMemoryInputStream();
37 size_t DoRead(void *buffer
, size_t size
);
38 off_t
DoSeekInput(off_t pos
, wxSeekMode mode
);
39 off_t
DoTellInput() const { return m_position_i
; }
45 class wxMemoryOutputStream
: virtual public wxMemoryStreamBase
, public wxOutputStream
{
47 wxMemoryOutputStream(char *data
= NULL
, size_t length
= 0);
48 virtual ~wxMemoryOutputStream();
50 char *GetData() { Sync(); return m_buffer
; }
51 size_t GetLength() { Sync(); return m_length
; }
55 size_t DoWrite(const void *buffer
, size_t size
);
56 off_t
DoSeekOutput(off_t pos
, wxSeekMode mode
);
57 off_t
DoTellOutput() const { return m_position_o
; }
63 class wxMemoryStream
: public wxMemoryInputStream
, public wxMemoryOutputStream
{
65 wxMemoryStream(char *data
= NULL
, size_t length
= 0);
66 virtual ~wxMemoryStream();