Default implementation of IFile interface.
More...
#include <FileSystemCommon.hpp>
|
| CommonFile (const char *path, const char *mode) |
|
virtual | ~CommonFile () |
|
bool | isOpen () |
|
bool | isEOF () |
|
int | get () |
|
int | unget (int c) |
|
int | gets (char *s, int size) |
|
void | print (const char *format,...) |
|
size_t | fread (void *ptr, size_t size, size_t nmemb) |
|
size_t | fwrite (const void *ptr, size_t size, size_t nmemb) |
|
void | flush () |
|
u_int64_t | getSize () |
|
const std::string & | getPath () const |
|
virtual int | seeko (u_int64_t offset, int whence)=0 |
|
virtual u_int64_t | tell ()=0 |
|
virtual | ~IFile () |
|
Default implementation of IFile interface.
This implementation uses standard C functions (stdio.h).
CommonFile |
( |
const char * |
path, |
|
|
const char * |
mode |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
[in] | path | : full path of the file |
[in] | mode | : read/write mode (same as fopen function) |
Flush the file.
Implements IFile.
size_t fread |
( |
void * |
ptr, |
|
|
size_t |
size, |
|
|
size_t |
nmemb |
|
) |
| |
|
inlinevirtual |
Reads a buffer from the file.
- Parameters
-
[in] | ptr | : the buffer to be read |
[in] | size | : size of the buffer |
[in] | nmemb | : number of elements to be written |
- Returns
- number of items successfully written
Implements IFile.
size_t fwrite |
( |
const void * |
ptr, |
|
|
size_t |
size, |
|
|
size_t |
nmemb |
|
) |
| |
|
inlinevirtual |
Writes a buffer into the file.
- Parameters
-
[in] | ptr | : the buffer to be written |
[in] | size | : size of the buffer |
[in] | nmemb | : number of elements to be written |
- Returns
- number of items successfully written
Implements IFile.
Get the currently pointed character in the file.
- Returns
- the current character.
Implements IFile.
const std::string& getPath |
( |
| ) |
const |
|
inlinevirtual |
Get the file URI
- Returns
- the URI of the file
Implements IFile.
int gets |
( |
char * |
s, |
|
|
int |
size |
|
) |
| |
|
inlinevirtual |
Reads a line in the file.
- Parameters
-
[in] | s | : buffer where to put the read line. |
[in] | size | : maximum number of characters to be read |
- Returns
- the actual size of the read buffer (0 if nothing read)
Implements IFile.
Get the size of a file.
- Returns
- the size of the file.
Implements IFile.
Tells whether or not we are at the end of a file.
- Returns
- true if we are at the end of the file, false otherwise.
Implements IFile.
Tells whether the file is opened or not.
- Returns
- open status.
Implements IFile.
void print |
( |
const char * |
format, |
|
|
|
... |
|
) |
| |
|
inlinevirtual |
Writes a buffer (0 terminated) into the file with a new line.
- Parameters
-
[in] | format | : format of the data to be dumped into the file. |
[in] | ... | : arguments (as an ellipsis) to b dumped |
Implements IFile.
Unget the currently pointed character in the file.
- Parameters
-
[in] | c | : the current character. |
- Returns
- c on success, EOF on error
Implements IFile.
The documentation for this class was generated from the following file: