]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/mstream.h
no message
[wxWidgets.git] / include / wx / mstream.h
... / ...
CommitLineData
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
19class WXDLLEXPORT wxMemoryInputStream : public wxInputStream
20{
21public:
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
31protected:
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
38private:
39 size_t m_length;
40};
41
42class WXDLLEXPORT wxMemoryOutputStream : public wxOutputStream
43{
44public:
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
53protected:
54 wxStreamBuffer *m_o_streambuf;
55
56protected:
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