]>
git.saurik.com Git - wxWidgets.git/blob - src/common/mstream.cpp
560c0fd1ae305c729856ae51633d9b0e25824b69
   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" 
  19 #include <wx/stream.h> 
  20 #include <wx/mstream.h> 
  26 // ---------------------------------------------------------------------------- 
  27 // wxMemoryInputStream 
  28 // ---------------------------------------------------------------------------- 
  30 wxMemoryInputStream::wxMemoryInputStream(const char *data
, size_t len
) 
  33   m_i_streambuf
->SetBufferIO((char*) data
, (char*) (data
+len
)); 
  34   m_i_streambuf
->SetIntPosition(0); // seek to start pos 
  35   m_i_streambuf
->Fixed(TRUE
); 
  39 wxMemoryInputStream::~wxMemoryInputStream() 
  43 char wxMemoryInputStream::Peek() 
  45   return m_i_streambuf
->GetBufferStart()[m_i_streambuf
->GetIntPosition()]; 
  48 // ---------------------------------------------------------------------------- 
  49 // wxMemoryOutputStream 
  50 // ---------------------------------------------------------------------------- 
  52 wxMemoryOutputStream::wxMemoryOutputStream(char *data
, size_t len
) 
  56     m_o_streambuf
->SetBufferIO(data
, data
+len
); 
  57   m_o_streambuf
->Fixed(TRUE
); 
  60 wxMemoryOutputStream::~wxMemoryOutputStream()