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