]> git.saurik.com Git - wxWidgets.git/blame - src/common/mstream.cpp
wxWindow::Fit() infinite loop bug fixed
[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));
18c07b73 34 m_i_streambuf->SetIntPosition(0); // seek to start pos
75ed1d15 35 m_i_streambuf->Fixed(TRUE);
18c07b73 36 m_length = len;
3d4c6a21
GL
37}
38
0cd9bfe8
GL
39wxMemoryInputStream::~wxMemoryInputStream()
40{
41}
42
32a4b1d5
GL
43char wxMemoryInputStream::Peek()
44{
75ed1d15 45 return m_i_streambuf->GetBufferStart()[m_i_streambuf->GetIntPosition()];
3d4c6a21
GL
46}
47
79c3e0e1
GL
48// ----------------------------------------------------------------------------
49// wxMemoryOutputStream
50// ----------------------------------------------------------------------------
51
52wxMemoryOutputStream::wxMemoryOutputStream(char *data, size_t len)
75ed1d15 53 : wxOutputStream()
79c3e0e1 54{
75ed1d15
GL
55 if (data)
56 m_o_streambuf->SetBufferIO(data, data+len);
57 m_o_streambuf->Fixed(TRUE);
79c3e0e1
GL
58}
59
0cd9bfe8 60wxMemoryOutputStream::~wxMemoryOutputStream()
79c3e0e1 61{
3d4c6a21 62}