]> git.saurik.com Git - wxWidgets.git/blob - include/wx/fstream.h
Added missing accessors
[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: public wxInputStream, virtual public wxFile {
20 public:
21 wxFileInputStream(const wxString& fileName);
22 virtual ~wxFileInputStream();
23
24 virtual char Peek();
25
26 virtual bool Eof() const { return wxFile::Eof(); }
27
28 bool Ok() const { return wxFile::IsOpened(); }
29
30 protected:
31 wxFileInputStream() {}
32
33 size_t DoRead(void *buffer, size_t size);
34 off_t DoSeekInput(off_t pos, wxSeekMode mode);
35 off_t DoTellInput() const;
36 };
37
38 class wxFileOutputStream: public wxOutputStream, virtual public wxFile {
39 public:
40 wxFileOutputStream(const wxString& fileName);
41 virtual ~wxFileOutputStream();
42
43 // To solve an ambiguity on GCC
44 inline wxOutputStream& Write(const void *buffer, size_t size)
45 { return wxOutputStream::Write(buffer, size); }
46
47 void Sync();
48
49 bool Ok() const { return wxFile::IsOpened(); }
50
51 protected:
52 wxFileOutputStream() {}
53
54 size_t DoWrite(const void *buffer, size_t size);
55 off_t DoSeekOutput(off_t pos, wxSeekMode mode);
56 off_t DoTellOutput() const;
57 };
58
59 class wxFileStream: public wxFileInputStream, public wxFileOutputStream {
60 public:
61 wxFileStream(const wxString& fileName);
62 virtual ~wxFileStream();
63 };
64
65 #endif