]> git.saurik.com Git - wxWidgets.git/blame - include/wx/stdstream.h
Merge in from trunk r68626 - r68683
[wxWidgets.git] / include / wx / stdstream.h
CommitLineData
72a7c559
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/stdstream.h
3// Purpose: Header of std::istream and std::ostream derived wrappers for
4// wxInputStream and wxOutputStream
5// Author: Jonathan Liu <net147@gmail.com>
6// Created: 2009-05-02
7// RCS-ID: $Id$
8// Copyright: (c) 2009 Jonathan Liu
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_STDSTREAM_H_
13#define _WX_STDSTREAM_H_
14
15#include "wx/defs.h" // wxUSE_STD_IOSTREAM
16
e5805c0f 17#if wxUSE_STREAMS && wxUSE_STD_IOSTREAM
72a7c559 18
3c507ea6
SC
19#include "wx/defs.h"
20#include "wx/stream.h"
eb3a3cbb 21#include "wx/ioswrap.h"
72a7c559
VZ
22
23// ==========================================================================
24// wxStdInputStreamBuffer
25// ==========================================================================
26
27class WXDLLIMPEXP_BASE wxStdInputStreamBuffer : public std::streambuf
28{
29public:
30 wxStdInputStreamBuffer(wxInputStream& stream);
31 virtual ~wxStdInputStreamBuffer() { }
32
33protected:
34 virtual std::streambuf *setbuf(char *s, std::streamsize n);
35 virtual std::streampos seekoff(std::streamoff off,
36 std::ios_base::seekdir way,
37 std::ios_base::openmode which =
38 std::ios_base::in |
39 std::ios_base::out);
40 virtual std::streampos seekpos(std::streampos sp,
41 std::ios_base::openmode which =
42 std::ios_base::in |
43 std::ios_base::out);
44 virtual std::streamsize showmanyc();
45 virtual std::streamsize xsgetn(char *s, std::streamsize n);
46 virtual int underflow();
47 virtual int uflow();
48 virtual int pbackfail(int c = EOF);
49
50 wxInputStream& m_stream;
51 int m_lastChar;
52};
53
54// ==========================================================================
55// wxStdInputStream
56// ==========================================================================
57
58class WXDLLIMPEXP_BASE wxStdInputStream : public std::istream
59{
60public:
61 wxStdInputStream(wxInputStream& stream);
62 virtual ~wxStdInputStream() { }
63
64protected:
65 wxStdInputStreamBuffer m_streamBuffer;
66};
67
68// ==========================================================================
69// wxStdOutputStreamBuffer
70// ==========================================================================
71
72class WXDLLIMPEXP_BASE wxStdOutputStreamBuffer : public std::streambuf
73{
74public:
75 wxStdOutputStreamBuffer(wxOutputStream& stream);
76 virtual ~wxStdOutputStreamBuffer() { }
77
78protected:
79 virtual std::streambuf *setbuf(char *s, std::streamsize n);
80 virtual std::streampos seekoff(std::streamoff off,
81 std::ios_base::seekdir way,
82 std::ios_base::openmode which =
83 std::ios_base::in |
84 std::ios_base::out);
85 virtual std::streampos seekpos(std::streampos sp,
86 std::ios_base::openmode which =
87 std::ios_base::in |
88 std::ios_base::out);
89 virtual std::streamsize xsputn(const char *s, std::streamsize n);
90 virtual int overflow(int c);
91
92 wxOutputStream& m_stream;
93};
94
95// ==========================================================================
96// wxStdOutputStream
97// ==========================================================================
98
99class WXDLLIMPEXP_BASE wxStdOutputStream : public std::ostream
100{
101public:
102 wxStdOutputStream(wxOutputStream& stream);
103 virtual ~wxStdOutputStream() { }
104
105protected:
106 wxStdOutputStreamBuffer m_streamBuffer;
107};
108
e5805c0f 109#endif // wxUSE_STREAMS && wxUSE_STD_IOSTREAM
72a7c559
VZ
110
111#endif // _WX_STDSTREAM_H_