]> git.saurik.com Git - wxWidgets.git/blame - src/common/mstream.cpp
Daniel Gehriger <dgehrige@dmtsun.epfl.ch> patch for default extension filter
[wxWidgets.git] / src / common / mstream.cpp
CommitLineData
3d4c6a21 1/////////////////////////////////////////////////////////////////////////////
32fc4afb 2// Name: mstream.cpp
3d4c6a21
GL
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__
32fc4afb 13#pragma implementation "mstream.h"
3d4c6a21
GL
14#endif
15
79c3e0e1
GL
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
3d4c6a21 18#include <stdlib.h>
79c3e0e1
GL
19#include <wx/stream.h>
20#include <wx/mstream.h>
21
22#ifdef __BORLANDC__
23#pragma hdrstop
24#endif
3d4c6a21 25
79c3e0e1
GL
26// ----------------------------------------------------------------------------
27// wxMemoryInputStream
28// ----------------------------------------------------------------------------
29
30wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len)
75ed1d15 31 : wxInputStream()
79c3e0e1 32{
2d0a075d 33 m_i_streambuf->SetBufferIO((char*) data, (char*) (data+len));
75ed1d15 34 m_i_streambuf->Fixed(TRUE);
3d4c6a21
GL
35}
36
0cd9bfe8
GL
37wxMemoryInputStream::~wxMemoryInputStream()
38{
39}
40
32a4b1d5
GL
41char wxMemoryInputStream::Peek()
42{
75ed1d15 43 return m_i_streambuf->GetBufferStart()[m_i_streambuf->GetIntPosition()];
3d4c6a21
GL
44}
45
79c3e0e1
GL
46// ----------------------------------------------------------------------------
47// wxMemoryOutputStream
48// ----------------------------------------------------------------------------
49
50wxMemoryOutputStream::wxMemoryOutputStream(char *data, size_t len)
75ed1d15 51 : wxOutputStream()
79c3e0e1 52{
75ed1d15
GL
53 if (data)
54 m_o_streambuf->SetBufferIO(data, data+len);
55 m_o_streambuf->Fixed(TRUE);
79c3e0e1
GL
56}
57
0cd9bfe8 58wxMemoryOutputStream::~wxMemoryOutputStream()
79c3e0e1 59{
3d4c6a21 60}