2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: sstream.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxStringInputStream
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxStringInputStream
|
|
|
|
@wxheader{sstream.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class implements an input stream which reads data from a string. It
|
|
|
|
supports seeking.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
|
|
|
@category{streams}
|
|
|
|
*/
|
|
|
|
class wxStringInputStream : public wxInputStream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Creates a new read-only stream using the specified string. Note that the string
|
|
|
|
is copied by the stream so if the original string is modified after using this
|
|
|
|
constructor, changes to it are not reflected when reading from stream.
|
|
|
|
*/
|
|
|
|
wxStringInputStream(const wxString& s);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxStringOutputStream
|
|
|
|
@wxheader{sstream.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class implements an output stream which writes data either to a
|
|
|
|
user-provided or internally allocated string. Note that currently this stream
|
|
|
|
does not support seeking but can tell its current position.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
|
|
|
@category{streams}
|
|
|
|
*/
|
|
|
|
class wxStringOutputStream : public wxOutputStream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-04-15 08:22:41 -04:00
|
|
|
Construct a new stream object writing the data to a string.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
If the provided pointer is non-@NULL, data will be written to it.
|
2008-04-15 08:22:41 -04:00
|
|
|
Otherwise, an internal string is used for the data written to this
|
|
|
|
stream, use GetString() to get access to it.
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
If @a str is used, data written to the stream is appended to the current
|
2008-03-08 08:52:38 -05:00
|
|
|
contents of it, i.e. the string is not cleared here. However if it is not
|
|
|
|
empty, the positions returned by wxOutputStream::TellO will be
|
|
|
|
offset by the initial string length, i.e. initial stream position will be the
|
|
|
|
initial length of the string and not 0.
|
2008-04-15 08:22:41 -04:00
|
|
|
|
|
|
|
Notice that the life time of @a conv must be greater than the life time
|
|
|
|
of this object itself as it stores a reference to it. Also notice that
|
|
|
|
with default value of this argument the data written to the stream must
|
|
|
|
be valid UTF-8, pass @c wxConvISO8859_1 to deal with arbitrary 8 bit
|
|
|
|
data.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-15 08:22:41 -04:00
|
|
|
wxStringOutputStream(wxString str = NULL, wxMBConv& conv = wxConvUTF8);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the string containing all the data written to the stream so far.
|
|
|
|
*/
|
2008-04-15 08:22:41 -04:00
|
|
|
const wxString& GetString() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|