]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/mstream.h
Applied wxPoem, wxSystemSettings, sizing, install doc patches
[wxWidgets.git] / include / wx / mstream.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/mstream.h
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/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_WXMMSTREAM_H__
13#define _WX_WXMMSTREAM_H__
14
15#include "wx/stream.h"
16
17#if wxUSE_STREAMS
18
19class WXDLLEXPORT wxMemoryInputStream : public wxInputStream
20{
21public:
22 wxMemoryInputStream(const void *data, size_t length);
23 virtual ~wxMemoryInputStream();
24 virtual size_t GetSize() const { return m_length; }
25 virtual bool Eof() const;
26
27 char Peek();
28
29 wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; }
30
31 // deprecated, compatibility only
32 wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; }
33
34protected:
35 wxStreamBuffer *m_i_streambuf;
36
37 size_t OnSysRead(void *buffer, size_t nbytes);
38 off_t OnSysSeek(off_t pos, wxSeekMode mode);
39 off_t OnSysTell() const;
40
41private:
42 size_t m_length;
43};
44
45class WXDLLEXPORT wxMemoryOutputStream : public wxOutputStream
46{
47public:
48 // if data is !NULL it must be allocated with malloc()
49 wxMemoryOutputStream(void *data = NULL, size_t length = 0);
50 virtual ~wxMemoryOutputStream();
51 virtual size_t GetSize() const { return m_o_streambuf->GetLastAccess(); }
52
53 size_t CopyTo(void *buffer, size_t len) const;
54
55 wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; }
56
57 // deprecated, compatibility only
58 wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
59
60protected:
61 wxStreamBuffer *m_o_streambuf;
62
63protected:
64 size_t OnSysWrite(const void *buffer, size_t nbytes);
65 off_t OnSysSeek(off_t pos, wxSeekMode mode);
66 off_t OnSysTell() const;
67};
68
69#endif
70 // wxUSE_STREAMS
71
72#endif
73 // _WX_WXMMSTREAM_H__
74