载入中...
搜索中...
未找到
eve::filesystem::File类 参考abstract

A File interface, providing generic means of reading from and writing to files. 更多...

#include <File.h>

类 eve::filesystem::File 继承关系图:
eve::filesystem::cppfs::File eve::filesystem::physfs::File

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 FileDataread (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.h14 行定义.

构造及析构函数说明

◆ ~File()

eve::filesystem::File::~File ( )
virtual

Destructor.

eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 重载.

在文件 File.cpp7 行定义.

成员函数说明

◆ close()

virtual bool eve::filesystem::File::close ( )
pure virtual

Closes the file.

返回
True if successful, false otherwise.

eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.

被这些函数引用 read().

◆ flush()

virtual bool eve::filesystem::File::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()

virtual std::string eve::filesystem::File::getBuffer ( int64_t &  size) const
pure virtual
参数
[out]sizeThe size in bytes of the buffer.
返回
The current buffer mode.

eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.

◆ getExtension()

std::string eve::filesystem::File::getExtension ( ) const
virtual

Gets the file extension for this File, or empty string if none.

返回
The file extension for this File (without the dot).

在文件 File.cpp46 行定义.

引用了 getFilename() , 以及 idx.

◆ getFilename()

virtual std::string eve::filesystem::File::getFilename ( ) const
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()

virtual std::string eve::filesystem::File::getMode ( ) const
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()

virtual int64_t eve::filesystem::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()

virtual bool eve::filesystem::File::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()

virtual bool eve::filesystem::File::isOpen ( ) const
pure virtual

Gets whether the file is open.

eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.

被这些函数引用 read().

◆ open()

virtual bool eve::filesystem::File::open ( std::string  mode)
pure virtual

Opens the file in a certain mode.

参数
moderead(r), write(w), append(a).
返回
True if successful, false otherwise.

eve::filesystem::physfs::File , 以及 eve::filesystem::cppfs::File 内被实现.

被这些函数引用 read().

◆ read() [1/2]

FileData * eve::filesystem::File::read ( int64_t  size = ALL)
virtual

Reads data from the file and allocates a Data object.

参数
sizeThe number of bytes to attempt reading, or -1 for EOF.
返回
A newly allocated Data object.

在文件 File.cpp9 行定义.

引用了 ALL, close(), eve::filesystem::FileData::getData(), getFilename(), getSize(), isOpen(), open(), read() , 以及 tell().

被这些函数引用 read().

◆ read() [2/2]

virtual int64_t eve::filesystem::File::read ( void *  dst,
int64_t  size 
)
pure virtual

Reads data into the destination buffer.

参数
dstThe destination buffer.
sizeThe number of bytes to attempt reading.
返回
The number of bytes actually read.

eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.

◆ seek()

virtual bool eve::filesystem::File::seek ( uint64_t  pos)
pure virtual

Seeks to a certain position in the File.

参数
posThe byte position in the file.
返回
True on success, false otherwise.

eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.

◆ setBuffer()

virtual bool eve::filesystem::File::setBuffer ( std::string  bufmode,
int64_t  size 
)
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.

参数
bufmodeThe buffer mode.
sizeThe size in bytes of the buffer.

eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.

◆ tell()

virtual int64_t eve::filesystem::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]

bool eve::filesystem::File::write ( const Data data,
int64_t  size = ALL 
)
virtual

Writes a Data object into the File.

参数
dataThe data object to write into the file.
sizeThe number of bytes to attempt writing, or -1 for everything.
返回
True of success, false otherwise.

在文件 File.cpp42 行定义.

引用了 ALL, data , 以及 write().

◆ write() [2/2]

virtual bool eve::filesystem::File::write ( const void *  data,
int64_t  size 
)
pure virtual

Writes data into the File.

参数
dataThe source buffer.
sizeThe size of the buffer.
返回
True of success, false otherwise.

eve::filesystem::cppfs::File , 以及 eve::filesystem::physfs::File 内被实现.

被这些函数引用 write().

类成员变量说明

◆ ALL

const int64_t eve::filesystem::File::ALL = -1
static

Used to indicate ALL data in a file.

在文件 File.h19 行定义.

被这些函数引用 read(), eve::filesystem::physfs::File::read() , 以及 write().


该类的文档由以下文件生成: