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