]>
Commit | Line | Data |
---|---|---|
32fc4afb GL |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: fstream.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 | #ifndef __WXFSTREAM_H__ | |
12 | #define __WXFSTREAM_H__ | |
13 | ||
32fc4afb GL |
14 | #include <wx/object.h> |
15 | #include <wx/string.h> | |
16 | #include <wx/stream.h> | |
79c3e0e1 | 17 | #include <wx/file.h> |
32fc4afb | 18 | |
1678ad78 | 19 | class wxFileInputStream: public wxInputStream, virtual public wxFile { |
32fc4afb | 20 | public: |
79c3e0e1 GL |
21 | wxFileInputStream(const wxString& fileName); |
22 | virtual ~wxFileInputStream(); | |
32fc4afb | 23 | |
1678ad78 | 24 | virtual char Peek(); |
32fc4afb | 25 | |
1678ad78 | 26 | virtual bool Eof() const { return wxFile::Eof(); } |
32fc4afb | 27 | |
79c3e0e1 GL |
28 | bool Ok() const { return wxFile::IsOpened(); } |
29 | ||
30 | protected: | |
31 | wxFileInputStream() {} | |
32 | ||
1678ad78 GL |
33 | size_t DoRead(void *buffer, size_t size); |
34 | off_t DoSeekInput(off_t pos, wxSeekMode mode); | |
35 | off_t DoTellInput() const; | |
79c3e0e1 GL |
36 | }; |
37 | ||
1678ad78 | 38 | class wxFileOutputStream: public wxOutputStream, virtual public wxFile { |
79c3e0e1 GL |
39 | public: |
40 | wxFileOutputStream(const wxString& fileName); | |
41 | virtual ~wxFileOutputStream(); | |
42 | ||
1678ad78 GL |
43 | // To solve an ambiguity on GCC |
44 | inline wxOutputStream& Write(const void *buffer, size_t size) | |
45 | { return wxOutputStream::Write(buffer, size); } | |
32fc4afb GL |
46 | |
47 | void Sync(); | |
48 | ||
1678ad78 | 49 | bool Ok() const { return wxFile::IsOpened(); } |
32fc4afb | 50 | |
79c3e0e1 GL |
51 | protected: |
52 | wxFileOutputStream() {} | |
32fc4afb | 53 | |
1678ad78 GL |
54 | size_t DoWrite(const void *buffer, size_t size); |
55 | off_t DoSeekOutput(off_t pos, wxSeekMode mode); | |
56 | off_t DoTellOutput() const; | |
32fc4afb GL |
57 | }; |
58 | ||
79c3e0e1 | 59 | class wxFileStream: public wxFileInputStream, public wxFileOutputStream { |
32fc4afb | 60 | public: |
79c3e0e1 GL |
61 | wxFileStream(const wxString& fileName); |
62 | virtual ~wxFileStream(); | |
32fc4afb GL |
63 | }; |
64 | ||
65 | #endif |