]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mstream.h
Removed very very obsolete flags from 1.x
[wxWidgets.git] / include / wx / mstream.h
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
19 class WXDLLIMPEXP_BASE wxMemoryInputStream : public wxInputStream
20 {
21 public:
22 wxMemoryInputStream(const void *data, size_t length);
23 virtual ~wxMemoryInputStream();
24 virtual wxFileOffset GetLength() const { return m_length; }
25 virtual bool Eof() const;
26 virtual bool IsSeekable() const { return true; }
27
28 char Peek();
29
30 wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; }
31
32 // deprecated, compatibility only
33 wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; }
34
35 protected:
36 wxStreamBuffer *m_i_streambuf;
37
38 size_t OnSysRead(void *buffer, size_t nbytes);
39 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
40 wxFileOffset OnSysTell() const;
41
42 private:
43 size_t m_length;
44
45 DECLARE_NO_COPY_CLASS(wxMemoryInputStream)
46 };
47
48 class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream
49 {
50 public:
51 // if data is !NULL it must be allocated with malloc()
52 wxMemoryOutputStream(void *data = NULL, size_t length = 0);
53 virtual ~wxMemoryOutputStream();
54 virtual wxFileOffset GetLength() const { return m_o_streambuf->GetLastAccess(); }
55 virtual bool IsSeekable() const { return true; }
56
57 size_t CopyTo(void *buffer, size_t len) const;
58
59 wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; }
60
61 // deprecated, compatibility only
62 wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
63
64 protected:
65 wxStreamBuffer *m_o_streambuf;
66
67 protected:
68 size_t OnSysWrite(const void *buffer, size_t nbytes);
69 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
70 wxFileOffset OnSysTell() const;
71
72 DECLARE_NO_COPY_CLASS(wxMemoryOutputStream)
73 };
74
75 #endif
76 // wxUSE_STREAMS
77
78 #endif
79 // _WX_WXMMSTREAM_H__
80