]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mstream.h
Applied patch for wxComboBox and wxListBox to
[wxWidgets.git] / include / wx / mstream.h
CommitLineData
32fc4afb 1/////////////////////////////////////////////////////////////////////////////
67c8c225 2// Name: wx/mstream.h
32fc4afb
GL
3// Purpose: Memory stream classes
4// Author: Guilhem Lavaux
5// Modified by:
6// Created: 11/07/98
7// RCS-ID: $Id$
8// Copyright: (c) Guilhem Lavaux
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
83141d3a 11
34138703
JS
12#ifndef _WX_WXMMSTREAM_H__
13#define _WX_WXMMSTREAM_H__
32fc4afb 14
ed58dbea 15#include "wx/stream.h"
32fc4afb 16
ce4169a4
RR
17#if wxUSE_STREAMS
18
83141d3a
VZ
19class WXDLLEXPORT wxMemoryInputStream : public wxInputStream
20{
21public:
67c8c225 22 wxMemoryInputStream(const void *data, size_t length);
83141d3a
VZ
23 virtual ~wxMemoryInputStream();
24 virtual size_t GetSize() const { return m_length; }
25 virtual bool Eof() const;
26
27 char Peek();
79c3e0e1 28
67c8c225
VZ
29 wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; }
30
31 // deprecated, compatibility only
83141d3a 32 wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; }
c980c992 33
83141d3a
VZ
34protected:
35 wxStreamBuffer *m_i_streambuf;
0d631778 36
83141d3a
VZ
37 size_t OnSysRead(void *buffer, size_t nbytes);
38 off_t OnSysSeek(off_t pos, wxSeekMode mode);
39 off_t OnSysTell() const;
c980c992 40
83141d3a
VZ
41private:
42 size_t m_length;
32fc4afb
GL
43};
44
83141d3a
VZ
45class WXDLLEXPORT wxMemoryOutputStream : public wxOutputStream
46{
47public:
67c8c225
VZ
48 // if data is !NULL it must be allocated with malloc()
49 wxMemoryOutputStream(void *data = NULL, size_t length = 0);
83141d3a
VZ
50 virtual ~wxMemoryOutputStream();
51 virtual size_t GetSize() const { return m_o_streambuf->GetLastAccess(); }
0d631778 52
67c8c225 53 size_t CopyTo(void *buffer, size_t len) const;
c980c992 54
67c8c225
VZ
55 wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; }
56
57 // deprecated, compatibility only
58 wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
a324a7bc 59
83141d3a
VZ
60protected:
61 wxStreamBuffer *m_o_streambuf;
c980c992 62
83141d3a
VZ
63protected:
64 size_t OnSysWrite(const void *buffer, size_t nbytes);
65 off_t OnSysSeek(off_t pos, wxSeekMode mode);
66 off_t OnSysTell() const;
32fc4afb
GL
67};
68
32fc4afb 69#endif
ce4169a4
RR
70 // wxUSE_STREAMS
71
72#endif
cc985fac
PA
73 // _WX_WXMMSTREAM_H__
74