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
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1998-08-14 20:23:28 -04:00
|
|
|
#ifndef _WX_WXFSTREAM_H__
|
|
|
|
#define _WX_WXFSTREAM_H__
|
1998-07-12 11:24:52 -04:00
|
|
|
|
|
|
|
#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-24 13:13:47 -04:00
|
|
|
class wxFileInputStream: public wxInputStream, virtual public wxFile {
|
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
|
|
|
|
1998-07-24 13:13:47 -04:00
|
|
|
virtual char Peek();
|
1998-07-12 11:24:52 -04:00
|
|
|
|
1998-07-24 13:13:47 -04:00
|
|
|
virtual bool Eof() const { return wxFile::Eof(); }
|
1998-07-12 11:24:52 -04:00
|
|
|
|
1998-07-14 08:06:50 -04:00
|
|
|
bool Ok() const { return wxFile::IsOpened(); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxFileInputStream() {}
|
|
|
|
|
1998-07-24 13:13:47 -04:00
|
|
|
size_t DoRead(void *buffer, size_t size);
|
|
|
|
off_t DoSeekInput(off_t pos, wxSeekMode mode);
|
|
|
|
off_t DoTellInput() const;
|
1998-07-14 08:06:50 -04:00
|
|
|
};
|
|
|
|
|
1998-07-24 13:13:47 -04:00
|
|
|
class wxFileOutputStream: public wxOutputStream, virtual public wxFile {
|
1998-07-14 08:06:50 -04:00
|
|
|
public:
|
|
|
|
wxFileOutputStream(const wxString& fileName);
|
|
|
|
virtual ~wxFileOutputStream();
|
|
|
|
|
1998-07-24 13:13:47 -04:00
|
|
|
// To solve an ambiguity on GCC
|
|
|
|
inline wxOutputStream& Write(const void *buffer, size_t size)
|
|
|
|
{ return wxOutputStream::Write(buffer, size); }
|
1998-07-12 11:24:52 -04:00
|
|
|
|
|
|
|
void Sync();
|
|
|
|
|
1998-07-24 13:13:47 -04:00
|
|
|
bool Ok() 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-24 13:13:47 -04:00
|
|
|
size_t DoWrite(const void *buffer, size_t size);
|
|
|
|
off_t DoSeekOutput(off_t pos, wxSeekMode mode);
|
|
|
|
off_t DoTellOutput() const;
|
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
|