A File interface, providing generic means of reading from and writing to files. 更多...
#include <File.h>
Public 成员函数 | |
| virtual | ~File () |
| Destructor. | |
| virtual bool | open (std::string mode)=0 |
| Opens the file in a certain mode. | |
| virtual bool | close ()=0 |
| Closes the file. | |
| virtual bool | isOpen () const =0 |
| Gets whether the file is open. | |
| virtual int64_t | getSize ()=0 |
| Gets the size of the file. | |
| virtual FileData * | read (int64_t size=ALL) |
| Reads data from the file and allocates a Data object. | |
| virtual int64_t | read (void *dst, int64_t size)=0 |
| Reads data into the destination buffer. | |
| virtual bool | write (const void *data, int64_t size)=0 |
| Writes data into the File. | |
| virtual bool | write (const Data *data, int64_t size=ALL) |
| Writes a Data object into the File. | |
| virtual bool | flush ()=0 |
| Flushes the currently buffered file data to disk. Only applicable in write mode. | |
| virtual bool | isEOF ()=0 |
| Checks whether we are currently at end-of-file. | |
| virtual int64_t | tell ()=0 |
| Gets the current position in the File. | |
| virtual bool | seek (uint64_t pos)=0 |
| Seeks to a certain position in the File. | |
| virtual bool | setBuffer (std::string bufmode, int64_t size)=0 |
| Sets the buffering mode for the file. When buffering is enabled, | |
| virtual std::string | getBuffer (int64_t &size) const =0 |
| virtual std::string | getMode () const =0 |
| Gets the current mode of the File. | |
| virtual std::string | getFilename () const =0 |
| Gets the filename for this File, or empty string if none. | |
| virtual std::string | getExtension () const |
| Gets the file extension for this File, or empty string if none. | |
静态 Public 属性 | |
| static const int64_t | ALL = -1 |
| Used to indicate ALL data in a file. | |
详细描述
A File interface, providing generic means of reading from and writing to files.
构造及析构函数说明
◆ ~File()
|
virtual |
Destructor.
被 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 重载.
成员函数说明
◆ close()
|
pure virtual |
Closes the file.
- 返回
- True if successful, false otherwise.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
被这些函数引用 read().
◆ flush()
|
pure virtual |
Flushes the currently buffered file data to disk. Only applicable in write mode.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
◆ getBuffer()
|
pure virtual |
- 参数
-
[out] size The size in bytes of the buffer.
- 返回
- The current buffer mode.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
◆ getExtension()
|
virtual |
◆ getFilename()
|
pure virtual |
Gets the filename for this File, or empty string if none.
- 返回
- The filename for this File.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
被这些函数引用 getExtension() , 以及 read().
◆ getMode()
|
pure virtual |
Gets the current mode of the File.
- 返回
- The current mode of the File; CLOSED, READ, WRITE or APPEND.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
◆ getSize()
|
pure virtual |
Gets the size of the file.
- 返回
- The size of the file.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
被这些函数引用 read().
◆ isEOF()
|
pure virtual |
Checks whether we are currently at end-of-file.
- 返回
- True if EOF, false otherwise.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
◆ isOpen()
|
pure virtual |
Gets whether the file is open.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
被这些函数引用 read().
◆ open()
|
pure virtual |
Opens the file in a certain mode.
- 参数
-
mode read(r), write(w), append(a).
- 返回
- True if successful, false otherwise.
在 eve::filesystem::physfs::File , 以及 eve::filesystem::cppfs::File 内被实现.
被这些函数引用 read().
◆ read() [1/2]
◆ read() [2/2]
|
pure virtual |
Reads data into the destination buffer.
- 参数
-
dst The destination buffer. size The number of bytes to attempt reading.
- 返回
- The number of bytes actually read.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
◆ seek()
|
pure virtual |
Seeks to a certain position in the File.
- 参数
-
pos The byte position in the file.
- 返回
- True on success, false otherwise.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
◆ setBuffer()
|
pure virtual |
Sets the buffering mode for the file. When buffering is enabled,
'none' - no buffer enabled 'full' - the file will not write to disk (or will pre-load data if in read mode) until the buffer's capacity is reached. 'newline' - the file will not only write when capacity is reached, but also write to disk if a newline is written.
- 参数
-
bufmode The buffer mode. size The size in bytes of the buffer.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
◆ tell()
|
pure virtual |
Gets the current position in the File.
- 返回
- The current byte position in the File.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
被这些函数引用 read().
◆ write() [1/2]
◆ write() [2/2]
|
pure virtual |
Writes data into the File.
- 参数
-
data The source buffer. size The size of the buffer.
- 返回
- True of success, false otherwise.
在 eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.
被这些函数引用 write().
类成员变量说明
◆ ALL
|
static |
Used to indicate ALL data in a file.
被这些函数引用 read(), eve::filesystem::physfs::File::read() , 以及 write().
该类的文档由以下文件生成: