]>
Commit | Line | Data |
---|---|---|
32fc4afb | 1 | ///////////////////////////////////////////////////////////////////////////// |
bd5e2346 | 2 | // Name: wfstream.h |
32fc4afb GL |
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 | ///////////////////////////////////////////////////////////////////////////// | |
0c32066b | 11 | |
34138703 JS |
12 | #ifndef _WX_WXFSTREAM_H__ |
13 | #define _WX_WXFSTREAM_H__ | |
32fc4afb | 14 | |
0c32066b | 15 | #ifdef __GNUG__ |
bd5e2346 | 16 | #pragma interface "wfstream.h" |
0c32066b JS |
17 | #endif |
18 | ||
2df98b23 | 19 | #include "wx/defs.h" |
ce4169a4 RR |
20 | |
21 | #if wxUSE_STREAMS && wxUSE_FILE | |
22 | ||
ed58dbea RR |
23 | #include "wx/object.h" |
24 | #include "wx/string.h" | |
25 | #include "wx/stream.h" | |
26 | #include "wx/file.h" | |
32fc4afb | 27 | |
75ed1d15 | 28 | class wxFileInputStream: public wxInputStream { |
32fc4afb | 29 | public: |
75ed1d15 GL |
30 | wxFileInputStream(const wxString& ifileName); |
31 | wxFileInputStream(wxFile& file); | |
32 | wxFileInputStream(int fd); | |
84b46c35 | 33 | ~wxFileInputStream(); |
32fc4afb | 34 | |
cd25b18c | 35 | size_t GetSize() const; |
32fc4afb | 36 | |
25c70b07 | 37 | bool Ok() const { return m_file->IsOpened(); } |
79c3e0e1 GL |
38 | |
39 | protected: | |
25c70b07 | 40 | wxFileInputStream(); |
79c3e0e1 | 41 | |
75ed1d15 GL |
42 | size_t OnSysRead(void *buffer, size_t size); |
43 | off_t OnSysSeek(off_t pos, wxSeekMode mode); | |
44 | off_t OnSysTell() const; | |
45 | ||
46 | protected: | |
47 | wxFile *m_file; | |
48 | bool m_file_destroy; | |
79c3e0e1 GL |
49 | }; |
50 | ||
75ed1d15 | 51 | class wxFileOutputStream: public wxOutputStream { |
79c3e0e1 GL |
52 | public: |
53 | wxFileOutputStream(const wxString& fileName); | |
75ed1d15 GL |
54 | wxFileOutputStream(wxFile& file); |
55 | wxFileOutputStream(int fd); | |
79c3e0e1 GL |
56 | virtual ~wxFileOutputStream(); |
57 | ||
1678ad78 | 58 | // To solve an ambiguity on GCC |
a737331d GL |
59 | // inline wxOutputStream& Write(const void *buffer, size_t size) |
60 | // { return wxOutputStream::Write(buffer, size); } | |
32fc4afb GL |
61 | |
62 | void Sync(); | |
cd25b18c | 63 | size_t GetSize() const; |
32fc4afb | 64 | |
25c70b07 | 65 | bool Ok() const { return m_file->IsOpened(); } |
32fc4afb | 66 | |
79c3e0e1 | 67 | protected: |
25c70b07 | 68 | wxFileOutputStream(); |
32fc4afb | 69 | |
75ed1d15 GL |
70 | size_t OnSysWrite(const void *buffer, size_t size); |
71 | off_t OnSysSeek(off_t pos, wxSeekMode mode); | |
72 | off_t OnSysTell() const; | |
32fc4afb | 73 | |
75ed1d15 GL |
74 | protected: |
75 | wxFile *m_file; | |
76 | bool m_file_destroy; | |
32fc4afb GL |
77 | }; |
78 | ||
84b46c35 GL |
79 | class wxFileStream: public wxFileInputStream, public wxFileOutputStream { |
80 | public: | |
81 | wxFileStream(const wxString& fileName); | |
82 | }; | |
83 | ||
32fc4afb | 84 | #endif |
ce4169a4 RR |
85 | // wxUSE_STREAMS && wxUSE_FILE |
86 | ||
87 | #endif | |
cc985fac PA |
88 | // _WX_WXFSTREAM_H__ |
89 |