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