]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: sstream.h | |
3 | // Purpose: interface of wxStringInputStream | |
4 | // Author: wxWidgets team | |
5 | // Licence: wxWindows licence | |
6 | ///////////////////////////////////////////////////////////////////////////// | |
7 | ||
8 | /** | |
9 | @class wxStringInputStream | |
10 | ||
11 | This class implements an input stream which reads data from a string. | |
12 | It supports seeking. | |
13 | ||
14 | @library{wxbase} | |
15 | @category{streams} | |
16 | */ | |
17 | class wxStringInputStream : public wxInputStream | |
18 | { | |
19 | public: | |
20 | /** | |
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. | |
26 | */ | |
27 | wxStringInputStream(const wxString& s); | |
28 | }; | |
29 | ||
30 | ||
31 | ||
32 | /** | |
33 | @class wxStringOutputStream | |
34 | ||
35 | This class implements an output stream which writes data either to a | |
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. | |
40 | ||
41 | @library{wxbase} | |
42 | @category{streams} | |
43 | */ | |
44 | class wxStringOutputStream : public wxOutputStream | |
45 | { | |
46 | public: | |
47 | /** | |
48 | Construct a new stream object writing the data to a string. | |
49 | ||
50 | If the provided pointer is non-@NULL, data will be written to it. | |
51 | Otherwise, an internal string is used for the data written to this | |
52 | stream, use GetString() to get access to it. | |
53 | ||
54 | If @a str is used, data written to the stream is appended to the current | |
55 | contents of it, i.e. the string is not cleared here. However if it is not | |
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 | |
58 | initial length of the string and not 0. | |
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 | |
63 | be valid UTF-8, pass @c wxConvISO8859_1 to deal with arbitrary 8 bit data. | |
64 | */ | |
65 | wxStringOutputStream(wxString* pString = 0, 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 |