]> git.saurik.com Git - wxWidgets.git/blame - include/wx/fstream.h
wxDocManager gets the only view if none other specified as the current view;
[wxWidgets.git] / include / wx / fstream.h
CommitLineData
32fc4afb
GL
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
32fc4afb
GL
14#include <wx/object.h>
15#include <wx/string.h>
16#include <wx/stream.h>
79c3e0e1 17#include <wx/file.h>
32fc4afb 18
79c3e0e1 19class wxFileInputStream: virtual public wxFile, public wxInputStream {
32fc4afb 20 public:
79c3e0e1
GL
21 wxFileInputStream(const wxString& fileName);
22 virtual ~wxFileInputStream();
32fc4afb
GL
23
24 wxInputStream& Read(void *buffer, size_t size);
79c3e0e1
GL
25 off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart);
26 off_t TellI() const;
32fc4afb
GL
27
28 bool Eof() const { return m_eof; }
29 size_t LastRead() const { return m_lastread; }
30
79c3e0e1
GL
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 {
79c3e0e1
GL
43 public:
44 wxFileOutputStream(const wxString& fileName);
45 virtual ~wxFileOutputStream();
46
32fc4afb 47 wxOutputStream& Write(const void *buffer, size_t size);
79c3e0e1
GL
48 off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart);
49 off_t TellO() const;
32fc4afb
GL
50
51 bool Bad() const { return m_bad; }
52 size_t LastWrite() const { return m_lastwrite; }
53
54 void Sync();
55
79c3e0e1 56 bool IsOpened() const { return wxFile::IsOpened(); }
32fc4afb 57
79c3e0e1
GL
58 protected:
59 wxFileOutputStream() {}
32fc4afb 60
79c3e0e1
GL
61 protected:
62 bool m_bad;
63 size_t m_lastwrite;
32fc4afb
GL
64};
65
79c3e0e1 66class wxFileStream: public wxFileInputStream, public wxFileOutputStream {
32fc4afb 67 public:
79c3e0e1
GL
68 wxFileStream(const wxString& fileName);
69 virtual ~wxFileStream();
32fc4afb
GL
70};
71
72#endif