]> git.saurik.com Git - wxWidgets.git/blame - include/wx/fstream.h
Changes related to stream includes
[wxWidgets.git] / include / wx / fstream.h
CommitLineData
32fc4afb
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: fstream.h
3// Purpose: File stream classes
4// Author: Guilhem Lavaux
5// Modified by:
6// Created: 11/07/98
7// RCS-ID: $Id$
8// Copyright: (c) Guilhem Lavaux
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
0c32066b 11
34138703
JS
12#ifndef _WX_WXFSTREAM_H__
13#define _WX_WXFSTREAM_H__
32fc4afb 14
0c32066b
JS
15#ifdef __GNUG__
16#pragma interface "fstream.h"
17#endif
18
32fc4afb
GL
19#include <wx/object.h>
20#include <wx/string.h>
21#include <wx/stream.h>
79c3e0e1 22#include <wx/file.h>
32fc4afb 23
0c32066b
JS
24// Disable warnings such as
25// 'wxFileStream' : inherits 'wxFileInputStream::Peek' via dominance
26
27#ifdef _MSC_VER
28#pragma warning(disable:4250)
29#endif
30
25c70b07
GL
31class wxFileStreamBase {
32protected:
33 wxFile *m_file;
34 bool m_file_destroy;
35};
36
c740f496
GL
37class wxFileInputStream: public virtual wxInputStream,
38 public virtual wxFileStreamBase {
32fc4afb 39 public:
79c3e0e1
GL
40 wxFileInputStream(const wxString& fileName);
41 virtual ~wxFileInputStream();
32fc4afb 42
1678ad78 43 virtual char Peek();
32fc4afb 44
25c70b07 45 bool Ok() const { return m_file->IsOpened(); }
79c3e0e1
GL
46
47 protected:
25c70b07 48 wxFileInputStream();
79c3e0e1 49
1678ad78
GL
50 size_t DoRead(void *buffer, size_t size);
51 off_t DoSeekInput(off_t pos, wxSeekMode mode);
52 off_t DoTellInput() const;
79c3e0e1
GL
53};
54
c740f496
GL
55class wxFileOutputStream: public virtual wxOutputStream,
56 public virtual wxFileStreamBase {
79c3e0e1
GL
57 public:
58 wxFileOutputStream(const wxString& fileName);
59 virtual ~wxFileOutputStream();
60
1678ad78
GL
61 // To solve an ambiguity on GCC
62 inline wxOutputStream& Write(const void *buffer, size_t size)
63 { return wxOutputStream::Write(buffer, size); }
32fc4afb
GL
64
65 void Sync();
66
25c70b07 67 bool Ok() const { return m_file->IsOpened(); }
32fc4afb 68
79c3e0e1 69 protected:
25c70b07 70 wxFileOutputStream();
32fc4afb 71
1678ad78
GL
72 size_t DoWrite(const void *buffer, size_t size);
73 off_t DoSeekOutput(off_t pos, wxSeekMode mode);
74 off_t DoTellOutput() const;
32fc4afb
GL
75};
76
f4ada568
GL
77class wxFileStream: public wxStream,
78 public wxFileInputStream, public wxFileOutputStream {
32fc4afb 79 public:
79c3e0e1
GL
80 wxFileStream(const wxString& fileName);
81 virtual ~wxFileStream();
32fc4afb
GL
82};
83
0c32066b
JS
84#ifdef _MSC_VER
85#pragma warning(default:4250)
86#endif
87
32fc4afb 88#endif