1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Memory stream classes
4 // Author: Guilhem Lavaux
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_WXMMSTREAM_H__
13 #define _WX_WXMMSTREAM_H__
15 #include "wx/stream.h"
19 class WXDLLEXPORT wxMemoryInputStream
: public wxInputStream
22 wxMemoryInputStream(const char *data
, size_t length
);
23 virtual ~wxMemoryInputStream();
24 virtual size_t GetSize() const { return m_length
; }
25 virtual bool Eof() const;
29 wxStreamBuffer
*InputStreamBuffer() const { return m_i_streambuf
; }
32 wxStreamBuffer
*m_i_streambuf
;
34 size_t OnSysRead(void *buffer
, size_t nbytes
);
35 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
36 off_t
OnSysTell() const;
42 class WXDLLEXPORT wxMemoryOutputStream
: public wxOutputStream
45 wxMemoryOutputStream(char *data
= NULL
, size_t length
= 0);
46 virtual ~wxMemoryOutputStream();
47 virtual size_t GetSize() const { return m_o_streambuf
->GetLastAccess(); }
49 wxStreamBuffer
*OutputStreamBuffer() const { return m_o_streambuf
; }
51 size_t CopyTo(char *buffer
, size_t len
) const;
54 wxStreamBuffer
*m_o_streambuf
;
57 size_t OnSysWrite(const void *buffer
, size_t nbytes
);
58 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
59 off_t
OnSysTell() const;