]>
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 _WX_WXMMSTREAM_H__
12 #define _WX_WXMMSTREAM_H__
14 #include <wx/stream.h>
18 class wxMemoryInputStream
: public wxInputStream
{
23 wxMemoryInputStream(const char *data
, size_t length
);
24 virtual ~wxMemoryInputStream();
25 virtual size_t GetSize() const { return m_length
; }
29 wxStreamBuffer
*InputStreamBuffer() const { return m_i_streambuf
; }
32 wxStreamBuffer
*m_i_streambuf
;
35 size_t OnSysRead(void *buffer
, size_t nbytes
);
36 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
37 off_t
OnSysTell() const;
40 class wxMemoryOutputStream
: public wxOutputStream
{
42 wxMemoryOutputStream(char *data
= NULL
, size_t length
= 0);
43 virtual ~wxMemoryOutputStream();
44 virtual size_t GetSize() const { return m_o_streambuf
->GetLastAccess(); }
46 wxStreamBuffer
*OutputStreamBuffer() const { return m_o_streambuf
; }
48 size_t CopyTo(char *buffer
, size_t len
) const;
51 wxStreamBuffer
*m_o_streambuf
;
54 size_t OnSysWrite(const void *buffer
, size_t nbytes
);
55 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
56 off_t
OnSysTell() const;