1998-07-12 11:24:52 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: fstream.h
|
|
|
|
// Purpose: File stream classes
|
|
|
|
// Author: Guilhem Lavaux
|
|
|
|
// Modified by:
|
|
|
|
// Created: 11/07/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Guilhem Lavaux
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef __WXFSTREAM_H__
|
|
|
|
#define __WXFSTREAM_H__
|
|
|
|
|
|
|
|
#include <wx/object.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/stream.h>
|
1998-07-14 08:06:50 -04:00
|
|
|
#include <wx/file.h>
|
1998-07-12 11:24:52 -04:00
|
|
|
|
1998-07-14 08:06:50 -04:00
|
|
|
class wxFileInputStream: virtual public wxFile, public wxInputStream {
|
1998-07-12 11:24:52 -04:00
|
|
|
public:
|
1998-07-14 08:06:50 -04:00
|
|
|
wxFileInputStream(const wxString& fileName);
|
|
|
|
virtual ~wxFileInputStream();
|
1998-07-12 11:24:52 -04:00
|
|
|
|
|
|
|
wxInputStream& Read(void *buffer, size_t size);
|
1998-07-14 08:06:50 -04:00
|
|
|
off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart);
|
|
|
|
off_t TellI() const;
|
1998-07-12 11:24:52 -04:00
|
|
|
|
|
|
|
bool Eof() const { return m_eof; }
|
|
|
|
size_t LastRead() const { return m_lastread; }
|
|
|
|
|
1998-07-14 08:06:50 -04:00
|
|
|
bool Ok() const { return wxFile::IsOpened(); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxFileInputStream() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool m_eof;
|
|
|
|
bool m_ok_i;
|
|
|
|
size_t m_lastread;
|
|
|
|
};
|
|
|
|
|
|
|
|
class wxFileOutputStream: virtual wxFile, public wxOutputStream {
|
|
|
|
public:
|
|
|
|
wxFileOutputStream(const wxString& fileName);
|
|
|
|
virtual ~wxFileOutputStream();
|
|
|
|
|
1998-07-12 11:24:52 -04:00
|
|
|
wxOutputStream& Write(const void *buffer, size_t size);
|
1998-07-14 08:06:50 -04:00
|
|
|
off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart);
|
|
|
|
off_t TellO() const;
|
1998-07-12 11:24:52 -04:00
|
|
|
|
|
|
|
bool Bad() const { return m_bad; }
|
|
|
|
size_t LastWrite() const { return m_lastwrite; }
|
|
|
|
|
|
|
|
void Sync();
|
|
|
|
|
1998-07-14 08:06:50 -04:00
|
|
|
bool IsOpened() const { return wxFile::IsOpened(); }
|
1998-07-12 11:24:52 -04:00
|
|
|
|
1998-07-14 08:06:50 -04:00
|
|
|
protected:
|
|
|
|
wxFileOutputStream() {}
|
1998-07-12 11:24:52 -04:00
|
|
|
|
1998-07-14 08:06:50 -04:00
|
|
|
protected:
|
|
|
|
bool m_bad;
|
|
|
|
size_t m_lastwrite;
|
1998-07-12 11:24:52 -04:00
|
|
|
};
|
|
|
|
|
1998-07-14 08:06:50 -04:00
|
|
|
class wxFileStream: public wxFileInputStream, public wxFileOutputStream {
|
1998-07-12 11:24:52 -04:00
|
|
|
public:
|
1998-07-14 08:06:50 -04:00
|
|
|
wxFileStream(const wxString& fileName);
|
|
|
|
virtual ~wxFileStream();
|
1998-07-12 11:24:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|