Cafu Engine
cf::FileSys::MemoryInFileT Class Reference
Inheritance diagram for cf::FileSys::MemoryInFileT:

Public Member Functions

 MemoryInFileT (const std::string &FileName_)
 Constructor. More...
 
ArrayT< char > & GetBuffer ()
 Returns a reference to the buffer that keeps the contents of this file. More...
 
const ArrayT< char > & GetBuffer () const
 Returns a const reference to the buffer that keeps the contents of this file. More...
 
bool IsOpen () const
 Returns whether the file has successfully been opened and is still open. More...
 
const std::string & GetBaseName () const
 Returns the base name of this file. The base name is relative to and agnostic of the file system this file is in. More...
 
const std::string & GetFullName () const
 Returns the full name of this file. More...
 
uint64_t GetPos () const
 Returns the current read/write position in the file. More...
 
bool Seek (int32_t Offset, SeekFromT SeekFrom)
 Modifies the position of the read/write pointer in the file. More...
 
uint32_t Read (char *Buffer, uint32_t Size)
 Reads Size bytes into the Buffer. More...
 
uint64_t GetSize () const
 Returns the size of the file. More...
 
- Public Member Functions inherited from cf::FileSys::FileI
virtual ~FileI ()
 The virtual destructor, so that derived classes can safely be deleted via a FileI (base class) pointer. More...
 

Additional Inherited Members

- Public Types inherited from cf::FileSys::FileI
enum  SeekFromT { FROM_BEGINNING, FROM_CURRENT_POS, FROM_END }
 The values of this enumeration define from where the seek operation applies the offset. More...
 

Constructor & Destructor Documentation

MemoryInFileT::MemoryInFileT ( const std::string &  FileName_)

Constructor.

Creates an empty memory file for reading. Note that because the file is empty, the code that created the file should use the GetBuffer() method to set the initial contents.

Member Function Documentation

const std::string & MemoryInFileT::GetBaseName ( ) const
virtual

Returns the base name of this file. The base name is relative to and agnostic of the file system this file is in.

Implements cf::FileSys::FileI.

ArrayT<char>& cf::FileSys::MemoryInFileT::GetBuffer ( )
inline

Returns a reference to the buffer that keeps the contents of this file.

const ArrayT<char>& cf::FileSys::MemoryInFileT::GetBuffer ( ) const
inline

Returns a const reference to the buffer that keeps the contents of this file.

const std::string & MemoryInFileT::GetFullName ( ) const
virtual

Returns the full name of this file.

The full name is the base name prepended by the file system specific path/URL. TODO: Have a GetFileSys() method instead???

Implements cf::FileSys::FileI.

uint64_t MemoryInFileT::GetPos ( ) const
virtual

Returns the current read/write position in the file.

Implements cf::FileSys::FileI.

uint64_t MemoryInFileT::GetSize ( ) const
virtual

Returns the size of the file.

Implements cf::FileSys::InFileI.

bool MemoryInFileT::IsOpen ( ) const
virtual

Returns whether the file has successfully been opened and is still open.

Implements cf::FileSys::FileI.

uint32_t MemoryInFileT::Read ( char *  Buffer,
uint32_t  Size 
)
virtual

Reads Size bytes into the Buffer.

Returns
How many bytes have actually been read.

Implements cf::FileSys::InFileI.

bool MemoryInFileT::Seek ( int32_t  Offset,
SeekFromT  SeekFrom 
)
virtual

Modifies the position of the read/write pointer in the file.

Parameters
OffsetHow much to move the pointer.
SeekFromDefines from where the offset is applied, see SeekFromT for possible values.
Returns
true if the seek operation was successful, false otherwise.

Implements cf::FileSys::FileI.


The documentation for this class was generated from the following files: