载入中...
搜索中...
未找到
File.h
浏览该文件的文档.
1#pragma once
2
3#include "common/config.h"
4#include "filesystem/File.h"
5
6// PhysFS
7#include "physfs/physfs.h"
8
9// STD
10#include <string>
11
12namespace eve {
13namespace filesystem {
14namespace physfs {
15
18public:
23 File(std::string filename);
25 virtual ~File();
26
27 // Implements eve::filesystem::File.
31 bool open(std::string mode) override;
33 bool close() override;
35 bool isOpen() const override;
37 int64_t getSize() override;
39 int64_t read(void *dst, int64_t size) override;
41 bool write(const void *data, int64_t size) override;
43 bool flush() override;
45 bool isEOF() override;
47 int64_t tell() override;
49 bool seek(uint64_t pos) override;
51 bool setBuffer(std::string bufmode, int64_t size) override;
53 std::string getBuffer(int64_t &size) const override;
55 std::string getMode() const override;
57 std::string getFilename() const override;
58
59private:
60 // filename
61 std::string filename;
62
63 // PHYSFS File handle.
64 PHYSFS_File *file;
65
66 // The current mode of the file.
67 std::string mode;
68
69 std::string bufferMode;
70 int64_t bufferSize;
71
72}; // File
73
74} // namespace physfs
75} // namespace filesystem
76} // namespace eve
float size
Definition TreeMesh.cpp:156
A File interface, providing generic means of reading from and writing to files.
Definition File.h:14
virtual FileData * read(int64_t size=ALL)
Reads data from the file and allocates a Data object.
Definition File.cpp:9
virtual bool write(const void *data, int64_t size)=0
Writes data into the File.
File public API.
Definition File.h:17
bool isEOF() override
True when eof.
Definition File.cpp:154
std::string getFilename() const override
Full filename including extension.
Definition File.cpp:196
std::string getMode() const override
Returns the mode.
Definition File.cpp:198
bool close() override
Closes close.
Definition File.cpp:78
bool open(std::string mode) override
Opens open.
Definition File.cpp:28
bool seek(uint64_t pos) override
Seeks seek.
Definition File.cpp:162
bool setBuffer(std::string bufmode, int64_t size) override
Sets the buffer.
Definition File.cpp:164
virtual ~File()
Releases File resources.
Definition File.cpp:24
bool write(const void *data, int64_t size) override
Writes write.
Definition File.cpp:119
int64_t read(void *dst, int64_t size) override
Reads read.
Definition File.cpp:102
bool flush() override
Flushes flush.
Definition File.cpp:138
int64_t getSize() override
Byte length of the owned buffer.
Definition File.cpp:89
int64_t tell() override
Returns the current tell.
Definition File.cpp:156
bool isOpen() const override
True when open.
Definition File.cpp:87
std::string getBuffer(int64_t &size) const override
Returns the buffer.
Definition File.cpp:191
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16