Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/filesystem/file.h')
-rw-r--r--src/filesystem/file.h43
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