]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mstream.h
replace wxGetMultipleChoices() with wxGetSelectedChoices() which allows to distinguis...
[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
b5dbe15d 21class WXDLLIMPEXP_FWD_BASE wxMemoryOutputStream;
96461cc2 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);
76447155
VZ
28 wxMemoryInputStream(wxInputStream& stream,
29 wxFileOffset lenFile = wxInvalidOffset)
30 {
31 InitFromStream(stream, lenFile);
32 }
33 wxMemoryInputStream(wxMemoryInputStream& stream)
2a230426 34 : wxInputStream()
76447155
VZ
35 {
36 InitFromStream(stream, wxInvalidOffset);
37 }
38
83141d3a 39 virtual ~wxMemoryInputStream();
588066b7 40 virtual wxFileOffset GetLength() const { return m_length; }
3c70014d 41 virtual bool IsSeekable() const { return true; }
83141d3a 42
2d76b6d8
VZ
43 virtual char Peek();
44 virtual bool CanRead() const;
79c3e0e1 45
67c8c225
VZ
46 wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; }
47
40ff126a 48#if WXWIN_COMPATIBILITY_2_6
67c8c225 49 // deprecated, compatibility only
40ff126a
WS
50 wxDEPRECATED( wxStreamBuffer *InputStreamBuffer() const );
51#endif // WXWIN_COMPATIBILITY_2_6
c980c992 52
83141d3a
VZ
53protected:
54 wxStreamBuffer *m_i_streambuf;
0d631778 55
83141d3a 56 size_t OnSysRead(void *buffer, size_t nbytes);
4004775e
RL
57 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
58 wxFileOffset OnSysTell() const;
c980c992 59
83141d3a 60private:
76447155
VZ
61 // common part of ctors taking wxInputStream
62 void InitFromStream(wxInputStream& stream, wxFileOffset lenFile);
63
83141d3a 64 size_t m_length;
22f3361e 65
76447155 66 // copy ctor is implemented above: it copies the other stream in this one
6285e36b 67 DECLARE_ABSTRACT_CLASS(wxMemoryInputStream)
c0c133e1 68 wxDECLARE_NO_ASSIGN_CLASS(wxMemoryInputStream);
32fc4afb
GL
69};
70
bddd7a8d 71class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream
83141d3a
VZ
72{
73public:
67c8c225
VZ
74 // if data is !NULL it must be allocated with malloc()
75 wxMemoryOutputStream(void *data = NULL, size_t length = 0);
83141d3a 76 virtual ~wxMemoryOutputStream();
588066b7 77 virtual wxFileOffset GetLength() const { return m_o_streambuf->GetLastAccess(); }
3c70014d 78 virtual bool IsSeekable() const { return true; }
0d631778 79
67c8c225 80 size_t CopyTo(void *buffer, size_t len) const;
c980c992 81
67c8c225
VZ
82 wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; }
83
40ff126a 84#if WXWIN_COMPATIBILITY_2_6
67c8c225 85 // deprecated, compatibility only
40ff126a
WS
86 wxDEPRECATED( wxStreamBuffer *OutputStreamBuffer() const );
87#endif // WXWIN_COMPATIBILITY_2_6
a324a7bc 88
83141d3a
VZ
89protected:
90 wxStreamBuffer *m_o_streambuf;
c980c992 91
83141d3a
VZ
92protected:
93 size_t OnSysWrite(const void *buffer, size_t nbytes);
4004775e
RL
94 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
95 wxFileOffset OnSysTell() const;
22f3361e 96
6285e36b 97 DECLARE_DYNAMIC_CLASS(wxMemoryOutputStream)
c0c133e1 98 wxDECLARE_NO_COPY_CLASS(wxMemoryOutputStream);
32fc4afb
GL
99};
100
40ff126a
WS
101#if WXWIN_COMPATIBILITY_2_6
102 inline wxStreamBuffer *wxMemoryInputStream::InputStreamBuffer() const { return m_i_streambuf; }
103 inline wxStreamBuffer *wxMemoryOutputStream::OutputStreamBuffer() const { return m_o_streambuf; }
104#endif // WXWIN_COMPATIBILITY_2_6
105
32fc4afb 106#endif
ce4169a4
RR
107 // wxUSE_STREAMS
108
109#endif
cc985fac 110 // _WX_WXMMSTREAM_H__