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