]> git.saurik.com Git - wxWidgets.git/blob - include/wx/fstream.h
384a614bc4c9402715d73f26d67d060e1c36872a
[wxWidgets.git] / include / wx / fstream.h
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
14 #include <wx/object.h>
15 #include <wx/string.h>
16 #include <wx/stream.h>
17 #include <wx/file.h>
18
19 class wxFileInputStream: virtual public wxFile, public wxInputStream {
20 DECLARE_CLASS(wxFileInputStream)
21 public:
22 wxFileInputStream(const wxString& fileName);
23 virtual ~wxFileInputStream();
24
25 wxInputStream& Read(void *buffer, size_t size);
26 off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart);
27 off_t TellI() const;
28
29 bool Eof() const { return m_eof; }
30 size_t LastRead() const { return m_lastread; }
31
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
49 wxOutputStream& Write(const void *buffer, size_t size);
50 off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart);
51 off_t TellO() const;
52
53 bool Bad() const { return m_bad; }
54 size_t LastWrite() const { return m_lastwrite; }
55
56 void Sync();
57
58 bool IsOpened() const { return wxFile::IsOpened(); }
59
60 protected:
61 wxFileOutputStream() {}
62
63 protected:
64 bool m_bad;
65 size_t m_lastwrite;
66 };
67
68 class wxFileStream: public wxFileInputStream, public wxFileOutputStream {
69 DECLARE_CLASS(wxFileStream)
70 public:
71 wxFileStream(const wxString& fileName);
72 virtual ~wxFileStream();
73 };
74
75 #endif