]>
git.saurik.com Git - wxWidgets.git/blob - src/common/mstream.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: "Memory stream" classes
4 // Author: Guilhem Lavaux
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "mstream.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
30 #include <wx/stream.h>
31 #include <wx/mstream.h>
33 // ----------------------------------------------------------------------------
34 // wxMemoryInputStream
35 // ----------------------------------------------------------------------------
37 wxMemoryInputStream::wxMemoryInputStream(const char *data
, size_t len
)
40 m_i_streambuf
->SetBufferIO((char*) data
, (char*) (data
+len
));
41 m_i_streambuf
->SetIntPosition(0); // seek to start pos
42 m_i_streambuf
->Fixed(TRUE
);
46 wxMemoryInputStream::~wxMemoryInputStream()
50 char wxMemoryInputStream::Peek()
52 return m_i_streambuf
->GetBufferStart()[m_i_streambuf
->GetIntPosition()];
55 // ----------------------------------------------------------------------------
56 // wxMemoryOutputStream
57 // ----------------------------------------------------------------------------
59 wxMemoryOutputStream::wxMemoryOutputStream(char *data
, size_t len
)
63 m_o_streambuf
->SetBufferIO(data
, data
+len
);
64 m_o_streambuf
->Fixed(TRUE
);
67 wxMemoryOutputStream::~wxMemoryOutputStream()