]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mstream.h
subclass all updown controls in notebooks, not just the first one
[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; }
83141d3a 30 virtual bool Eof() const;
3c70014d 31 virtual bool IsSeekable() const { return true; }
83141d3a
VZ
32
33 char Peek();
79c3e0e1 34
67c8c225
VZ
35 wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; }
36
37 // deprecated, compatibility only
83141d3a 38 wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; }
c980c992 39
83141d3a
VZ
40protected:
41 wxStreamBuffer *m_i_streambuf;
0d631778 42
83141d3a 43 size_t OnSysRead(void *buffer, size_t nbytes);
4004775e
RL
44 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
45 wxFileOffset OnSysTell() const;
c980c992 46
83141d3a
VZ
47private:
48 size_t m_length;
22f3361e
VZ
49
50 DECLARE_NO_COPY_CLASS(wxMemoryInputStream)
32fc4afb
GL
51};
52
bddd7a8d 53class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream
83141d3a
VZ
54{
55public:
67c8c225
VZ
56 // if data is !NULL it must be allocated with malloc()
57 wxMemoryOutputStream(void *data = NULL, size_t length = 0);
83141d3a 58 virtual ~wxMemoryOutputStream();
588066b7 59 virtual wxFileOffset GetLength() const { return m_o_streambuf->GetLastAccess(); }
3c70014d 60 virtual bool IsSeekable() const { return true; }
0d631778 61
67c8c225 62 size_t CopyTo(void *buffer, size_t len) const;
c980c992 63
67c8c225
VZ
64 wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; }
65
66 // deprecated, compatibility only
67 wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
a324a7bc 68
83141d3a
VZ
69protected:
70 wxStreamBuffer *m_o_streambuf;
c980c992 71
83141d3a
VZ
72protected:
73 size_t OnSysWrite(const void *buffer, size_t nbytes);
4004775e
RL
74 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
75 wxFileOffset OnSysTell() const;
22f3361e
VZ
76
77 DECLARE_NO_COPY_CLASS(wxMemoryOutputStream)
32fc4afb
GL
78};
79
32fc4afb 80#endif
ce4169a4
RR
81 // wxUSE_STREAMS
82
83#endif
cc985fac
PA
84 // _WX_WXMMSTREAM_H__
85