]> git.saurik.com Git - wxWidgets.git/blob - include/wx/wfstream.h
Added wxImage wxImage::GetSubImage(cont wxRect&) const
[wxWidgets.git] / include / wx / wfstream.h
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
28 class wxFileInputStream: public wxInputStream {
29 public:
30 wxFileInputStream(const wxString& ifileName);
31 wxFileInputStream(wxFile& file);
32 wxFileInputStream(int fd);
33 ~wxFileInputStream();
34
35 size_t GetSize() const;
36
37 bool Ok() const { return m_file->IsOpened(); }
38
39 protected:
40 wxFileInputStream();
41
42 size_t OnSysRead(void *buffer, size_t size);
43 off_t OnSysSeek(off_t pos, wxSeekMode mode);
44 off_t OnSysTell() const;
45
46 protected:
47 wxFile *m_file;
48 bool m_file_destroy;
49 };
50
51 class wxFileOutputStream: public wxOutputStream {
52 public:
53 wxFileOutputStream(const wxString& fileName);
54 wxFileOutputStream(wxFile& file);
55 wxFileOutputStream(int fd);
56 virtual ~wxFileOutputStream();
57
58 // To solve an ambiguity on GCC
59 // inline wxOutputStream& Write(const void *buffer, size_t size)
60 // { return wxOutputStream::Write(buffer, size); }
61
62 void Sync();
63 size_t GetSize() const;
64
65 bool Ok() const { return m_file->IsOpened(); }
66
67 protected:
68 wxFileOutputStream();
69
70 size_t OnSysWrite(const void *buffer, size_t size);
71 off_t OnSysSeek(off_t pos, wxSeekMode mode);
72 off_t OnSysTell() const;
73
74 protected:
75 wxFile *m_file;
76 bool m_file_destroy;
77 };
78
79 class wxFileStream: public wxFileInputStream, public wxFileOutputStream {
80 public:
81 wxFileStream(const wxString& fileName);
82 };
83
84 #endif
85 // wxUSE_STREAMS && wxUSE_FILE
86
87 #endif
88 // _WX_WXFSTREAM_H__
89