f4ada56822
* Updated some wx data and makefiles * Updates on wxStream (reorganization) makefile for Windows will nearly follow wxSocket should work on wxGTK (I've tested it) * IPC over Network is included git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
73 lines
1.8 KiB
C++
73 lines
1.8 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 _WX_WXFSTREAM_H__
|
|
#define _WX_WXFSTREAM_H__
|
|
|
|
#include <wx/object.h>
|
|
#include <wx/string.h>
|
|
#include <wx/stream.h>
|
|
#include <wx/file.h>
|
|
|
|
class wxFileStreamBase {
|
|
protected:
|
|
wxFile *m_file;
|
|
bool m_file_destroy;
|
|
};
|
|
|
|
class wxFileInputStream: virtual public wxInputStream,
|
|
virtual public wxFileStreamBase {
|
|
public:
|
|
wxFileInputStream(const wxString& fileName);
|
|
virtual ~wxFileInputStream();
|
|
|
|
virtual char Peek();
|
|
|
|
bool Ok() const { return m_file->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: virtual public wxOutputStream,
|
|
virtual public wxFileStreamBase {
|
|
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 m_file->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 wxStream,
|
|
public wxFileInputStream, public wxFileOutputStream {
|
|
public:
|
|
wxFileStream(const wxString& fileName);
|
|
virtual ~wxFileStream();
|
|
};
|
|
|
|
#endif
|