ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

file.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef COMMON_FILE_H
00024 #define COMMON_FILE_H
00025 
00026 #include "common/scummsys.h"
00027 #include "common/fs.h"
00028 #include "common/noncopyable.h"
00029 #include "common/str.h"
00030 #include "common/stream.h"
00031 
00032 namespace Common {
00033 
00034 class Archive;
00035 
00039 class File : public SeekableReadStream, public NonCopyable {
00040 protected:
00042     SeekableReadStream *_handle;
00043 
00045     String _name;
00046 
00047 public:
00048     File();
00049     virtual ~File();
00050 
00058     static bool exists(const String &filename);
00059 
00067     virtual bool open(const String &filename);
00068 
00077     virtual bool open(const String &filename, Archive &archive);
00078 
00088     virtual bool open(const FSNode &node);
00089 
00099     virtual bool open(SeekableReadStream *stream, const String &name);
00100 
00104     virtual void close();
00105 
00111     bool isOpen() const;
00112 
00118     const char *getName() const { return _name.c_str(); }
00119 
00120     bool err() const;   // implement abstract Stream method
00121     void clearErr();    // implement abstract Stream method
00122     bool eos() const;   // implement abstract SeekableReadStream method
00123 
00124     int32 pos() const;  // implement abstract SeekableReadStream method
00125     int32 size() const; // implement abstract SeekableReadStream method
00126     bool seek(int32 offs, int whence = SEEK_SET);   // implement abstract SeekableReadStream method
00127     uint32 read(void *dataPtr, uint32 dataSize);    // implement abstract SeekableReadStream method
00128 };
00129 
00130 
00137 class DumpFile : public SeekableWriteStream, public NonCopyable {
00138 protected:
00140     WriteStream *_handle;
00141 
00142 public:
00143     DumpFile();
00144     virtual ~DumpFile();
00145 
00146     virtual bool open(const String &filename, bool createPath = false);
00147     virtual bool open(const FSNode &node);
00148 
00149     virtual void close();
00150 
00156     bool isOpen() const;
00157 
00158     bool err() const;
00159     void clearErr();
00160 
00161     virtual uint32 write(const void *dataPtr, uint32 dataSize) override;
00162 
00163     virtual bool flush() override;
00164 
00165     virtual int32 pos() const override;
00166 
00167     virtual bool seek(int32 offset, int whence = SEEK_SET) override;
00168     virtual int32 size() const override;
00169 };
00170 
00171 } // End of namespace Common
00172 
00173 #endif


Generated on Sat Oct 12 2019 05:00:44 for ResidualVM by doxygen 1.7.1
curved edge   curved edge