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 void *data
, size_t length
);
23 virtual ~wxMemoryInputStream();
24 virtual size_t GetSize() const { return m_length
; }
25 virtual bool Eof() const;
29 wxStreamBuffer
*GetInputStreamBuffer() const { return m_i_streambuf
; }
31 // deprecated, compatibility only
32 wxStreamBuffer
*InputStreamBuffer() const { return m_i_streambuf
; }
35 wxStreamBuffer
*m_i_streambuf
;
37 size_t OnSysRead(void *buffer
, size_t nbytes
);
38 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
39 off_t
OnSysTell() const;
45 class WXDLLEXPORT wxMemoryOutputStream
: public wxOutputStream
48 // if data is !NULL it must be allocated with malloc()
49 wxMemoryOutputStream(void *data
= NULL
, size_t length
= 0);
50 virtual ~wxMemoryOutputStream();
51 virtual size_t GetSize() const { return m_o_streambuf
->GetLastAccess(); }
53 size_t CopyTo(void *buffer
, size_t len
) const;
55 wxStreamBuffer
*GetOutputStreamBuffer() const { return m_o_streambuf
; }
57 // deprecated, compatibility only
58 wxStreamBuffer
*OutputStreamBuffer() const { return m_o_streambuf
; }
61 wxStreamBuffer
*m_o_streambuf
;
64 size_t OnSysWrite(const void *buffer
, size_t nbytes
);
65 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
66 off_t
OnSysTell() const;