]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/wfstream.h
always let the multiline text control process the Enter key presses
[wxWidgets.git] / include / wx / wfstream.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wfstream.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/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_WXFSTREAM_H__
13#define _WX_WXFSTREAM_H__
14
15#ifdef __GNUG__
16#pragma interface "wfstream.h"
17#endif
18
19#include "wx/defs.h"
20
21#if wxUSE_STREAMS && wxUSE_FILE
22
23#include "wx/object.h"
24#include "wx/string.h"
25#include "wx/stream.h"
26#include "wx/file.h"
27#include "wx/ffile.h"
28
29// ----------------------------------------------------------------------------
30// wxFileStream using wxFile
31// ----------------------------------------------------------------------------
32
33class WXDLLEXPORT wxFileInputStream: public wxInputStream {
34 public:
35 wxFileInputStream(const wxString& ifileName);
36 wxFileInputStream(wxFile& file);
37 wxFileInputStream(int fd);
38 ~wxFileInputStream();
39
40 size_t GetSize() const;
41
42 bool Ok() const { return m_file->IsOpened(); }
43
44 protected:
45 wxFileInputStream();
46
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;
54};
55
56class WXDLLEXPORT wxFileOutputStream: public wxOutputStream {
57 public:
58 wxFileOutputStream(const wxString& fileName);
59 wxFileOutputStream(wxFile& file);
60 wxFileOutputStream(int fd);
61 virtual ~wxFileOutputStream();
62
63 // To solve an ambiguity on GCC
64// inline wxOutputStream& Write(const void *buffer, size_t size)
65// { return wxOutputStream::Write(buffer, size); }
66
67 void Sync();
68 size_t GetSize() const;
69
70 bool Ok() const { return m_file->IsOpened(); }
71
72 protected:
73 wxFileOutputStream();
74
75 size_t OnSysWrite(const void *buffer, size_t size);
76 off_t OnSysSeek(off_t pos, wxSeekMode mode);
77 off_t OnSysTell() const;
78
79 protected:
80 wxFile *m_file;
81 bool m_file_destroy;
82};
83
84class WXDLLEXPORT wxFileStream: public wxFileInputStream, public wxFileOutputStream {
85 public:
86 wxFileStream(const wxString& fileName);
87};
88
89// ----------------------------------------------------------------------------
90// wxFFileStream using wxFFile
91// ----------------------------------------------------------------------------
92
93class WXDLLEXPORT wxFFileInputStream: public wxInputStream {
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
116class WXDLLEXPORT wxFFileOutputStream: public wxOutputStream {
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
144class WXDLLEXPORT wxFFileStream: public wxFFileInputStream, public wxFFileOutputStream {
145 public:
146 wxFFileStream(const wxString& fileName);
147};
148#endif
149 // wxUSE_STREAMS && wxUSE_FILE
150
151#endif
152 // _WX_WXFSTREAM_H__
153
154
155
156
157
158
159
160