]>
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 | |
79c3e0e1 GL |
19 | class wxFileInputStream: virtual public wxFile, public wxInputStream { |
20 | DECLARE_CLASS(wxFileInputStream) | |
32fc4afb | 21 | public: |
79c3e0e1 GL |
22 | wxFileInputStream(const wxString& fileName); |
23 | virtual ~wxFileInputStream(); | |
32fc4afb GL |
24 | |
25 | wxInputStream& Read(void *buffer, size_t size); | |
79c3e0e1 GL |
26 | off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart); |
27 | off_t TellI() const; | |
32fc4afb GL |
28 | |
29 | bool Eof() const { return m_eof; } | |
30 | size_t LastRead() const { return m_lastread; } | |
31 | ||
79c3e0e1 GL |
32 | bool Ok() const { return wxFile::IsOpened(); } |
33 | ||
34 | protected: | |
35 | wxFileInputStream() {} | |
36 | ||
37 | protected: | |
38 | bool m_eof; | |
39 | bool m_ok_i; | |
40 | size_t m_lastread; | |
41 | }; | |
42 | ||
43 | class wxFileOutputStream: virtual wxFile, public wxOutputStream { | |
44 | DECLARE_CLASS(wxFileOutputStream) | |
45 | public: | |
46 | wxFileOutputStream(const wxString& fileName); | |
47 | virtual ~wxFileOutputStream(); | |
48 | ||
32fc4afb | 49 | wxOutputStream& Write(const void *buffer, size_t size); |
79c3e0e1 GL |
50 | off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart); |
51 | off_t TellO() const; | |
32fc4afb GL |
52 | |
53 | bool Bad() const { return m_bad; } | |
54 | size_t LastWrite() const { return m_lastwrite; } | |
55 | ||
56 | void Sync(); | |
57 | ||
79c3e0e1 | 58 | bool IsOpened() const { return wxFile::IsOpened(); } |
32fc4afb | 59 | |
79c3e0e1 GL |
60 | protected: |
61 | wxFileOutputStream() {} | |
32fc4afb | 62 | |
79c3e0e1 GL |
63 | protected: |
64 | bool m_bad; | |
65 | size_t m_lastwrite; | |
32fc4afb GL |
66 | }; |
67 | ||
79c3e0e1 | 68 | class wxFileStream: public wxFileInputStream, public wxFileOutputStream { |
32fc4afb GL |
69 | DECLARE_CLASS(wxFileStream) |
70 | public: | |
79c3e0e1 GL |
71 | wxFileStream(const wxString& fileName); |
72 | virtual ~wxFileStream(); | |
32fc4afb GL |
73 | }; |
74 | ||
75 | #endif |