载入中...
搜索中...
未找到
File.h
浏览该文件的文档.
1#pragma once
2
3#include <cstdio>
4
5#include "filesystem/File.h"
6
7namespace eve {
8namespace filesystem {
9
10namespace cppfs {
11
17public:
18 File(std::string filename);
19 virtual ~File();
20
21 // Implements eve::filesystem::File.
24 bool open(std::string newmode) override;
25 bool close() override;
26 bool isOpen() const override;
27 int64_t getSize() override;
28 int64_t read(void *dst, int64_t size) override;
29 bool write(const void *data, int64_t size) override;
30 bool flush() override;
31 bool isEOF() override;
32 int64_t tell() override;
33 bool seek(uint64_t pos) override;
34 bool setBuffer(std::string bufmode, int64_t size) override;
35 std::string getBuffer(int64_t &size) const override;
36 std::string getMode() const override;
37 std::string getFilename() const override;
38
39private:
40 std::string filename;
41 FILE * file;
42
43 std::string mode;
44 std::string bufferMode;
45 int64_t bufferSize;
46};
47} // namespace cppfs
48} // namespace filesystem
49} // namespace eve
Light2D::Data * data
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 which is created when a user drags and drops an actual file onto the eve game....
Definition File.h:16
int64_t read(void *dst, int64_t size) override
Reads data into the destination buffer.
Definition File.cpp:100
bool write(const void *data, int64_t size) override
Writes data into the File.
Definition File.cpp:110
int64_t getSize() override
Gets the size of the file.
Definition File.cpp:67
bool seek(uint64_t pos) override
Seeks to a certain position in the File.
Definition File.cpp:138
bool setBuffer(std::string bufmode, int64_t size) override
Sets the buffering mode for the file. When buffering is enabled,
Definition File.cpp:148
virtual ~File()
Destructor.
Definition File.cpp:22
bool open(std::string newmode) override
Opens the file in a certain mode.
Definition File.cpp:26
bool isOpen() const override
Gets whether the file is open.
Definition File.cpp:65
bool close() override
Closes the file.
Definition File.cpp:56
int64_t tell() override
Gets the current position in the File.
Definition File.cpp:128
bool flush() override
Flushes the currently buffered file data to disk. Only applicable in write mode.
Definition File.cpp:120
bool isEOF() override
Checks whether we are currently at end-of-file.
Definition File.cpp:126
std::string getMode() const override
Gets the current mode of the File.
Definition File.cpp:180
std::string getFilename() const override
Gets the filename for this File, or empty string if none.
Definition File.cpp:179
std::string getBuffer(int64_t &size) const override
Definition File.cpp:174
Definition Build.cpp:11