wxWidgets/include/wx/fstream.h
Guilhem Lavaux 1678ad7802 * New wxStream classes: wxStreamBuffer and wxObject*Stream.
* Changes: ofsInvalid => wxInvalidOffset in filefn.h
* Updates: all wxStream classes use wxStreamBuffer.
           wxObject basic declaration changes (added LoadObject, modified
           StoreObject)
* Some base of the serialization.
(I hope not to have forgotten any files)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@361 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
1998-07-24 17:13:47 +00:00

66 lines
1.7 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// 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>
#include <wx/file.h>
class wxFileInputStream: public wxInputStream, virtual public wxFile {
public:
wxFileInputStream(const wxString& fileName);
virtual ~wxFileInputStream();
virtual char Peek();
virtual bool Eof() const { return wxFile::Eof(); }
bool Ok() const { return wxFile::IsOpened(); }
protected:
wxFileInputStream() {}
size_t DoRead(void *buffer, size_t size);
off_t DoSeekInput(off_t pos, wxSeekMode mode);
off_t DoTellInput() const;
};
class wxFileOutputStream: public wxOutputStream, virtual public wxFile {
public:
wxFileOutputStream(const wxString& fileName);
virtual ~wxFileOutputStream();
// To solve an ambiguity on GCC
inline wxOutputStream& Write(const void *buffer, size_t size)
{ return wxOutputStream::Write(buffer, size); }
void Sync();
bool Ok() const { return wxFile::IsOpened(); }
protected:
wxFileOutputStream() {}
size_t DoWrite(const void *buffer, size_t size);
off_t DoSeekOutput(off_t pos, wxSeekMode mode);
off_t DoTellOutput() const;
};
class wxFileStream: public wxFileInputStream, public wxFileOutputStream {
public:
wxFileStream(const wxString& fileName);
virtual ~wxFileStream();
};
#endif