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 WXDLLIMPEXP_BASE 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;
44 DECLARE_NO_COPY_CLASS(wxMemoryInputStream
)
47 class WXDLLIMPEXP_BASE wxMemoryOutputStream
: public wxOutputStream
50 // if data is !NULL it must be allocated with malloc()
51 wxMemoryOutputStream(void *data
= NULL
, size_t length
= 0);
52 virtual ~wxMemoryOutputStream();
53 virtual size_t GetSize() const { return m_o_streambuf
->GetLastAccess(); }
55 size_t CopyTo(void *buffer
, size_t len
) const;
57 wxStreamBuffer
*GetOutputStreamBuffer() const { return m_o_streambuf
; }
59 // deprecated, compatibility only
60 wxStreamBuffer
*OutputStreamBuffer() const { return m_o_streambuf
; }
63 wxStreamBuffer
*m_o_streambuf
;
66 size_t OnSysWrite(const void *buffer
, size_t nbytes
);
67 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
68 off_t
OnSysTell() const;
70 DECLARE_NO_COPY_CLASS(wxMemoryOutputStream
)