]>
git.saurik.com Git - wxWidgets.git/blob - src/common/fstream.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: "File stream" classes
4 // Author: Julian Smart
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "fstream.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
19 #include <wx/stream.h>
20 #include <wx/fstream.h>
26 // ----------------------------------------------------------------------------
28 // ----------------------------------------------------------------------------
30 wxFileInputStream::wxFileInputStream(const wxString
& fileName
)
31 : wxFile(fileName
, read
)
33 m_i_streambuf
->SetBufferIO(1024);
36 wxFileInputStream::~wxFileInputStream()
40 char wxFileInputStream::Peek()
45 size_t wxFileInputStream::DoRead(void *buffer
, size_t size
)
47 size_t ret
= wxFile::Read(buffer
, size
);
48 m_eof
= wxFile::Eof();
53 off_t
wxFileInputStream::DoSeekInput(off_t pos
, wxSeekMode mode
)
55 return wxFile::Seek(pos
, mode
);
58 off_t
wxFileInputStream::DoTellInput() const
60 return wxFile::Tell();
63 // ----------------------------------------------------------------------------
65 // ----------------------------------------------------------------------------
67 wxFileOutputStream::wxFileOutputStream(const wxString
& fileName
)
68 : wxFile(fileName
, write
)
70 m_o_streambuf
->SetBufferIO(1024);
73 wxFileOutputStream::~wxFileOutputStream()
78 size_t wxFileOutputStream::DoWrite(const void *buffer
, size_t size
)
80 size_t ret
= wxFile::Write(buffer
, size
);
81 m_bad
= wxFile::Error();
85 off_t
wxFileOutputStream::DoTellOutput() const
87 return wxFile::Tell();
90 off_t
wxFileOutputStream::DoSeekOutput(off_t pos
, wxSeekMode mode
)
92 return wxFile::Seek(pos
, mode
);
95 void wxFileOutputStream::Sync()
97 wxOutputStream::Sync();
101 // ----------------------------------------------------------------------------
103 // ----------------------------------------------------------------------------
105 wxFileStream::wxFileStream(const wxString
& fileName
)
106 : wxFile(fileName
, read_write
)
110 wxFileStream::~wxFileStream()