1998-07-12 15:24:52 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: mstream.h
|
|
|
|
// Purpose: Memory stream classes
|
|
|
|
// Author: Guilhem Lavaux
|
|
|
|
// Modified by:
|
|
|
|
// Created: 11/07/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Guilhem Lavaux
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1998-08-15 00:23:28 +00:00
|
|
|
#ifndef _WX_WXMMSTREAM_H__
|
|
|
|
#define _WX_WXMMSTREAM_H__
|
1998-07-12 15:24:52 +00:00
|
|
|
|
1998-07-14 12:06:50 +00:00
|
|
|
#include <wx/stream.h>
|
1998-07-12 15:24:52 +00:00
|
|
|
|
1999-06-15 20:21:59 +00:00
|
|
|
#if wxUSE_STREAMS
|
|
|
|
|
1998-10-14 17:36:50 +00:00
|
|
|
class wxMemoryInputStream: public wxInputStream {
|
1999-04-04 13:02:19 +00:00
|
|
|
private:
|
|
|
|
size_t m_length;
|
|
|
|
|
1998-07-12 15:24:52 +00:00
|
|
|
public:
|
1998-07-14 12:06:50 +00:00
|
|
|
wxMemoryInputStream(const char *data, size_t length);
|
|
|
|
virtual ~wxMemoryInputStream();
|
1999-04-04 13:02:19 +00:00
|
|
|
virtual size_t StreamSize() const { return m_length; }
|
1998-07-14 12:06:50 +00:00
|
|
|
|
1998-07-28 17:11:08 +00:00
|
|
|
char Peek();
|
1999-07-15 18:08:57 +00:00
|
|
|
|
1999-07-19 17:34:59 +00:00
|
|
|
wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; }
|
|
|
|
|
1999-07-15 18:08:57 +00:00
|
|
|
protected:
|
|
|
|
wxStreamBuffer *m_i_streambuf;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
size_t OnSysRead(void *buffer, size_t nbytes);
|
|
|
|
off_t OnSysSeek(off_t pos, wxSeekMode mode);
|
|
|
|
off_t OnSysTell() const;
|
1998-07-12 15:24:52 +00:00
|
|
|
};
|
|
|
|
|
1998-10-14 17:36:50 +00:00
|
|
|
class wxMemoryOutputStream: public wxOutputStream {
|
1998-07-12 15:24:52 +00:00
|
|
|
public:
|
1998-07-14 12:06:50 +00:00
|
|
|
wxMemoryOutputStream(char *data = NULL, size_t length = 0);
|
|
|
|
virtual ~wxMemoryOutputStream();
|
1999-07-19 17:34:59 +00:00
|
|
|
virtual size_t StreamSize() const { return m_o_streambuf->GetLastAccess(); }
|
|
|
|
|
|
|
|
wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
|
1999-07-15 18:08:57 +00:00
|
|
|
|
1999-07-22 17:51:54 +00:00
|
|
|
size_t CopyTo(char *buffer, size_t len) const;
|
|
|
|
|
1999-07-15 18:08:57 +00:00
|
|
|
protected:
|
|
|
|
wxStreamBuffer *m_o_streambuf;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
size_t OnSysWrite(const void *buffer, size_t nbytes);
|
|
|
|
off_t OnSysSeek(off_t pos, wxSeekMode mode);
|
|
|
|
off_t OnSysTell() const;
|
1998-07-12 15:24:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1999-06-15 20:21:59 +00:00
|
|
|
// wxUSE_STREAMS
|
|
|
|
|
|
|
|
#endif
|
1999-07-09 15:30:31 +00:00
|
|
|
// _WX_WXMMSTREAM_H__
|
|
|
|
|