2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: mstream.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxMemoryOutputStream
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxMemoryOutputStream
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-11 13:10:48 +00:00
|
|
|
@todo describe me.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxbase}
|
|
|
|
@category{streams}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxStreamBuffer
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
class wxMemoryOutputStream : public wxOutputStream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
If @a data is @NULL, then it will initialize a new empty buffer which will
|
2008-03-08 13:52:38 +00:00
|
|
|
grow if required.
|
2008-10-11 13:10:48 +00:00
|
|
|
|
|
|
|
@warning
|
|
|
|
If the buffer is created, it will be destroyed at the destruction of the stream.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
wxMemoryOutputStream(char* data = NULL, size_t length = 0);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual ~wxMemoryOutputStream();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-11 13:10:48 +00:00
|
|
|
Allows you to transfer data from the internal buffer of wxMemoryOutputStream
|
|
|
|
to an external buffer. @a len specifies the size of the buffer.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
size_t CopyTo(char* buffer, size_t len) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the pointer to the stream object used as an internal buffer
|
|
|
|
for that stream.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxStreamBuffer* GetOutputStreamBuffer() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
@class wxMemoryInputStream
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-11 13:10:48 +00:00
|
|
|
@todo describe me.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxbase}
|
|
|
|
@category{streams}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxStreamBuffer, wxMemoryOutputStream
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
class wxMemoryInputStream : public wxInputStream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-10-11 13:10:48 +00:00
|
|
|
Initializes a new read-only memory stream which will use the specified
|
|
|
|
buffer data of length len. The stream does not take ownership of the buffer,
|
|
|
|
i.e. the buffer will not be deleted in its destructor.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
wxMemoryInputStream(const char* data, size_t len);
|
2008-10-11 13:10:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creates a new read-only memory stream, initializing it with the data from
|
|
|
|
the given output stream @a stream.
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxMemoryInputStream(const wxMemoryOutputStream& stream);
|
2008-10-11 13:10:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creates a new read-only memory stream, initializing it with the
|
|
|
|
data from the given input stream @a stream.
|
|
|
|
|
|
|
|
The @a len argument specifies the amount of data to read from the
|
|
|
|
@a stream. Setting it to @e wxInvalidOffset means that the @a stream
|
|
|
|
is to be read entirely (i.e. till the EOF is reached).
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxMemoryInputStream(wxInputStream& stream,
|
|
|
|
wxFileOffset len = wxInvalidOffset);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual ~wxMemoryInputStream();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the pointer to the stream object used as an internal buffer
|
|
|
|
for that stream.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxStreamBuffer* GetInputStreamBuffer() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|