]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/mstream.h
clear up wxStringBuffer docs a bit
[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 WXDLLIMPEXP_BASE 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 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
39 wxFileOffset OnSysTell() const;
40
41private:
42 size_t m_length;
43
44 DECLARE_NO_COPY_CLASS(wxMemoryInputStream)
45};
46
47class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream
48{
49public:
50 // if data is !NULL it must be allocated with malloc()
51 wxMemoryOutputStream(void *data = NULL, size_t length = 0);
52 virtual ~wxMemoryOutputStream();
53 virtual size_t GetSize() const { return m_o_streambuf->GetLastAccess(); }
54
55 size_t CopyTo(void *buffer, size_t len) const;
56
57 wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; }
58
59 // deprecated, compatibility only
60 wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
61
62protected:
63 wxStreamBuffer *m_o_streambuf;
64
65protected:
66 size_t OnSysWrite(const void *buffer, size_t nbytes);
67 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
68 wxFileOffset OnSysTell() const;
69
70 DECLARE_NO_COPY_CLASS(wxMemoryOutputStream)
71};
72
73#endif
74 // wxUSE_STREAMS
75
76#endif
77 // _WX_WXMMSTREAM_H__
78