1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: File stream classes
4 // Author: Guilhem Lavaux
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_WXFSTREAM_H__
13 #define _WX_WXFSTREAM_H__
16 #pragma interface "wfstream.h"
21 #if wxUSE_STREAMS && wxUSE_FILE
23 #include "wx/object.h"
24 #include "wx/string.h"
25 #include "wx/stream.h"
29 // ----------------------------------------------------------------------------
30 // wxFileStream using wxFile
31 // ----------------------------------------------------------------------------
33 class WXDLLEXPORT wxFileInputStream
: public wxInputStream
{
35 wxFileInputStream(const wxString
& ifileName
);
36 wxFileInputStream(wxFile
& file
);
37 wxFileInputStream(int fd
);
40 size_t GetSize() const;
42 bool Ok() const { return m_file
->IsOpened(); }
47 size_t OnSysRead(void *buffer
, size_t size
);
48 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
49 off_t
OnSysTell() const;
56 class WXDLLEXPORT wxFileOutputStream
: public wxOutputStream
{
58 wxFileOutputStream(const wxString
& fileName
);
59 wxFileOutputStream(wxFile
& file
);
60 wxFileOutputStream(int fd
);
61 virtual ~wxFileOutputStream();
63 // To solve an ambiguity on GCC
64 // inline wxOutputStream& Write(const void *buffer, size_t size)
65 // { return wxOutputStream::Write(buffer, size); }
68 size_t GetSize() const;
70 bool Ok() const { return m_file
->IsOpened(); }
75 size_t OnSysWrite(const void *buffer
, size_t size
);
76 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
77 off_t
OnSysTell() const;
84 class WXDLLEXPORT wxFileStream
: public wxFileInputStream
, public wxFileOutputStream
{
86 wxFileStream(const wxString
& fileName
);
89 // ----------------------------------------------------------------------------
90 // wxFFileStream using wxFFile
91 // ----------------------------------------------------------------------------
93 class WXDLLEXPORT wxFFileInputStream
: public wxInputStream
{
95 wxFFileInputStream(const wxString
& ifileName
);
96 wxFFileInputStream(wxFFile
& file
);
97 wxFFileInputStream(FILE *file
);
98 ~wxFFileInputStream();
100 size_t GetSize() const;
102 bool Ok() const { return m_file
->IsOpened(); }
105 wxFFileInputStream();
107 size_t OnSysRead(void *buffer
, size_t size
);
108 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
109 off_t
OnSysTell() const;
116 class WXDLLEXPORT wxFFileOutputStream
: public wxOutputStream
{
118 wxFFileOutputStream(const wxString
& fileName
);
119 wxFFileOutputStream(wxFFile
& file
);
120 wxFFileOutputStream(FILE *file
);
121 virtual ~wxFFileOutputStream();
123 // To solve an ambiguity on GCC
124 // inline wxOutputStream& Write(const void *buffer, size_t size)
125 // { return wxOutputStream::Write(buffer, size); }
128 size_t GetSize() const;
130 bool Ok() const { return m_file
->IsOpened(); }
133 wxFFileOutputStream();
135 size_t OnSysWrite(const void *buffer
, size_t size
);
136 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
137 off_t
OnSysTell() const;
144 class WXDLLEXPORT wxFFileStream
: public wxFFileInputStream
, public wxFFileOutputStream
{
146 wxFFileStream(const wxString
& fileName
);
149 // wxUSE_STREAMS && wxUSE_FILE