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