Files
wxWidgets/src/common/mstream.cpp
Václav Slavík 18c07b73c6 fixed input stream
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
1999-04-04 13:02:19 +00:00

63 lines
1.6 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: mstream.cpp
// Purpose: "Memory stream" classes
// Author: Guilhem Lavaux
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "mstream.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include <stdlib.h>
#include <wx/stream.h>
#include <wx/mstream.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// ----------------------------------------------------------------------------
// wxMemoryInputStream
// ----------------------------------------------------------------------------
wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len)
: wxInputStream()
{
m_i_streambuf->SetBufferIO((char*) data, (char*) (data+len));
m_i_streambuf->SetIntPosition(0); // seek to start pos
m_i_streambuf->Fixed(TRUE);
m_length = len;
}
wxMemoryInputStream::~wxMemoryInputStream()
{
}
char wxMemoryInputStream::Peek()
{
return m_i_streambuf->GetBufferStart()[m_i_streambuf->GetIntPosition()];
}
// ----------------------------------------------------------------------------
// wxMemoryOutputStream
// ----------------------------------------------------------------------------
wxMemoryOutputStream::wxMemoryOutputStream(char *data, size_t len)
: wxOutputStream()
{
if (data)
m_o_streambuf->SetBufferIO(data, data+len);
m_o_streambuf->Fixed(TRUE);
}
wxMemoryOutputStream::~wxMemoryOutputStream()
{
}