]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mstream.h
minor changes to registry classes and wxIniConfig added
[wxWidgets.git] / include / wx / mstream.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 #ifndef __WXMMSTREAM_H__
12 #define __WXMMSTREAM_H__
13
14 #include <wx/stream.h>
15
16 class wxMemoryStreamBase {
17 protected:
18 wxMemoryStreamBase();
19 virtual ~wxMemoryStreamBase();
20
21 bool ChangeBufferSize(size_t new_length);
22
23 protected:
24 bool m_persistent;
25 size_t m_length;
26 char *m_buffer;
27 int m_iolimit;
28 };
29
30 class wxMemoryInputStream: virtual public wxMemoryStreamBase, public wxInputStream {
31 public:
32 wxMemoryInputStream(const char *data, size_t length);
33 virtual ~wxMemoryInputStream();
34
35 char Peek();
36
37 protected:
38
39 size_t DoRead(void *buffer, size_t size);
40 off_t DoSeekInput(off_t pos, wxSeekMode mode);
41 off_t DoTellInput() const { return m_position_i; }
42
43 protected:
44 off_t m_position_i;
45 };
46
47 class wxMemoryOutputStream: virtual public wxMemoryStreamBase, public wxOutputStream {
48 public:
49 wxMemoryOutputStream(char *data = NULL, size_t length = 0);
50 virtual ~wxMemoryOutputStream();
51
52 char *GetData() { Sync(); return m_buffer; }
53 size_t GetLength() { Sync(); return m_length; }
54
55 protected:
56
57 size_t DoWrite(const void *buffer, size_t size);
58 off_t DoSeekOutput(off_t pos, wxSeekMode mode);
59 off_t DoTellOutput() const { return m_position_o; }
60
61 protected:
62 off_t m_position_o;
63 };
64
65 class wxMemoryStream: public wxMemoryInputStream, public wxMemoryOutputStream {
66 public:
67 wxMemoryStream(char *data = NULL, size_t length = 0);
68 virtual ~wxMemoryStream();
69 };
70
71 #endif