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