]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mstream.h
wxTimer::Start() now calls Stop()
[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
12 #ifndef _WX_WXMMSTREAM_H__
13 #define _WX_WXMMSTREAM_H__
14
15 #include "wx/stream.h"
16
17 #if wxUSE_STREAMS
18
19 class WXDLLEXPORT wxMemoryInputStream : public wxInputStream
20 {
21 public:
22 wxMemoryInputStream(const char *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 *InputStreamBuffer() const { return m_i_streambuf; }
30
31 protected:
32 wxStreamBuffer *m_i_streambuf;
33
34 size_t OnSysRead(void *buffer, size_t nbytes);
35 off_t OnSysSeek(off_t pos, wxSeekMode mode);
36 off_t OnSysTell() const;
37
38 private:
39 size_t m_length;
40 };
41
42 class WXDLLEXPORT wxMemoryOutputStream : public wxOutputStream
43 {
44 public:
45 wxMemoryOutputStream(char *data = NULL, size_t length = 0);
46 virtual ~wxMemoryOutputStream();
47 virtual size_t GetSize() const { return m_o_streambuf->GetLastAccess(); }
48
49 wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
50
51 size_t CopyTo(char *buffer, size_t len) const;
52
53 protected:
54 wxStreamBuffer *m_o_streambuf;
55
56 protected:
57 size_t OnSysWrite(const void *buffer, size_t nbytes);
58 off_t OnSysSeek(off_t pos, wxSeekMode mode);
59 off_t OnSysTell() const;
60 };
61
62 #endif
63 // wxUSE_STREAMS
64
65 #endif
66 // _WX_WXMMSTREAM_H__
67