]> git.saurik.com Git - wxWidgets.git/blame - include/wx/fstream.h
constraints for notebook pages work (again)
[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
14#include <stdio.h>
15#include <wx/object.h>
16#include <wx/string.h>
17#include <wx/stream.h>
18
19class wxFileStreamBase: public wxStream {
20 DECLARE_CLASS(wxFileStreamBase)
21 public:
22 wxFileStreamBase(const wxString& fileName, int iolimit);
23 virtual ~wxFileStreamBase();
24
25 wxInputStream& Read(void *buffer, size_t size);
26 size_t SeekI(int pos, wxWhenceType whence = wxBeginPosition);
27 size_t TellI() const;
28
29 bool Eof() const { return m_eof; }
30 size_t LastRead() const { return m_lastread; }
31
32 wxOutputStream& Write(const void *buffer, size_t size);
33 size_t SeekO(int pos, wxWhenceType whence = wxBeginPosition);
34 size_t TellO() const;
35
36 bool Bad() const { return m_bad; }
37 size_t LastWrite() const { return m_lastwrite; }
38
39 void Sync();
40
41 protected:
42 size_t m_lastread, m_lastwrite;
43 bool m_eof, m_bad;
44 FILE *m_file;
45};
46
47class wxFileInputStream: public wxFileStreamBase {
48 DECLARE_CLASS(wxFileInputStream)
49 public:
50 wxFileInputStream(const wxString& fileName) : wxFileStreamBase(fileName, 1) {}
51 virtual ~wxFileInputStream() {}
52};
53
54class wxFileOutputStream: public wxFileStreamBase {
55 DECLARE_CLASS(wxFileOutputStream)
56 public:
57 wxFileOutputStream(const wxString& fileName) : wxFileStreamBase(fileName, 2) {}
58 virtual ~wxFileOutputStream() {}
59};
60
61class wxFileStream: public wxFileStreamBase {
62 DECLARE_CLASS(wxFileStream)
63 public:
64 wxFileStream(const wxString& fileName) : wxFileStreamBase(fileName, 0) {}
65 virtual ~wxFileStream() {}
66};
67
68#endif