1998-07-12 15:24:52 +00: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-09-10 11:41:14 +00:00
|
|
|
|
1998-08-15 00:23:28 +00:00
|
|
|
#ifndef _WX_WXFSTREAM_H__
|
|
|
|
#define _WX_WXFSTREAM_H__
|
1998-07-12 15:24:52 +00:00
|
|
|
|
1998-09-10 11:41:14 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "fstream.h"
|
|
|
|
#endif
|
|
|
|
|
1998-07-12 15:24:52 +00:00
|
|
|
#include <wx/object.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/stream.h>
|
1998-07-14 12:06:50 +00:00
|
|
|
#include <wx/file.h>
|
1998-07-12 15:24:52 +00:00
|
|
|
|
1998-10-14 17:36:50 +00:00
|
|
|
class wxFileInputStream: public wxInputStream {
|
1998-07-12 15:24:52 +00:00
|
|
|
public:
|
1998-10-14 17:36:50 +00:00
|
|
|
wxFileInputStream(const wxString& ifileName);
|
|
|
|
wxFileInputStream(wxFile& file);
|
|
|
|
wxFileInputStream(int fd);
|
1998-10-28 18:29:51 +00:00
|
|
|
~wxFileInputStream();
|
1998-07-12 15:24:52 +00:00
|
|
|
|
1998-10-28 18:29:51 +00:00
|
|
|
char Peek();
|
|
|
|
size_t StreamSize() const;
|
1998-07-12 15:24:52 +00:00
|
|
|
|
1998-09-04 17:32:11 +00:00
|
|
|
bool Ok() const { return m_file->IsOpened(); }
|
1998-07-14 12:06:50 +00:00
|
|
|
|
|
|
|
protected:
|
1998-09-04 17:32:11 +00:00
|
|
|
wxFileInputStream();
|
1998-07-14 12:06:50 +00:00
|
|
|
|
1998-10-14 17:36:50 +00:00
|
|
|
size_t OnSysRead(void *buffer, size_t size);
|
|
|
|
off_t OnSysSeek(off_t pos, wxSeekMode mode);
|
|
|
|
off_t OnSysTell() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxFile *m_file;
|
|
|
|
bool m_file_destroy;
|
1998-07-14 12:06:50 +00:00
|
|
|
};
|
|
|
|
|
1998-10-14 17:36:50 +00:00
|
|
|
class wxFileOutputStream: public wxOutputStream {
|
1998-07-14 12:06:50 +00:00
|
|
|
public:
|
|
|
|
wxFileOutputStream(const wxString& fileName);
|
1998-10-14 17:36:50 +00:00
|
|
|
wxFileOutputStream(wxFile& file);
|
|
|
|
wxFileOutputStream(int fd);
|
1998-07-14 12:06:50 +00:00
|
|
|
virtual ~wxFileOutputStream();
|
|
|
|
|
1998-07-24 17:13:47 +00:00
|
|
|
// To solve an ambiguity on GCC
|
|
|
|
inline wxOutputStream& Write(const void *buffer, size_t size)
|
|
|
|
{ return wxOutputStream::Write(buffer, size); }
|
1998-07-12 15:24:52 +00:00
|
|
|
|
|
|
|
void Sync();
|
1998-10-28 18:29:51 +00:00
|
|
|
size_t StreamSize() const;
|
1998-07-12 15:24:52 +00:00
|
|
|
|
1998-09-04 17:32:11 +00:00
|
|
|
bool Ok() const { return m_file->IsOpened(); }
|
1998-07-12 15:24:52 +00:00
|
|
|
|
1998-07-14 12:06:50 +00:00
|
|
|
protected:
|
1998-09-04 17:32:11 +00:00
|
|
|
wxFileOutputStream();
|
1998-07-12 15:24:52 +00:00
|
|
|
|
1998-10-14 17:36:50 +00:00
|
|
|
size_t OnSysWrite(const void *buffer, size_t size);
|
|
|
|
off_t OnSysSeek(off_t pos, wxSeekMode mode);
|
|
|
|
off_t OnSysTell() const;
|
1998-07-12 15:24:52 +00:00
|
|
|
|
1998-10-14 17:36:50 +00:00
|
|
|
protected:
|
|
|
|
wxFile *m_file;
|
|
|
|
bool m_file_destroy;
|
1998-07-12 15:24:52 +00:00
|
|
|
};
|
|
|
|
|
1998-10-28 18:29:51 +00:00
|
|
|
class wxFileStream: public wxFileInputStream, public wxFileOutputStream {
|
|
|
|
public:
|
|
|
|
wxFileStream(const wxString& fileName);
|
|
|
|
};
|
|
|
|
|
1998-07-12 15:24:52 +00:00
|
|
|
#endif
|