]> git.saurik.com Git - wxWidgets.git/blame - src/common/fstream.cpp
some "const"s added
[wxWidgets.git] / src / common / fstream.cpp
CommitLineData
3d4c6a21
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: fstream.cpp
3// Purpose: "File stream" classes
4// Author: Julian Smart
5// Modified by:
6// Created: 11/07/98
7// RCS-ID: $Id$
8// Copyright: (c) Guilhem Lavaux
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "fstream.h"
14#endif
15
79c3e0e1
GL
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
3d4c6a21
GL
18#include <stdio.h>
19#include <wx/stream.h>
20#include <wx/fstream.h>
21
79c3e0e1
GL
22#ifdef __BORLANDC__
23#pragma hdrstop
24#endif
25
3d4c6a21
GL
26#define BUF_TEMP_SIZE 10000
27
79c3e0e1
GL
28// ----------------------------------------------------------------------------
29// wxFileInputStream
30// ----------------------------------------------------------------------------
31
32wxFileInputStream::wxFileInputStream(const wxString& fileName)
33 : wxFile(fileName, read)
3d4c6a21 34{
79c3e0e1 35 m_lastread = 0;
3d4c6a21
GL
36}
37
79c3e0e1 38wxFileInputStream::~wxFileInputStream()
3d4c6a21 39{
3d4c6a21
GL
40}
41
79c3e0e1 42wxInputStream& wxFileInputStream::Read(void *buffer, size_t size)
3d4c6a21 43{
79c3e0e1 44 m_lastread = wxFile::Read(buffer, size);
3d4c6a21
GL
45 return *this;
46}
47
79c3e0e1 48off_t wxFileInputStream::SeekI(off_t pos, wxSeekMode mode)
3d4c6a21 49{
79c3e0e1
GL
50 return wxFile::Seek(pos, mode);
51}
52
53off_t wxFileInputStream::TellI() const
54{
55 return wxFile::Tell();
56}
57
58// ----------------------------------------------------------------------------
59// wxFileOutputStream
60// ----------------------------------------------------------------------------
61
62wxFileOutputStream::wxFileOutputStream(const wxString& fileName)
63 : wxFile(fileName, write)
64{
65 m_lastwrite = 0;
3d4c6a21
GL
66}
67
79c3e0e1 68wxFileOutputStream::~wxFileOutputStream()
3d4c6a21 69{
79c3e0e1 70}
3d4c6a21 71
79c3e0e1
GL
72wxOutputStream& wxFileOutputStream::Write(const void *buffer, size_t size)
73{
74 m_lastwrite = wxFile::Write(buffer, size);
75 m_bad = wxFile::Error();
76 return *this;
77}
3d4c6a21 78
79c3e0e1
GL
79off_t wxFileOutputStream::TellO() const
80{
81 return wxFile::Tell();
3d4c6a21
GL
82}
83
79c3e0e1 84off_t wxFileOutputStream::SeekO(off_t pos, wxSeekMode mode)
3d4c6a21 85{
79c3e0e1 86 return wxFile::Seek(pos, mode);
3d4c6a21
GL
87}
88
79c3e0e1 89void wxFileOutputStream::Sync()
3d4c6a21 90{
79c3e0e1 91 wxFile::Flush();
3d4c6a21
GL
92}
93
79c3e0e1
GL
94// ----------------------------------------------------------------------------
95// wxFileStream
96// ----------------------------------------------------------------------------
97
98wxFileStream::wxFileStream(const wxString& fileName)
99 : wxFile(fileName, read_write)
3d4c6a21 100{
3d4c6a21
GL
101}
102
79c3e0e1 103wxFileStream::~wxFileStream()
3d4c6a21 104{
3d4c6a21 105}