]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mstream.h
Makes custom cell activatable.
[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
65571936 9// Licence: wxWindows licence
32fc4afb 10/////////////////////////////////////////////////////////////////////////////
83141d3a 11
34138703
JS
12#ifndef _WX_WXMMSTREAM_H__
13#define _WX_WXMMSTREAM_H__
32fc4afb 14
2ecf902b 15#include "wx/defs.h"
32fc4afb 16
ce4169a4
RR
17#if wxUSE_STREAMS
18
2ecf902b
WS
19#include "wx/stream.h"
20
96461cc2
VZ
21class WXDLLIMPEXP_BASE wxMemoryOutputStream;
22
bddd7a8d 23class WXDLLIMPEXP_BASE wxMemoryInputStream : public wxInputStream
83141d3a
VZ
24{
25public:
67c8c225 26 wxMemoryInputStream(const void *data, size_t length);
96461cc2 27 wxMemoryInputStream(const wxMemoryOutputStream& stream);
83141d3a 28 virtual ~wxMemoryInputStream();
588066b7 29 virtual wxFileOffset GetLength() const { return m_length; }
3c70014d 30 virtual bool IsSeekable() const { return true; }
83141d3a
VZ
31
32 char Peek();
79c3e0e1 33
67c8c225
VZ
34 wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; }
35
36 // deprecated, compatibility only
83141d3a 37 wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; }
c980c992 38
83141d3a
VZ
39protected:
40 wxStreamBuffer *m_i_streambuf;
0d631778 41
83141d3a 42 size_t OnSysRead(void *buffer, size_t nbytes);
4004775e
RL
43 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
44 wxFileOffset OnSysTell() const;
c980c992 45
83141d3a
VZ
46private:
47 size_t m_length;
22f3361e
VZ
48
49 DECLARE_NO_COPY_CLASS(wxMemoryInputStream)
32fc4afb
GL
50};
51
bddd7a8d 52class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream
83141d3a
VZ
53{
54public:
67c8c225
VZ
55 // if data is !NULL it must be allocated with malloc()
56 wxMemoryOutputStream(void *data = NULL, size_t length = 0);
83141d3a 57 virtual ~wxMemoryOutputStream();
588066b7 58 virtual wxFileOffset GetLength() const { return m_o_streambuf->GetLastAccess(); }
3c70014d 59 virtual bool IsSeekable() const { return true; }
0d631778 60
67c8c225 61 size_t CopyTo(void *buffer, size_t len) const;
c980c992 62
67c8c225
VZ
63 wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; }
64
65 // deprecated, compatibility only
66 wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
a324a7bc 67
83141d3a
VZ
68protected:
69 wxStreamBuffer *m_o_streambuf;
c980c992 70
83141d3a
VZ
71protected:
72 size_t OnSysWrite(const void *buffer, size_t nbytes);
4004775e
RL
73 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
74 wxFileOffset OnSysTell() const;
22f3361e
VZ
75
76 DECLARE_NO_COPY_CLASS(wxMemoryOutputStream)
32fc4afb
GL
77};
78
32fc4afb 79#endif
ce4169a4
RR
80 // wxUSE_STREAMS
81
82#endif
cc985fac
PA
83 // _WX_WXMMSTREAM_H__
84