]> git.saurik.com Git - wxWidgets.git/blob - include/wx/wfstream.h
Deprecated SetItemImage with 2 image ids
[wxWidgets.git] / include / wx / wfstream.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wfstream.h
3 // Purpose: File stream classes
4 // Author: Guilhem Lavaux
5 // Modified by:
6 // Created: 11/07/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_WXFSTREAM_H__
13 #define _WX_WXFSTREAM_H__
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "wfstream.h"
17 #endif
18
19 #include "wx/defs.h"
20
21 #if wxUSE_STREAMS && wxUSE_FILE
22
23 #include "wx/object.h"
24 #include "wx/string.h"
25 #include "wx/stream.h"
26 #include "wx/file.h"
27 #include "wx/ffile.h"
28
29 // ----------------------------------------------------------------------------
30 // wxFileStream using wxFile
31 // ----------------------------------------------------------------------------
32
33 class WXDLLIMPEXP_BASE wxFileInputStream: public wxInputStream {
34 public:
35 wxFileInputStream(const wxString& ifileName);
36 wxFileInputStream(wxFile& file);
37 wxFileInputStream(int fd);
38 ~wxFileInputStream();
39
40 size_t GetSize() const;
41
42 bool Ok() const { return m_file->IsOpened(); }
43
44 protected:
45 wxFileInputStream();
46
47 size_t OnSysRead(void *buffer, size_t size);
48 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
49 wxFileOffset OnSysTell() const;
50
51 protected:
52 wxFile *m_file;
53 bool m_file_destroy;
54
55 DECLARE_NO_COPY_CLASS(wxFileInputStream)
56 };
57
58 class WXDLLIMPEXP_BASE wxFileOutputStream: public wxOutputStream {
59 public:
60 wxFileOutputStream(const wxString& fileName);
61 wxFileOutputStream(wxFile& file);
62 wxFileOutputStream(int fd);
63 virtual ~wxFileOutputStream();
64
65 // To solve an ambiguity on GCC
66 // inline wxOutputStream& Write(const void *buffer, size_t size)
67 // { return wxOutputStream::Write(buffer, size); }
68
69 void Sync();
70 size_t GetSize() const;
71
72 bool Ok() const { return m_file->IsOpened(); }
73
74 protected:
75 wxFileOutputStream();
76
77 size_t OnSysWrite(const void *buffer, size_t size);
78 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
79 wxFileOffset OnSysTell() const;
80
81 protected:
82 wxFile *m_file;
83 bool m_file_destroy;
84
85 DECLARE_NO_COPY_CLASS(wxFileOutputStream)
86 };
87
88 class WXDLLIMPEXP_BASE wxFileStream : public wxFileInputStream,
89 public wxFileOutputStream
90 {
91 public:
92 wxFileStream(const wxString& fileName);
93
94 private:
95 DECLARE_NO_COPY_CLASS(wxFileStream)
96 };
97
98 // ----------------------------------------------------------------------------
99 // wxFFileStream using wxFFile
100 // ----------------------------------------------------------------------------
101
102 class WXDLLIMPEXP_BASE wxFFileInputStream: public wxInputStream {
103 public:
104 wxFFileInputStream(const wxString& ifileName);
105 wxFFileInputStream(wxFFile& file);
106 wxFFileInputStream(FILE *file);
107 ~wxFFileInputStream();
108
109 size_t GetSize() const;
110
111 bool Ok() const { return m_file->IsOpened(); }
112
113 protected:
114 wxFFileInputStream();
115
116 size_t OnSysRead(void *buffer, size_t size);
117 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
118 wxFileOffset OnSysTell() const;
119
120 protected:
121 wxFFile *m_file;
122 bool m_file_destroy;
123
124 DECLARE_NO_COPY_CLASS(wxFFileInputStream)
125 };
126
127 class WXDLLIMPEXP_BASE wxFFileOutputStream: public wxOutputStream {
128 public:
129 wxFFileOutputStream(const wxString& fileName);
130 wxFFileOutputStream(wxFFile& file);
131 wxFFileOutputStream(FILE *file);
132 virtual ~wxFFileOutputStream();
133
134 // To solve an ambiguity on GCC
135 // inline wxOutputStream& Write(const void *buffer, size_t size)
136 // { return wxOutputStream::Write(buffer, size); }
137
138 void Sync();
139 size_t GetSize() const;
140
141 bool Ok() const { return m_file->IsOpened(); }
142
143 protected:
144 wxFFileOutputStream();
145
146 size_t OnSysWrite(const void *buffer, size_t size);
147 wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
148 wxFileOffset OnSysTell() const;
149
150 protected:
151 wxFFile *m_file;
152 bool m_file_destroy;
153
154 DECLARE_NO_COPY_CLASS(wxFFileOutputStream)
155 };
156
157 class WXDLLIMPEXP_BASE wxFFileStream : public wxFFileInputStream,
158 public wxFFileOutputStream
159 {
160 public:
161 wxFFileStream(const wxString& fileName);
162
163 private:
164 DECLARE_NO_COPY_CLASS(wxFFileStream)
165 };
166
167 #endif
168 // wxUSE_STREAMS && wxUSE_FILE
169
170 #endif
171 // _WX_WXFSTREAM_H__
172
173
174
175
176
177
178
179