iFile Struct Reference
[Virtual File System (VFS)]
A replacement for FILE type in the virtual file space.
More...
#include <iutil/vfs.h>
Inheritance diagram for iFile:
![Inheritance graph](structiFile__inherit__graph.png)
Public Member Functions | |
virtual bool | AtEOF ()=0 |
Returns true if the stream is at end-of-file, else false. | |
virtual void | Flush ()=0 |
Flush stream. | |
virtual csPtr< iDataBuffer > | GetAllData (bool nullterm=false)=0 |
Request whole content of the file as a single data buffer. | |
virtual const char * | GetName ()=0 |
Query file name (in VFS). | |
virtual size_t | GetPos ()=0 |
Query current file pointer. | |
virtual size_t | GetSize ()=0 |
Query file size. | |
virtual int | GetStatus ()=0 |
Check (and clear) file last error status. | |
virtual size_t | Read (char *Data, size_t DataSize)=0 |
Read DataSize bytes and place them into the buffer at which Data points. | |
virtual bool | SetPos (size_t newpos)=0 |
Set new file pointer. | |
virtual size_t | Write (const char *Data, size_t DataSize)=0 |
Write DataSize bytes from the buffer at which Data points. |
Detailed Description
A replacement for FILE type in the virtual file space.Main creators of instances implementing this interface:
Definition at line 110 of file vfs.h.
Member Function Documentation
virtual bool iFile::AtEOF | ( | ) | [pure virtual] |
Returns true if the stream is at end-of-file, else false.
Implemented in csMemFile, and csPhysicalFile.
virtual void iFile::Flush | ( | ) | [pure virtual] |
virtual csPtr<iDataBuffer> iFile::GetAllData | ( | bool | nullterm = false |
) | [pure virtual] |
Request whole content of the file as a single data buffer.
- Parameters:
-
nullterm Set this to true if you want a null char to be appended to the buffer (e.g. for use with string functions.)
- Remarks:
- Null-termination might have a performance penalty (depending upon where the file is stored.) Use only when needed.
- Returns:
- The complete data contained in the file; or an invalidated pointer if this object does not support this function (e.g. write-only VFS files). Check for an invalidated result via csRef<>::IsValid(). Do not modify the contained data!
Implemented in csMemFile, and csPhysicalFile.
virtual const char* iFile::GetName | ( | ) | [pure virtual] |
virtual size_t iFile::GetPos | ( | ) | [pure virtual] |
virtual size_t iFile::GetSize | ( | ) | [pure virtual] |
virtual int iFile::GetStatus | ( | ) | [pure virtual] |
Check (and clear) file last error status.
- See also:
- VFS_STATUS_ACCESSDENIED
Implemented in csMemFile, and csPhysicalFile.
virtual size_t iFile::Read | ( | char * | Data, | |
size_t | DataSize | |||
) | [pure virtual] |
Read DataSize bytes and place them into the buffer at which Data points.
- Parameters:
-
Data Pointer to the buffer into which the data should be read. The buffer should be at least DataSize bytes in size. DataSize Number of bytes to read.
- Returns:
- The number of bytes actually read. If an error occurs, zero is returned. Invoke GetStatus() to retrieve the error code.
Implemented in csMemFile, and csPhysicalFile.
virtual bool iFile::SetPos | ( | size_t | newpos | ) | [pure virtual] |
Set new file pointer.
- Parameters:
-
newpos New position in file.
- Returns:
- True if the operation succeeded, else false.
Implemented in csMemFile, and csPhysicalFile.
Referenced by csFileReadHelper::Skip().
virtual size_t iFile::Write | ( | const char * | Data, | |
size_t | DataSize | |||
) | [pure virtual] |
Write DataSize bytes from the buffer at which Data points.
- Parameters:
-
Data Pointer to the data to be written. DataSize Number of bytes to write.
- Returns:
- The number of bytes actually written. If an error occurs, zero is returned. Invoke GetStatus() to retrieve the error code.
Implemented in csMemFile, and csPhysicalFile.
The documentation for this struct was generated from the following file:
- iutil/vfs.h
Generated for Crystal Space by doxygen 1.4.7