]>
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"
26 #include <wx/stream.h>
27 #include <wx/mstream.h>
29 // ----------------------------------------------------------------------------
30 // wxMemoryInputStream
31 // ----------------------------------------------------------------------------
33 wxMemoryInputStream::wxMemoryInputStream(const char *data
, size_t len
)
36 m_i_streambuf
->SetBufferIO((char*) data
, (char*) (data
+len
));
37 m_i_streambuf
->SetIntPosition(0); // seek to start pos
38 m_i_streambuf
->Fixed(TRUE
);
42 wxMemoryInputStream::~wxMemoryInputStream()
46 char wxMemoryInputStream::Peek()
48 return m_i_streambuf
->GetBufferStart()[m_i_streambuf
->GetIntPosition()];
51 // ----------------------------------------------------------------------------
52 // wxMemoryOutputStream
53 // ----------------------------------------------------------------------------
55 wxMemoryOutputStream::wxMemoryOutputStream(char *data
, size_t len
)
59 m_o_streambuf
->SetBufferIO(data
, data
+len
);
60 m_o_streambuf
->Fixed(TRUE
);
63 wxMemoryOutputStream::~wxMemoryOutputStream()