1998-07-12 11:24:52 -04: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-14 20:23:28 -04:00
|
|
|
#ifndef _WX_WXMMSTREAM_H__
|
|
|
|
#define _WX_WXMMSTREAM_H__
|
1998-07-12 11:24:52 -04:00
|
|
|
|
1999-08-20 18:52:21 -04:00
|
|
|
#include "wx/stream.h"
|
1998-07-12 11:24:52 -04:00
|
|
|
|
1999-06-15 16:21:59 -04:00
|
|
|
#if wxUSE_STREAMS
|
|
|
|
|
2000-01-09 19:55:05 -05:00
|
|
|
class WXDLLEXPORT wxMemoryInputStream: public wxInputStream {
|
1999-04-04 09:02:19 -04:00
|
|
|
private:
|
|
|
|
size_t m_length;
|
|
|
|
|
1998-07-12 11:24:52 -04:00
|
|
|
public:
|
1998-07-14 08:06:50 -04:00
|
|
|
wxMemoryInputStream(const char *data, size_t length);
|
|
|
|
virtual ~wxMemoryInputStream();
|
1999-07-24 06:50:13 -04:00
|
|
|
virtual size_t GetSize() const { return m_length; }
|
1998-07-14 08:06:50 -04:00
|
|
|
|
1998-07-28 13:11:08 -04:00
|
|
|
char Peek();
|
1999-07-15 14:08:57 -04:00
|
|
|
|
1999-07-19 13:34:59 -04:00
|
|
|
wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; }
|
|
|
|
|
1999-07-15 14:08:57 -04: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 11:24:52 -04:00
|
|
|
};
|
|
|
|
|
2000-01-09 19:55:05 -05:00
|
|
|
class WXDLLEXPORT wxMemoryOutputStream: public wxOutputStream {
|
1998-07-12 11:24:52 -04:00
|
|
|
public:
|
1998-07-14 08:06:50 -04:00
|
|
|
wxMemoryOutputStream(char *data = NULL, size_t length = 0);
|
|
|
|
virtual ~wxMemoryOutputStream();
|
1999-07-24 06:50:13 -04:00
|
|
|
virtual size_t GetSize() const { return m_o_streambuf->GetLastAccess(); }
|
1999-07-19 13:34:59 -04:00
|
|
|
|
|
|
|
wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
|
1999-07-15 14:08:57 -04:00
|
|
|
|
1999-07-22 13:51:54 -04:00
|
|
|
size_t CopyTo(char *buffer, size_t len) const;
|
|
|
|
|
1999-07-15 14:08:57 -04: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 11:24:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1999-06-15 16:21:59 -04:00
|
|
|
// wxUSE_STREAMS
|
|
|
|
|
|
|
|
#endif
|
1999-07-09 11:30:31 -04:00
|
|
|
// _WX_WXMMSTREAM_H__
|
|
|
|
|