]>
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 | |
65571936 | 9 | // Licence: wxWindows licence |
32fc4afb | 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 | 23 | virtual ~wxMemoryInputStream(); |
588066b7 | 24 | virtual wxFileOffset GetLength() const { return m_length; } |
83141d3a | 25 | virtual bool Eof() const; |
3c70014d | 26 | virtual bool IsSeekable() const { return true; } |
83141d3a VZ |
27 | |
28 | char Peek(); | |
79c3e0e1 | 29 | |
67c8c225 VZ |
30 | wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } |
31 | ||
32 | // deprecated, compatibility only | |
83141d3a | 33 | wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; } |
c980c992 | 34 | |
83141d3a VZ |
35 | protected: |
36 | wxStreamBuffer *m_i_streambuf; | |
0d631778 | 37 | |
83141d3a | 38 | size_t OnSysRead(void *buffer, size_t nbytes); |
4004775e RL |
39 | wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); |
40 | wxFileOffset OnSysTell() const; | |
c980c992 | 41 | |
83141d3a VZ |
42 | private: |
43 | size_t m_length; | |
22f3361e VZ |
44 | |
45 | DECLARE_NO_COPY_CLASS(wxMemoryInputStream) | |
32fc4afb GL |
46 | }; |
47 | ||
bddd7a8d | 48 | class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream |
83141d3a VZ |
49 | { |
50 | public: | |
67c8c225 VZ |
51 | // if data is !NULL it must be allocated with malloc() |
52 | wxMemoryOutputStream(void *data = NULL, size_t length = 0); | |
83141d3a | 53 | virtual ~wxMemoryOutputStream(); |
588066b7 | 54 | virtual wxFileOffset GetLength() const { return m_o_streambuf->GetLastAccess(); } |
3c70014d | 55 | virtual bool IsSeekable() const { return true; } |
0d631778 | 56 | |
67c8c225 | 57 | size_t CopyTo(void *buffer, size_t len) const; |
c980c992 | 58 | |
67c8c225 VZ |
59 | wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } |
60 | ||
61 | // deprecated, compatibility only | |
62 | wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; } | |
a324a7bc | 63 | |
83141d3a VZ |
64 | protected: |
65 | wxStreamBuffer *m_o_streambuf; | |
c980c992 | 66 | |
83141d3a VZ |
67 | protected: |
68 | size_t OnSysWrite(const void *buffer, size_t nbytes); | |
4004775e RL |
69 | wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); |
70 | wxFileOffset OnSysTell() const; | |
22f3361e VZ |
71 | |
72 | DECLARE_NO_COPY_CLASS(wxMemoryOutputStream) | |
32fc4afb GL |
73 | }; |
74 | ||
32fc4afb | 75 | #endif |
ce4169a4 RR |
76 | // wxUSE_STREAMS |
77 | ||
78 | #endif | |
cc985fac PA |
79 | // _WX_WXMMSTREAM_H__ |
80 |