]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/wfstream.h
Moved wxPGChoices m_choices member from various property classes to base wxPGProperty...
[wxWidgets.git] / interface / wx / wfstream.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: wfstream.h
e54c96f1 3// Purpose: interface of wxTempFileOutputStream
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxTempFileOutputStream
7c913512 11
23324ae1
FM
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.
7c913512 15
23324ae1
FM
16 @library{wxbase}
17 @category{streams}
7c913512 18
e54c96f1 19 @see wxTempFile
23324ae1
FM
20*/
21class wxTempFileOutputStream : public wxOutputStream
22{
23public:
24 /**
25 Associates wxTempFileOutputStream with the file to be replaced and opens it.
7c913512 26 You should use
23324ae1 27 wxStreamBase::IsOk to verify if the constructor succeeded.
23324ae1 28 Call Commit() or wxOutputStream::Close to
7c913512 29 replace the old file and close this one. Calling Discard()
23324ae1
FM
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
e54c96f1 51
23324ae1
FM
52/**
53 @class wxFFileOutputStream
7c913512 54
23324ae1 55 This class represents data written to a file. There are actually
7c913512 56 two such groups of classes: this one is based on wxFFile
23324ae1
FM
57 whereas wxFileInputStream is based in
58 the wxFile class.
7c913512
FM
59
60 Note that wxOutputStream::SeekO
61 can seek beyond the end of the stream (file) and will thus not return
23324ae1 62 @e wxInvalidOffset for that.
7c913512 63
23324ae1
FM
64 @library{wxbase}
65 @category{streams}
7c913512 66
e54c96f1 67 @see wxBufferedOutputStream, wxFFileInputStream, wxFileInputStream
23324ae1
FM
68*/
69class wxFFileOutputStream : public wxOutputStream
70{
71public:
72 //@{
73 /**
74 Initializes a file stream in write-only mode using the file descriptor @e fp.
75 */
76 wxFFileOutputStream(const wxString& filename,
02e22828 77 const wxString& mode = "wb");
7c913512 78 wxFFileOutputStream(wxFFile& file);
4cc4bfaf 79 wxFFileOutputStream(FILE* fp);
23324ae1
FM
80 //@}
81
82 /**
83 Destructor.
84 */
85 ~wxFFileOutputStream();
86
87 /**
88 Returns @true if the stream is initialized and ready.
89 */
328f5751 90 bool IsOk() const;
23324ae1
FM
91};
92
93
e54c96f1 94
23324ae1
FM
95/**
96 @class wxFileOutputStream
7c913512 97
23324ae1 98 This class represents data written to a file. There are actually
7c913512 99 two such groups of classes: this one is based on wxFile
23324ae1
FM
100 whereas wxFFileInputStream is based in
101 the wxFFile class.
7c913512
FM
102
103 Note that wxOutputStream::SeekO
104 can seek beyond the end of the stream (file) and will thus not return
23324ae1 105 @e wxInvalidOffset for that.
7c913512 106
23324ae1
FM
107 @library{wxbase}
108 @category{streams}
7c913512 109
e54c96f1 110 @see wxBufferedOutputStream, wxFileInputStream, wxFFileInputStream
23324ae1
FM
111*/
112class wxFileOutputStream : public wxOutputStream
113{
114public:
115 //@{
116 /**
117 Initializes a file stream in write-only mode using the file descriptor @e fd.
118 */
119 wxFileOutputStream(const wxString& ofileName);
7c913512
FM
120 wxFileOutputStream(wxFile& file);
121 wxFileOutputStream(int fd);
23324ae1
FM
122 //@}
123
124 /**
125 Destructor.
126 */
127 ~wxFileOutputStream();
128
129 /**
130 Returns @true if the stream is initialized and ready.
131 */
328f5751 132 bool IsOk() const;
23324ae1
FM
133};
134
135
e54c96f1 136
23324ae1
FM
137/**
138 @class wxFileInputStream
7c913512 139
23324ae1 140 This class represents data read in from a file. There are actually
7c913512 141 two such groups of classes: this one is based on wxFile
23324ae1
FM
142 whereas wxFFileInputStream is based in
143 the wxFFile class.
7c913512
FM
144
145 Note that wxInputStream::SeekI
146 can seek beyond the end of the stream (file) and will thus not return
23324ae1 147 @e wxInvalidOffset for that.
7c913512 148
23324ae1
FM
149 @library{wxbase}
150 @category{streams}
7c913512 151
e54c96f1 152 @see wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream
23324ae1
FM
153*/
154class wxFileInputStream : public wxInputStream
155{
156public:
157 //@{
158 /**
159 Initializes a file stream in read-only mode using the specified file descriptor.
160 */
161 wxFileInputStream(const wxString& ifileName);
7c913512
FM
162 wxFileInputStream(wxFile& file);
163 wxFileInputStream(int fd);
23324ae1
FM
164 //@}
165
166 /**
167 Destructor.
168 */
169 ~wxFileInputStream();
170
171 /**
172 Returns @true if the stream is initialized and ready.
173 */
328f5751 174 bool IsOk() const;
23324ae1
FM
175};
176
177
e54c96f1 178
23324ae1
FM
179/**
180 @class wxFFileInputStream
7c913512 181
23324ae1 182 This class represents data read in from a file. There are actually
7c913512 183 two such groups of classes: this one is based on wxFFile
23324ae1
FM
184 whereas wxFileInputStream is based in
185 the wxFile class.
7c913512
FM
186
187 Note that wxInputStream::SeekI
188 can seek beyond the end of the stream (file) and will thus not return
23324ae1 189 @e wxInvalidOffset for that.
7c913512 190
23324ae1
FM
191 @library{wxbase}
192 @category{streams}
7c913512 193
e54c96f1 194 @see wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream
23324ae1
FM
195*/
196class wxFFileInputStream : public wxInputStream
197{
198public:
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");
7c913512 206 wxFFileInputStream(wxFFile& file);
4cc4bfaf 207 wxFFileInputStream(FILE* fp);
23324ae1
FM
208 //@}
209
210 /**
211 Destructor.
212 */
213 ~wxFFileInputStream();
214
215 /**
216 Returns @true if the stream is initialized and ready.
217 */
328f5751 218 bool IsOk() const;
23324ae1
FM
219};
220
221
e54c96f1 222
23324ae1
FM
223/**
224 @class wxFFileStream
7c913512
FM
225
226
23324ae1
FM
227 @library{wxbase}
228 @category{FIXME}
7c913512 229
e54c96f1 230 @see wxStreamBuffer
23324ae1
FM
231*/
232class wxFFileStream : public wxFFileOutputStream
233{
234public:
235 /**
7c913512 236 Initializes a new file stream in read-write mode using the specified
23324ae1
FM
237 @e iofilename name.
238 */
02e22828 239 wxFFileStream(const wxString& iofileName, const wxString& mode = "w+b");
23324ae1
FM
240};
241
242
e54c96f1 243
23324ae1
FM
244/**
245 @class wxFileStream
7c913512
FM
246
247
23324ae1
FM
248 @library{wxbase}
249 @category{FIXME}
7c913512 250
e54c96f1 251 @see wxStreamBuffer
23324ae1
FM
252*/
253class wxFileStream : public wxFileOutputStream
254{
255public:
256 /**
7c913512 257 Initializes a new file stream in read-write mode using the specified
23324ae1
FM
258 @e iofilename name.
259 */
260 wxFileStream(const wxString& iofileName);
261};
e54c96f1 262