]> git.saurik.com Git - wxWidgets.git/blame - include/wx/wfstream.h
wxCursor(wxImage) added (Chris Elliott, patch 517439)
[wxWidgets.git] / include / wx / wfstream.h
CommitLineData
32fc4afb 1/////////////////////////////////////////////////////////////////////////////
bd5e2346 2// Name: wfstream.h
32fc4afb
GL
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 15#ifdef __GNUG__
bd5e2346 16#pragma interface "wfstream.h"
0c32066b
JS
17#endif
18
2df98b23 19#include "wx/defs.h"
ce4169a4
RR
20
21#if wxUSE_STREAMS && wxUSE_FILE
22
ed58dbea
RR
23#include "wx/object.h"
24#include "wx/string.h"
25#include "wx/stream.h"
26#include "wx/file.h"
65045edd
RR
27#include "wx/ffile.h"
28
29// ----------------------------------------------------------------------------
30// wxFileStream using wxFile
31// ----------------------------------------------------------------------------
32fc4afb 32
a0250ba3 33class WXDLLEXPORT wxFileInputStream: public wxInputStream {
32fc4afb 34 public:
75ed1d15
GL
35 wxFileInputStream(const wxString& ifileName);
36 wxFileInputStream(wxFile& file);
37 wxFileInputStream(int fd);
84b46c35 38 ~wxFileInputStream();
32fc4afb 39
cd25b18c 40 size_t GetSize() const;
32fc4afb 41
25c70b07 42 bool Ok() const { return m_file->IsOpened(); }
79c3e0e1
GL
43
44 protected:
25c70b07 45 wxFileInputStream();
79c3e0e1 46
75ed1d15
GL
47 size_t OnSysRead(void *buffer, size_t size);
48 off_t OnSysSeek(off_t pos, wxSeekMode mode);
49 off_t OnSysTell() const;
50
51 protected:
52 wxFile *m_file;
53 bool m_file_destroy;
79c3e0e1
GL
54};
55
a0250ba3 56class WXDLLEXPORT wxFileOutputStream: public wxOutputStream {
79c3e0e1
GL
57 public:
58 wxFileOutputStream(const wxString& fileName);
75ed1d15
GL
59 wxFileOutputStream(wxFile& file);
60 wxFileOutputStream(int fd);
79c3e0e1
GL
61 virtual ~wxFileOutputStream();
62
1678ad78 63 // To solve an ambiguity on GCC
a737331d
GL
64// inline wxOutputStream& Write(const void *buffer, size_t size)
65// { return wxOutputStream::Write(buffer, size); }
32fc4afb
GL
66
67 void Sync();
cd25b18c 68 size_t GetSize() const;
32fc4afb 69
25c70b07 70 bool Ok() const { return m_file->IsOpened(); }
32fc4afb 71
79c3e0e1 72 protected:
25c70b07 73 wxFileOutputStream();
32fc4afb 74
75ed1d15
GL
75 size_t OnSysWrite(const void *buffer, size_t size);
76 off_t OnSysSeek(off_t pos, wxSeekMode mode);
77 off_t OnSysTell() const;
32fc4afb 78
75ed1d15
GL
79 protected:
80 wxFile *m_file;
81 bool m_file_destroy;
32fc4afb
GL
82};
83
a0250ba3 84class WXDLLEXPORT wxFileStream: public wxFileInputStream, public wxFileOutputStream {
84b46c35
GL
85 public:
86 wxFileStream(const wxString& fileName);
87};
88
65045edd
RR
89// ----------------------------------------------------------------------------
90// wxFFileStream using wxFFile
91// ----------------------------------------------------------------------------
92
a0250ba3 93class WXDLLEXPORT wxFFileInputStream: public wxInputStream {
65045edd
RR
94 public:
95 wxFFileInputStream(const wxString& ifileName);
96 wxFFileInputStream(wxFFile& file);
97 wxFFileInputStream(FILE *file);
98 ~wxFFileInputStream();
99
100 size_t GetSize() const;
101
102 bool Ok() const { return m_file->IsOpened(); }
103
104 protected:
105 wxFFileInputStream();
106
107 size_t OnSysRead(void *buffer, size_t size);
108 off_t OnSysSeek(off_t pos, wxSeekMode mode);
109 off_t OnSysTell() const;
110
111 protected:
112 wxFFile *m_file;
113 bool m_file_destroy;
114};
115
a0250ba3 116class WXDLLEXPORT wxFFileOutputStream: public wxOutputStream {
65045edd
RR
117 public:
118 wxFFileOutputStream(const wxString& fileName);
119 wxFFileOutputStream(wxFFile& file);
120 wxFFileOutputStream(FILE *file);
121 virtual ~wxFFileOutputStream();
122
123 // To solve an ambiguity on GCC
124// inline wxOutputStream& Write(const void *buffer, size_t size)
125// { return wxOutputStream::Write(buffer, size); }
126
127 void Sync();
128 size_t GetSize() const;
129
130 bool Ok() const { return m_file->IsOpened(); }
131
132 protected:
133 wxFFileOutputStream();
134
135 size_t OnSysWrite(const void *buffer, size_t size);
136 off_t OnSysSeek(off_t pos, wxSeekMode mode);
137 off_t OnSysTell() const;
138
139 protected:
140 wxFFile *m_file;
141 bool m_file_destroy;
142};
143
a0250ba3 144class WXDLLEXPORT wxFFileStream: public wxFFileInputStream, public wxFFileOutputStream {
65045edd
RR
145 public:
146 wxFFileStream(const wxString& fileName);
147};
32fc4afb 148#endif
ce4169a4
RR
149 // wxUSE_STREAMS && wxUSE_FILE
150
151#endif
cc985fac
PA
152 // _WX_WXFSTREAM_H__
153
a0250ba3
RD
154
155
156
157
158
159
160