]> git.saurik.com Git - wxWidgets.git/blame - include/wx/wfstream.h
Implemented wxToggleButton under Motif.
[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
af49c4b8 15#if defined(__GNUG__) && !defined(__APPLE__)
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;
22f3361e
VZ
54
55 DECLARE_NO_COPY_CLASS(wxFileInputStream)
79c3e0e1
GL
56};
57
a0250ba3 58class WXDLLEXPORT wxFileOutputStream: public wxOutputStream {
79c3e0e1
GL
59 public:
60 wxFileOutputStream(const wxString& fileName);
75ed1d15
GL
61 wxFileOutputStream(wxFile& file);
62 wxFileOutputStream(int fd);
79c3e0e1
GL
63 virtual ~wxFileOutputStream();
64
1678ad78 65 // To solve an ambiguity on GCC
a737331d
GL
66// inline wxOutputStream& Write(const void *buffer, size_t size)
67// { return wxOutputStream::Write(buffer, size); }
32fc4afb
GL
68
69 void Sync();
cd25b18c 70 size_t GetSize() const;
32fc4afb 71
25c70b07 72 bool Ok() const { return m_file->IsOpened(); }
32fc4afb 73
79c3e0e1 74 protected:
25c70b07 75 wxFileOutputStream();
32fc4afb 76
75ed1d15
GL
77 size_t OnSysWrite(const void *buffer, size_t size);
78 off_t OnSysSeek(off_t pos, wxSeekMode mode);
79 off_t OnSysTell() const;
32fc4afb 80
75ed1d15
GL
81 protected:
82 wxFile *m_file;
83 bool m_file_destroy;
22f3361e
VZ
84
85 DECLARE_NO_COPY_CLASS(wxFileOutputStream)
32fc4afb
GL
86};
87
a0250ba3 88class WXDLLEXPORT wxFileStream: public wxFileInputStream, public wxFileOutputStream {
84b46c35
GL
89 public:
90 wxFileStream(const wxString& fileName);
91};
92
65045edd
RR
93// ----------------------------------------------------------------------------
94// wxFFileStream using wxFFile
95// ----------------------------------------------------------------------------
96
a0250ba3 97class WXDLLEXPORT wxFFileInputStream: public wxInputStream {
65045edd
RR
98 public:
99 wxFFileInputStream(const wxString& ifileName);
100 wxFFileInputStream(wxFFile& file);
101 wxFFileInputStream(FILE *file);
102 ~wxFFileInputStream();
103
104 size_t GetSize() const;
105
106 bool Ok() const { return m_file->IsOpened(); }
107
108 protected:
109 wxFFileInputStream();
110
111 size_t OnSysRead(void *buffer, size_t size);
112 off_t OnSysSeek(off_t pos, wxSeekMode mode);
113 off_t OnSysTell() const;
114
115 protected:
116 wxFFile *m_file;
117 bool m_file_destroy;
22f3361e
VZ
118
119 DECLARE_NO_COPY_CLASS(wxFFileInputStream)
65045edd
RR
120};
121
a0250ba3 122class WXDLLEXPORT wxFFileOutputStream: public wxOutputStream {
65045edd
RR
123 public:
124 wxFFileOutputStream(const wxString& fileName);
125 wxFFileOutputStream(wxFFile& file);
126 wxFFileOutputStream(FILE *file);
127 virtual ~wxFFileOutputStream();
128
129 // To solve an ambiguity on GCC
130// inline wxOutputStream& Write(const void *buffer, size_t size)
131// { return wxOutputStream::Write(buffer, size); }
132
133 void Sync();
134 size_t GetSize() const;
135
136 bool Ok() const { return m_file->IsOpened(); }
137
138 protected:
139 wxFFileOutputStream();
140
141 size_t OnSysWrite(const void *buffer, size_t size);
142 off_t OnSysSeek(off_t pos, wxSeekMode mode);
143 off_t OnSysTell() const;
144
145 protected:
146 wxFFile *m_file;
147 bool m_file_destroy;
22f3361e
VZ
148
149 DECLARE_NO_COPY_CLASS(wxFFileOutputStream)
65045edd
RR
150};
151
a0250ba3 152class WXDLLEXPORT wxFFileStream: public wxFFileInputStream, public wxFFileOutputStream {
65045edd
RR
153 public:
154 wxFFileStream(const wxString& fileName);
155};
32fc4afb 156#endif
ce4169a4
RR
157 // wxUSE_STREAMS && wxUSE_FILE
158
159#endif
cc985fac
PA
160 // _WX_WXFSTREAM_H__
161
a0250ba3
RD
162
163
164
165
166
167
168