diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-08 19:24:12 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-08 19:24:12 +0000 |
commit | d3477eedc113a2c126f36f41384b8921d610906a (patch) | |
tree | 68df921c4acf03878ae244db8350e2e96936c494 /src/filesystem/file.h | |
parent | 598dba9d17838e92f89bcd3ec78c69cc4ce50044 (diff) |
updated filesystem, removed inifile, updated game and tga loader
minor cleanups
Diffstat (limited to 'src/filesystem/file.h')
-rw-r--r-- | src/filesystem/file.h | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/src/filesystem/file.h b/src/filesystem/file.h index ba392de..37ac8b4 100644 --- a/src/filesystem/file.h +++ b/src/filesystem/file.h @@ -9,34 +9,41 @@ // C++ headers #include <string> -#include <fstream> namespace filesystem { -/// a class to open data files -class File : public std::ifstream { +/** + * @brief an abstract interface to handle file access + */ +class File +{ public: File(); virtual ~File(); - /// open the file for reading - virtual void open(const char * filename, std::ios_base::openmode mode = std::ios_base::in); + /// open file for reading + virtual bool open(const char * filename) = 0; - /// current filename - inline std::string name() { - return file_name; - } - - /// current full path - inline std::string path() { - return real_name; - } + /// close file + virtual void close() = 0; -private: + /// read bytes + virtual size_t read(void *buffer, size_t count) = 0; + + /// skip bytes + virtual void skip(size_t count) = 0; + + /// name of the file in the virtual filesystem + inline const std::string name() const { return file_name; } + + /// the path holding the virtual filename + inline const std::string path() const { return file_path; } + +protected: std::string file_name; - std::string real_name; -} -; // class File + + std::string file_path; +}; } // namespace filesystem |