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