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 wxFileOffset
GetLength() 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 wxFileOffset
OnSysSeek(wxFileOffset pos
, wxSeekMode mode
);
39 wxFileOffset
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 wxFileOffset
GetLength() 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 wxFileOffset
OnSysSeek(wxFileOffset pos
, wxSeekMode mode
);
68 wxFileOffset
OnSysTell() const;
70 DECLARE_NO_COPY_CLASS(wxMemoryOutputStream
)