]> git.saurik.com Git - wxWidgets.git/blob - interface/sstream.h
add possibility to specify the conversion to use in wxStringOutputStream; use it...
[wxWidgets.git] / interface / sstream.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: sstream.h
3 // Purpose: interface of wxStringInputStream
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxStringInputStream
11 @wxheader{sstream.h}
12
13 This class implements an input stream which reads data from a string. It
14 supports seeking.
15
16 @library{wxbase}
17 @category{streams}
18 */
19 class wxStringInputStream : public wxInputStream
20 {
21 public:
22 /**
23 Creates a new read-only stream using the specified string. Note that the string
24 is copied by the stream so if the original string is modified after using this
25 constructor, changes to it are not reflected when reading from stream.
26 */
27 wxStringInputStream(const wxString& s);
28 };
29
30
31
32 /**
33 @class wxStringOutputStream
34 @wxheader{sstream.h}
35
36 This class implements an output stream which writes data either to a
37 user-provided or internally allocated string. Note that currently this stream
38 does not support seeking but can tell its current position.
39
40 @library{wxbase}
41 @category{streams}
42 */
43 class wxStringOutputStream : public wxOutputStream
44 {
45 public:
46 /**
47 Construct a new stream object writing the data to a string.
48
49 If the provided pointer is non-@NULL, data will be written to it.
50 Otherwise, an internal string is used for the data written to this
51 stream, use GetString() to get access to it.
52
53 If @a str is used, data written to the stream is appended to the current
54 contents of it, i.e. the string is not cleared here. However if it is not
55 empty, the positions returned by wxOutputStream::TellO will be
56 offset by the initial string length, i.e. initial stream position will be the
57 initial length of the string and not 0.
58
59 Notice that the life time of @a conv must be greater than the life time
60 of this object itself as it stores a reference to it. Also notice that
61 with default value of this argument the data written to the stream must
62 be valid UTF-8, pass @c wxConvISO8859_1 to deal with arbitrary 8 bit
63 data.
64 */
65 wxStringOutputStream(wxString str = NULL, wxMBConv& conv = wxConvUTF8);
66
67 /**
68 Returns the string containing all the data written to the stream so far.
69 */
70 const wxString& GetString() const;
71 };
72