-
-wxOutputStream& wxMemoryOutputStream::Write(const void *buffer, size_t size)
-{
- if (m_iolimit == 1) {
- m_bad = TRUE;
- return *this;
- }
-
- if (m_position_o+size > m_length)
- if (!ChangeBufferSize(m_position_o+size)) {
- m_bad = TRUE;
- return *this;
- }
-
- memcpy(m_buffer+m_position_o, buffer, size);
- m_position_o += size;
- m_lastwrite = size;
-
- return *this;
-}
-
-off_t wxMemoryOutputStream::SeekO(off_t pos, wxSeekMode mode)
-{
- if (m_iolimit == 1)
- return 0;
-
- switch (mode) {
- case wxFromStart:
- if ((size_t)pos > m_length)
- return m_position_o;
- return (m_position_o = pos);
-
- case wxFromCurrent:
- if ((size_t)(m_position_o+pos) > m_length)
- return m_position_o;
-
- return (m_position_o += pos);
-
- case wxFromEnd:
- if ((size_t)(m_length-pos) > m_length)
- return m_position_o;
-
- return (m_position_o = m_length-pos);
- }
-
- return m_position_o;
-}
-
-// ----------------------------------------------------------------------------
-// wxMemoryStream
-// ----------------------------------------------------------------------------
-
-wxMemoryStream::wxMemoryStream(char *data, size_t len)
- : wxMemoryInputStream(NULL, 0), wxMemoryOutputStream(NULL, 0)
-{
- m_persistent = FALSE;
- m_buffer = data;
- m_length = len;
- m_iolimit = 0;
-}
-
-wxMemoryStream::~wxMemoryStream()
-{
-}