]> git.saurik.com Git - wxWidgets.git/blob - src/common/mstream.cpp
Added wxCONFIG_USE_RELATIVE_PATH option to allow relative paths for config files
[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 #include <stdlib.h>
19 #include <wx/stream.h>
20 #include <wx/mstream.h>
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 // ----------------------------------------------------------------------------
27 // wxMemoryInputStream
28 // ----------------------------------------------------------------------------
29
30 wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len)
31 : wxInputStream()
32 {
33 m_i_streambuf->SetBufferIO((char*) data, (char*) (data+len));
34 m_i_streambuf->SetIntPosition(0); // seek to start pos
35 m_i_streambuf->Fixed(TRUE);
36 m_length = len;
37 }
38
39 wxMemoryInputStream::~wxMemoryInputStream()
40 {
41 }
42
43 char wxMemoryInputStream::Peek()
44 {
45 return m_i_streambuf->GetBufferStart()[m_i_streambuf->GetIntPosition()];
46 }
47
48 // ----------------------------------------------------------------------------
49 // wxMemoryOutputStream
50 // ----------------------------------------------------------------------------
51
52 wxMemoryOutputStream::wxMemoryOutputStream(char *data, size_t len)
53 : wxOutputStream()
54 {
55 if (data)
56 m_o_streambuf->SetBufferIO(data, data+len);
57 m_o_streambuf->Fixed(TRUE);
58 }
59
60 wxMemoryOutputStream::~wxMemoryOutputStream()
61 {
62 }