]>
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 __WXFSTREAM_H__
12 #define __WXFSTREAM_H__
15 #include <wx/object.h>
16 #include <wx/string.h>
17 #include <wx/stream.h>
19 class wxFileStreamBase
: public wxStream
{
20 DECLARE_CLASS(wxFileStreamBase
)
22 wxFileStreamBase(const wxString
& fileName
, int iolimit
);
23 virtual ~wxFileStreamBase();
25 wxInputStream
& Read(void *buffer
, size_t size
);
26 size_t SeekI(int pos
, wxWhenceType whence
= wxBeginPosition
);
29 bool Eof() const { return m_eof
; }
30 size_t LastRead() const { return m_lastread
; }
32 wxOutputStream
& Write(const void *buffer
, size_t size
);
33 size_t SeekO(int pos
, wxWhenceType whence
= wxBeginPosition
);
36 bool Bad() const { return m_bad
; }
37 size_t LastWrite() const { return m_lastwrite
; }
42 size_t m_lastread
, m_lastwrite
;
47 class wxFileInputStream
: public wxFileStreamBase
{
48 DECLARE_CLASS(wxFileInputStream
)
50 wxFileInputStream(const wxString
& fileName
) : wxFileStreamBase(fileName
, 1) {}
51 virtual ~wxFileInputStream() {}
54 class wxFileOutputStream
: public wxFileStreamBase
{
55 DECLARE_CLASS(wxFileOutputStream
)
57 wxFileOutputStream(const wxString
& fileName
) : wxFileStreamBase(fileName
, 2) {}
58 virtual ~wxFileOutputStream() {}
61 class wxFileStream
: public wxFileStreamBase
{
62 DECLARE_CLASS(wxFileStream
)
64 wxFileStream(const wxString
& fileName
) : wxFileStreamBase(fileName
, 0) {}
65 virtual ~wxFileStream() {}