]> git.saurik.com Git - wxWidgets.git/blob - src/common/mstream.cpp
Motif compile fixes
[wxWidgets.git] / src / common / mstream.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mstream.cpp
3 // Purpose: "Memory stream" classes
4 // Author: Guilhem Lavaux
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "mstream.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #if wxUSE_STREAMS
24
25 #include <stdlib.h>
26 #include <wx/stream.h>
27 #include <wx/mstream.h>
28
29 // ----------------------------------------------------------------------------
30 // wxMemoryInputStream
31 // ----------------------------------------------------------------------------
32
33 wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len)
34 : wxInputStream()
35 {
36 m_i_streambuf->SetBufferIO((char*) data, (char*) (data+len));
37 m_i_streambuf->SetIntPosition(0); // seek to start pos
38 m_i_streambuf->Fixed(TRUE);
39 m_length = len;
40 }
41
42 wxMemoryInputStream::~wxMemoryInputStream()
43 {
44 }
45
46 char wxMemoryInputStream::Peek()
47 {
48 return m_i_streambuf->GetBufferStart()[m_i_streambuf->GetIntPosition()];
49 }
50
51 // ----------------------------------------------------------------------------
52 // wxMemoryOutputStream
53 // ----------------------------------------------------------------------------
54
55 wxMemoryOutputStream::wxMemoryOutputStream(char *data, size_t len)
56 : wxOutputStream()
57 {
58 if (data)
59 m_o_streambuf->SetBufferIO(data, data+len);
60 m_o_streambuf->Fixed(TRUE);
61 }
62
63 wxMemoryOutputStream::~wxMemoryOutputStream()
64 {
65 }
66
67 #endif