]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/fstream.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: File stream classes
4 // Author: Guilhem Lavaux
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_WXFSTREAM_H__
12 #define _WX_WXFSTREAM_H__
14 #include <wx/object.h>
15 #include <wx/string.h>
16 #include <wx/stream.h>
19 class wxFileStreamBase
{
25 class wxFileInputStream
: public wxInputStream
, virtual public wxFileStreamBase
{
27 wxFileInputStream(const wxString
& fileName
);
28 virtual ~wxFileInputStream();
32 bool Ok() const { return m_file
->IsOpened(); }
37 size_t DoRead(void *buffer
, size_t size
);
38 off_t
DoSeekInput(off_t pos
, wxSeekMode mode
);
39 off_t
DoTellInput() const;
42 class wxFileOutputStream
: public wxOutputStream
, virtual public wxFileStreamBase
{
44 wxFileOutputStream(const wxString
& fileName
);
45 virtual ~wxFileOutputStream();
47 // To solve an ambiguity on GCC
48 inline wxOutputStream
& Write(const void *buffer
, size_t size
)
49 { return wxOutputStream::Write(buffer
, size
); }
53 bool Ok() const { return m_file
->IsOpened(); }
58 size_t DoWrite(const void *buffer
, size_t size
);
59 off_t
DoSeekOutput(off_t pos
, wxSeekMode mode
);
60 off_t
DoTellOutput() const;
63 class wxFileStream
: public wxFileInputStream
, public wxFileOutputStream
{
65 wxFileStream(const wxString
& fileName
);
66 virtual ~wxFileStream();