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