]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/fstream.h
some common code moved from wxWindow/wxFrame into files in common subdir
[wxWidgets.git] / include / wx / fstream.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: fstream.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#ifndef __WXFSTREAM_H__
12#define __WXFSTREAM_H__
13
14#include <wx/object.h>
15#include <wx/string.h>
16#include <wx/stream.h>
17#include <wx/file.h>
18
19class wxFileInputStream: virtual public wxFile, public wxInputStream {
20 public:
21 wxFileInputStream(const wxString& fileName);
22 virtual ~wxFileInputStream();
23
24 wxInputStream& Read(void *buffer, size_t size);
25 off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart);
26 off_t TellI() const;
27
28 bool Eof() const { return m_eof; }
29 size_t LastRead() const { return m_lastread; }
30
31 bool Ok() const { return wxFile::IsOpened(); }
32
33 protected:
34 wxFileInputStream() {}
35
36 protected:
37 bool m_eof;
38 bool m_ok_i;
39 size_t m_lastread;
40};
41
42class wxFileOutputStream: virtual wxFile, public wxOutputStream {
43 public:
44 wxFileOutputStream(const wxString& fileName);
45 virtual ~wxFileOutputStream();
46
47 wxOutputStream& Write(const void *buffer, size_t size);
48 off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart);
49 off_t TellO() const;
50
51 bool Bad() const { return m_bad; }
52 size_t LastWrite() const { return m_lastwrite; }
53
54 void Sync();
55
56 bool IsOpened() const { return wxFile::IsOpened(); }
57
58 protected:
59 wxFileOutputStream() {}
60
61 protected:
62 bool m_bad;
63 size_t m_lastwrite;
64};
65
66class wxFileStream: public wxFileInputStream, public wxFileOutputStream {
67 public:
68 wxFileStream(const wxString& fileName);
69 virtual ~wxFileStream();
70};
71
72#endif