* wxStream: - new inheritance, new stream buffer, nearly the same API for the end user - updated other streams consequently * wxGTK: some change to make it compile on GTK 1.0 and GTK 1.1 * small changes on wxThread to prepare a more reentrant lib * wxVariant works with wxStream too now git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@829 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
61 lines
1.6 KiB
C++
61 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, data+len);
|
|
m_i_streambuf->Fixed(TRUE);
|
|
}
|
|
|
|
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()
|
|
{
|
|
}
|