]>
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 | ||
32fc4afb GL |
19 | #include <wx/object.h> |
20 | #include <wx/string.h> | |
21 | #include <wx/stream.h> | |
79c3e0e1 | 22 | #include <wx/file.h> |
32fc4afb | 23 | |
75ed1d15 | 24 | class wxFileInputStream: public wxInputStream { |
32fc4afb | 25 | public: |
75ed1d15 GL |
26 | wxFileInputStream(const wxString& ifileName); |
27 | wxFileInputStream(wxFile& file); | |
28 | wxFileInputStream(int fd); | |
84b46c35 | 29 | ~wxFileInputStream(); |
32fc4afb | 30 | |
84b46c35 GL |
31 | char Peek(); |
32 | size_t StreamSize() const; | |
32fc4afb | 33 | |
25c70b07 | 34 | bool Ok() const { return m_file->IsOpened(); } |
79c3e0e1 GL |
35 | |
36 | protected: | |
25c70b07 | 37 | wxFileInputStream(); |
79c3e0e1 | 38 | |
75ed1d15 GL |
39 | size_t OnSysRead(void *buffer, size_t size); |
40 | off_t OnSysSeek(off_t pos, wxSeekMode mode); | |
41 | off_t OnSysTell() const; | |
42 | ||
43 | protected: | |
44 | wxFile *m_file; | |
45 | bool m_file_destroy; | |
79c3e0e1 GL |
46 | }; |
47 | ||
75ed1d15 | 48 | class wxFileOutputStream: public wxOutputStream { |
79c3e0e1 GL |
49 | public: |
50 | wxFileOutputStream(const wxString& fileName); | |
75ed1d15 GL |
51 | wxFileOutputStream(wxFile& file); |
52 | wxFileOutputStream(int fd); | |
79c3e0e1 GL |
53 | virtual ~wxFileOutputStream(); |
54 | ||
1678ad78 | 55 | // To solve an ambiguity on GCC |
a737331d GL |
56 | // inline wxOutputStream& Write(const void *buffer, size_t size) |
57 | // { return wxOutputStream::Write(buffer, size); } | |
32fc4afb GL |
58 | |
59 | void Sync(); | |
84b46c35 | 60 | size_t StreamSize() const; |
32fc4afb | 61 | |
25c70b07 | 62 | bool Ok() const { return m_file->IsOpened(); } |
32fc4afb | 63 | |
79c3e0e1 | 64 | protected: |
25c70b07 | 65 | wxFileOutputStream(); |
32fc4afb | 66 | |
75ed1d15 GL |
67 | size_t OnSysWrite(const void *buffer, size_t size); |
68 | off_t OnSysSeek(off_t pos, wxSeekMode mode); | |
69 | off_t OnSysTell() const; | |
32fc4afb | 70 | |
75ed1d15 GL |
71 | protected: |
72 | wxFile *m_file; | |
73 | bool m_file_destroy; | |
32fc4afb GL |
74 | }; |
75 | ||
84b46c35 GL |
76 | class wxFileStream: public wxFileInputStream, public wxFileOutputStream { |
77 | public: | |
78 | wxFileStream(const wxString& fileName); | |
79 | }; | |
80 | ||
32fc4afb | 81 | #endif |