]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/wfstream.h
fix parsing of IP literals in URIs, added test for it
[wxWidgets.git] / interface / wx / wfstream.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wfstream.h
3 // Purpose: interface of wxTempFileOutputStream
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxTempFileOutputStream
11
12 wxTempFileOutputStream is an output stream based on wxTempFile. It
13 provides a relatively safe way to replace the contents of the
14 existing file.
15
16 @library{wxbase}
17 @category{streams}
18
19 @see wxTempFile
20 */
21 class wxTempFileOutputStream : public wxOutputStream
22 {
23 public:
24 /**
25 Associates wxTempFileOutputStream with the file to be replaced and opens it.
26 You should use
27 wxStreamBase::IsOk to verify if the constructor succeeded.
28 Call Commit() or wxOutputStream::Close to
29 replace the old file and close this one. Calling Discard()
30 (or allowing the destructor to do it) will discard the changes.
31 */
32 wxTempFileOutputStream(const wxString& fileName);
33
34 /**
35 Validate changes: deletes the old file of the given name and renames the new
36 file to the old name. Returns @true if both actions succeeded. If @false is
37 returned it may unfortunately mean two quite different things: either that
38 either the old file couldn't be deleted or that the new file couldn't be renamed
39 to the old name.
40 */
41 bool Commit();
42
43 /**
44 Discard changes: the old file contents are not changed, the temporary file is
45 deleted.
46 */
47 void Discard();
48 };
49
50
51
52 /**
53 @class wxFFileOutputStream
54
55 This class represents data written to a file. There are actually
56 two such groups of classes: this one is based on wxFFile
57 whereas wxFileInputStream is based in
58 the wxFile class.
59
60 Note that wxOutputStream::SeekO
61 can seek beyond the end of the stream (file) and will thus not return
62 @e wxInvalidOffset for that.
63
64 @library{wxbase}
65 @category{streams}
66
67 @see wxBufferedOutputStream, wxFFileInputStream, wxFileInputStream
68 */
69 class wxFFileOutputStream : public wxOutputStream
70 {
71 public:
72 //@{
73 /**
74 Initializes a file stream in write-only mode using the file descriptor @e fp.
75 */
76 wxFFileOutputStream(const wxString& filename,
77 const wxString& mode = "wb");
78 wxFFileOutputStream(wxFFile& file);
79 wxFFileOutputStream(FILE* fp);
80 //@}
81
82 /**
83 Destructor.
84 */
85 ~wxFFileOutputStream();
86
87 /**
88 Returns @true if the stream is initialized and ready.
89 */
90 bool IsOk() const;
91 };
92
93
94
95 /**
96 @class wxFileOutputStream
97
98 This class represents data written to a file. There are actually
99 two such groups of classes: this one is based on wxFile
100 whereas wxFFileInputStream is based in
101 the wxFFile class.
102
103 Note that wxOutputStream::SeekO
104 can seek beyond the end of the stream (file) and will thus not return
105 @e wxInvalidOffset for that.
106
107 @library{wxbase}
108 @category{streams}
109
110 @see wxBufferedOutputStream, wxFileInputStream, wxFFileInputStream
111 */
112 class wxFileOutputStream : public wxOutputStream
113 {
114 public:
115 //@{
116 /**
117 Initializes a file stream in write-only mode using the file descriptor @e fd.
118 */
119 wxFileOutputStream(const wxString& ofileName);
120 wxFileOutputStream(wxFile& file);
121 wxFileOutputStream(int fd);
122 //@}
123
124 /**
125 Destructor.
126 */
127 ~wxFileOutputStream();
128
129 /**
130 Returns @true if the stream is initialized and ready.
131 */
132 bool IsOk() const;
133 };
134
135
136
137 /**
138 @class wxFileInputStream
139
140 This class represents data read in from a file. There are actually
141 two such groups of classes: this one is based on wxFile
142 whereas wxFFileInputStream is based in
143 the wxFFile class.
144
145 Note that wxInputStream::SeekI
146 can seek beyond the end of the stream (file) and will thus not return
147 @e wxInvalidOffset for that.
148
149 @library{wxbase}
150 @category{streams}
151
152 @see wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream
153 */
154 class wxFileInputStream : public wxInputStream
155 {
156 public:
157 //@{
158 /**
159 Initializes a file stream in read-only mode using the specified file descriptor.
160 */
161 wxFileInputStream(const wxString& ifileName);
162 wxFileInputStream(wxFile& file);
163 wxFileInputStream(int fd);
164 //@}
165
166 /**
167 Destructor.
168 */
169 ~wxFileInputStream();
170
171 /**
172 Returns @true if the stream is initialized and ready.
173 */
174 bool IsOk() const;
175 };
176
177
178
179 /**
180 @class wxFFileInputStream
181
182 This class represents data read in from a file. There are actually
183 two such groups of classes: this one is based on wxFFile
184 whereas wxFileInputStream is based in
185 the wxFile class.
186
187 Note that wxInputStream::SeekI
188 can seek beyond the end of the stream (file) and will thus not return
189 @e wxInvalidOffset for that.
190
191 @library{wxbase}
192 @category{streams}
193
194 @see wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream
195 */
196 class wxFFileInputStream : public wxInputStream
197 {
198 public:
199 //@{
200 /**
201 Initializes a file stream in read-only mode using the specified file pointer @e
202 fp.
203 */
204 wxFFileInputStream(const wxString& filename,
205 const wxString& mode = "rb");
206 wxFFileInputStream(wxFFile& file);
207 wxFFileInputStream(FILE* fp);
208 //@}
209
210 /**
211 Destructor.
212 */
213 ~wxFFileInputStream();
214
215 /**
216 Returns @true if the stream is initialized and ready.
217 */
218 bool IsOk() const;
219 };
220
221
222
223 /**
224 @class wxFFileStream
225
226
227 @library{wxbase}
228 @category{FIXME}
229
230 @see wxStreamBuffer
231 */
232 class wxFFileStream : public wxFFileOutputStream
233 {
234 public:
235 /**
236 Initializes a new file stream in read-write mode using the specified
237 @e iofilename name.
238 */
239 wxFFileStream(const wxString& iofileName, const wxString& mode = "w+b");
240 };
241
242
243
244 /**
245 @class wxFileStream
246
247
248 @library{wxbase}
249 @category{FIXME}
250
251 @see wxStreamBuffer
252 */
253 class wxFileStream : public wxFileOutputStream
254 {
255 public:
256 /**
257 Initializes a new file stream in read-write mode using the specified
258 @e iofilename name.
259 */
260 wxFileStream(const wxString& iofileName);
261 };
262