]>
Commit | Line | Data |
---|---|---|
32fc4afb | 1 | ///////////////////////////////////////////////////////////////////////////// |
67c8c225 | 2 | // Name: wx/mstream.h |
32fc4afb GL |
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 | ///////////////////////////////////////////////////////////////////////////// | |
83141d3a | 11 | |
34138703 JS |
12 | #ifndef _WX_WXMMSTREAM_H__ |
13 | #define _WX_WXMMSTREAM_H__ | |
32fc4afb | 14 | |
ed58dbea | 15 | #include "wx/stream.h" |
32fc4afb | 16 | |
ce4169a4 RR |
17 | #if wxUSE_STREAMS |
18 | ||
bddd7a8d | 19 | class WXDLLIMPEXP_BASE wxMemoryInputStream : public wxInputStream |
83141d3a VZ |
20 | { |
21 | public: | |
67c8c225 | 22 | wxMemoryInputStream(const void *data, size_t length); |
83141d3a VZ |
23 | virtual ~wxMemoryInputStream(); |
24 | virtual size_t GetSize() const { return m_length; } | |
25 | virtual bool Eof() const; | |
26 | ||
27 | char Peek(); | |
79c3e0e1 | 28 | |
67c8c225 VZ |
29 | wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } |
30 | ||
31 | // deprecated, compatibility only | |
83141d3a | 32 | wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; } |
c980c992 | 33 | |
83141d3a VZ |
34 | protected: |
35 | wxStreamBuffer *m_i_streambuf; | |
0d631778 | 36 | |
83141d3a VZ |
37 | size_t OnSysRead(void *buffer, size_t nbytes); |
38 | off_t OnSysSeek(off_t pos, wxSeekMode mode); | |
39 | off_t OnSysTell() const; | |
c980c992 | 40 | |
83141d3a VZ |
41 | private: |
42 | size_t m_length; | |
22f3361e VZ |
43 | |
44 | DECLARE_NO_COPY_CLASS(wxMemoryInputStream) | |
32fc4afb GL |
45 | }; |
46 | ||
bddd7a8d | 47 | class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream |
83141d3a VZ |
48 | { |
49 | public: | |
67c8c225 VZ |
50 | // if data is !NULL it must be allocated with malloc() |
51 | wxMemoryOutputStream(void *data = NULL, size_t length = 0); | |
83141d3a VZ |
52 | virtual ~wxMemoryOutputStream(); |
53 | virtual size_t GetSize() const { return m_o_streambuf->GetLastAccess(); } | |
0d631778 | 54 | |
67c8c225 | 55 | size_t CopyTo(void *buffer, size_t len) const; |
c980c992 | 56 | |
67c8c225 VZ |
57 | wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } |
58 | ||
59 | // deprecated, compatibility only | |
60 | wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; } | |
a324a7bc | 61 | |
83141d3a VZ |
62 | protected: |
63 | wxStreamBuffer *m_o_streambuf; | |
c980c992 | 64 | |
83141d3a VZ |
65 | protected: |
66 | size_t OnSysWrite(const void *buffer, size_t nbytes); | |
67 | off_t OnSysSeek(off_t pos, wxSeekMode mode); | |
68 | off_t OnSysTell() const; | |
22f3361e VZ |
69 | |
70 | DECLARE_NO_COPY_CLASS(wxMemoryOutputStream) | |
32fc4afb GL |
71 | }; |
72 | ||
32fc4afb | 73 | #endif |
ce4169a4 RR |
74 | // wxUSE_STREAMS |
75 | ||
76 | #endif | |
cc985fac PA |
77 | // _WX_WXMMSTREAM_H__ |
78 |