]>
git.saurik.com Git - wxWidgets.git/blob - src/common/fstream.cpp
ea50fee90a8f6f1915c4e4525c3ab8dea8f66b3f
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>
27 #define BUF_TEMP_SIZE 10000
29 #if !USE_SHARED_LIBRARY
30 IMPLEMENT_CLASS(wxFileInputStream
, wxInputStream
)
31 IMPLEMENT_CLASS(wxFileOutputStream
, wxOutputStream
)
32 IMPLEMENT_CLASS2(wxFileStream
, wxInputStream
, wxOutputStream
)
35 // ----------------------------------------------------------------------------
37 // ----------------------------------------------------------------------------
39 wxFileInputStream::wxFileInputStream(const wxString
& fileName
)
40 : wxFile(fileName
, read
)
45 wxFileInputStream::~wxFileInputStream()
49 wxInputStream
& wxFileInputStream::Read(void *buffer
, size_t size
)
51 m_lastread
= wxFile::Read(buffer
, size
);
55 off_t
wxFileInputStream::SeekI(off_t pos
, wxSeekMode mode
)
57 return wxFile::Seek(pos
, mode
);
60 off_t
wxFileInputStream::TellI() const
62 return wxFile::Tell();
65 // ----------------------------------------------------------------------------
67 // ----------------------------------------------------------------------------
69 wxFileOutputStream::wxFileOutputStream(const wxString
& fileName
)
70 : wxFile(fileName
, write
)
75 wxFileOutputStream::~wxFileOutputStream()
79 wxOutputStream
& wxFileOutputStream::Write(const void *buffer
, size_t size
)
81 m_lastwrite
= wxFile::Write(buffer
, size
);
82 m_bad
= wxFile::Error();
86 off_t
wxFileOutputStream::TellO() const
88 return wxFile::Tell();
91 off_t
wxFileOutputStream::SeekO(off_t pos
, wxSeekMode mode
)
93 return wxFile::Seek(pos
, mode
);
96 void wxFileOutputStream::Sync()
101 // ----------------------------------------------------------------------------
103 // ----------------------------------------------------------------------------
105 wxFileStream::wxFileStream(const wxString
& fileName
)
106 : wxFile(fileName
, read_write
)
110 wxFileStream::~wxFileStream()