]>
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 #define BUF_TEMP_SIZE 10000
28 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
32 wxFileInputStream::wxFileInputStream(const wxString
& fileName
)
33 : wxFile(fileName
, read
)
35 m_i_streambuf
->SetBufferIO(1024);
38 wxFileInputStream::~wxFileInputStream()
42 char wxFileInputStream::Peek()
47 size_t wxFileInputStream::DoRead(void *buffer
, size_t size
)
49 return wxFile::Read(buffer
, size
);
52 off_t
wxFileInputStream::DoSeekInput(off_t pos
, wxSeekMode mode
)
54 return wxFile::Seek(pos
, mode
);
57 off_t
wxFileInputStream::DoTellInput() const
59 return wxFile::Tell();
62 // ----------------------------------------------------------------------------
64 // ----------------------------------------------------------------------------
66 wxFileOutputStream::wxFileOutputStream(const wxString
& fileName
)
67 : wxFile(fileName
, write
)
69 m_o_streambuf
->SetBufferIO(1024);
72 wxFileOutputStream::~wxFileOutputStream()
77 size_t wxFileOutputStream::DoWrite(const void *buffer
, size_t size
)
79 size_t ret
= wxFile::Write(buffer
, size
);
80 m_bad
= wxFile::Error();
84 off_t
wxFileOutputStream::DoTellOutput() const
86 return wxFile::Tell();
89 off_t
wxFileOutputStream::DoSeekOutput(off_t pos
, wxSeekMode mode
)
91 return wxFile::Seek(pos
, mode
);
94 void wxFileOutputStream::Sync()
96 wxOutputStream::Sync();
100 // ----------------------------------------------------------------------------
102 // ----------------------------------------------------------------------------
104 wxFileStream::wxFileStream(const wxString
& fileName
)
105 : wxFile(fileName
, read_write
)
109 wxFileStream::~wxFileStream()