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__
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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 WXDLLIMPEXP_BASE 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;
55 DECLARE_NO_COPY_CLASS(wxFileInputStream
)
58 class WXDLLIMPEXP_BASE wxFileOutputStream
: public wxOutputStream
{
60 wxFileOutputStream(const wxString
& fileName
);
61 wxFileOutputStream(wxFile
& file
);
62 wxFileOutputStream(int fd
);
63 virtual ~wxFileOutputStream();
65 // To solve an ambiguity on GCC
66 // inline wxOutputStream& Write(const void *buffer, size_t size)
67 // { return wxOutputStream::Write(buffer, size); }
70 size_t GetSize() const;
72 bool Ok() const { return m_file
->IsOpened(); }
77 size_t OnSysWrite(const void *buffer
, size_t size
);
78 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
79 off_t
OnSysTell() const;
85 DECLARE_NO_COPY_CLASS(wxFileOutputStream
)
88 class WXDLLIMPEXP_BASE wxFileStream
: public wxFileInputStream
,
89 public wxFileOutputStream
92 wxFileStream(const wxString
& fileName
);
95 DECLARE_NO_COPY_CLASS(wxFileStream
)
98 // ----------------------------------------------------------------------------
99 // wxFFileStream using wxFFile
100 // ----------------------------------------------------------------------------
102 class WXDLLIMPEXP_BASE wxFFileInputStream
: public wxInputStream
{
104 wxFFileInputStream(const wxString
& ifileName
);
105 wxFFileInputStream(wxFFile
& file
);
106 wxFFileInputStream(FILE *file
);
107 ~wxFFileInputStream();
109 size_t GetSize() const;
111 bool Ok() const { return m_file
->IsOpened(); }
114 wxFFileInputStream();
116 size_t OnSysRead(void *buffer
, size_t size
);
117 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
118 off_t
OnSysTell() const;
124 DECLARE_NO_COPY_CLASS(wxFFileInputStream
)
127 class WXDLLIMPEXP_BASE wxFFileOutputStream
: public wxOutputStream
{
129 wxFFileOutputStream(const wxString
& fileName
);
130 wxFFileOutputStream(wxFFile
& file
);
131 wxFFileOutputStream(FILE *file
);
132 virtual ~wxFFileOutputStream();
134 // To solve an ambiguity on GCC
135 // inline wxOutputStream& Write(const void *buffer, size_t size)
136 // { return wxOutputStream::Write(buffer, size); }
139 size_t GetSize() const;
141 bool Ok() const { return m_file
->IsOpened(); }
144 wxFFileOutputStream();
146 size_t OnSysWrite(const void *buffer
, size_t size
);
147 off_t
OnSysSeek(off_t pos
, wxSeekMode mode
);
148 off_t
OnSysTell() const;
154 DECLARE_NO_COPY_CLASS(wxFFileOutputStream
)
157 class WXDLLIMPEXP_BASE wxFFileStream
: public wxFFileInputStream
,
158 public wxFFileOutputStream
161 wxFFileStream(const wxString
& fileName
);
164 DECLARE_NO_COPY_CLASS(wxFFileStream
)
168 // wxUSE_STREAMS && wxUSE_FILE