#include <fileclasses.h>
Inheritance diagram for salt::MemFile:
Public Member Functions | |
MemFile (const char *fn=NULL, char *mode="rb") | |
MemFile (FILE *f) | |
MemFile (RFile *f) | |
~MemFile () | |
bool | Open (const char *fn=NULL, char *mode="rb") |
opens the file fn in the specified mode. | |
bool | Open (void *buffer, long s) |
void | Close () |
closes a previously opened file | |
void | Destroy () |
releases any occupied ressources used by the file. | |
int | Eof () |
returns a non zero value if the file pointer is at the end of the file | |
long | Tell () |
returns the current file pointer position | |
int | GetPos (long *pos) |
copies the current file pointer position to pos and returns true on success | |
int | Seek (long offset, int origin) |
sets the file pointer for the file. | |
void | Rewind () |
sets the file pointer to the beginning of the file | |
long | Size () |
return the size of the file | |
char * | Gets (char *buffer, int n) |
reads in at most one less than n characters from the file and stores them into buffer. | |
int | Getc () |
reads the next character from the file returns it as an int r EOF on end of file or error. | |
void * | GetHandle () |
returns a handle identifying the file. | |
size_t | Read (void *buffer, size_t size, size_t count) |
reads reads count elements of data, each size bytes long, storing them in the specified buffer | |
size_t | Read (void *buffer, size_t count) |
reads count bytes of data, storing them in the specified buffer | |
Private Attributes | |
void * | mHandle |
the file handle | |
unsigned char * | mCharHandle |
a pointer to the buffer holding the file | |
long | mSize |
the size of the file in bytes | |
long | mPosition |
the current file pointer position |
On open() a file is completely read into the buffer and from there on served from memory.
Definition at line 171 of file fileclasses.h.
|
Definition at line 47 of file fileclasses.cpp. References mCharHandle, mHandle, mPosition, mSize, and Open(). Here is the call graph for this function: ![]() |
|
Definition at line 62 of file fileclasses.cpp. References mCharHandle, mHandle, mPosition, and mSize. |
|
Definition at line 74 of file fileclasses.cpp. References mCharHandle, mHandle, mPosition, mSize, salt::RFile::Read(), and salt::RFile::Size(). Here is the call graph for this function: ![]() |
|
Definition at line 83 of file fileclasses.cpp. References Destroy(), and mHandle. Here is the call graph for this function: ![]() |
|
closes a previously opened file
Implements salt::RFile. Definition at line 123 of file fileclasses.cpp. References Destroy(). Here is the call graph for this function: ![]() |
|
releases any occupied ressources used by the file. The semantic is up to the derived classes Implements salt::RFile. Definition at line 128 of file fileclasses.cpp. References mCharHandle, mHandle, mPosition, and mSize. Referenced by Close(), and ~MemFile(). |
|
returns a non zero value if the file pointer is at the end of the file
Implements salt::RFile. Definition at line 140 of file fileclasses.cpp. References mPosition, and mSize. Referenced by Gets(). |
|
reads the next character from the file returns it as an int r EOF on end of file or error.
Implements salt::RFile. Definition at line 199 of file fileclasses.cpp. References mCharHandle, mPosition, and mSize. |
|
returns a handle identifying the file. The semantics of this handle depends on the subclass, implementing this method Implements salt::RFile. Definition at line 194 of file fileclasses.h. References mHandle. |
|
copies the current file pointer position to pos and returns true on success
Implements salt::RFile. Definition at line 150 of file fileclasses.cpp. References Tell(). Here is the call graph for this function: ![]() |
|
reads in at most one less than n characters from the file and stores them into buffer. A '' is stored after the last character in the buffer. Implements salt::RFile. Definition at line 181 of file fileclasses.cpp. References Eof(), mCharHandle, and mPosition. Here is the call graph for this function: ![]() |
|
Definition at line 114 of file fileclasses.cpp. References mCharHandle, mHandle, mPosition, and mSize. |
|
opens the file fn in the specified mode. The implementation of the namespace and mode semantics ist up to derived classes Implements salt::RFile. Definition at line 89 of file fileclasses.cpp. References salt::StdFile::GetHandle(), mCharHandle, mHandle, mPosition, mSize, salt::StdFile::Read(), and salt::StdFile::Size(). Referenced by MemFile(). Here is the call graph for this function: ![]() |
|
reads count bytes of data, storing them in the specified buffer
Implements salt::RFile. Definition at line 197 of file fileclasses.h. References Read(). Here is the call graph for this function: ![]() |
|
reads reads count elements of data, each size bytes long, storing them in the specified buffer
Implements salt::RFile. Definition at line 208 of file fileclasses.cpp. References mCharHandle, mPosition, and mSize. Referenced by Read(). |
|
sets the file pointer to the beginning of the file
Implements salt::RFile. Definition at line 171 of file fileclasses.cpp. References mPosition. |
|
sets the file pointer for the file. The new position, measured in bytes, is obtained by adding offset bytes to the position specified by origin. If origin is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the start of the file, the current position indicator, or end-of-file, respectively. Implements salt::RFile. Definition at line 156 of file fileclasses.cpp. |
|
return the size of the file
Implements salt::RFile. Definition at line 176 of file fileclasses.cpp. References mSize. |
|
returns the current file pointer position
Implements salt::RFile. Definition at line 145 of file fileclasses.cpp. References mPosition. Referenced by GetPos(). |
|
a pointer to the buffer holding the file
Definition at line 204 of file fileclasses.h. Referenced by Destroy(), Getc(), Gets(), MemFile(), Open(), and Read(). |
|
the file handle
Definition at line 201 of file fileclasses.h. Referenced by Destroy(), GetHandle(), MemFile(), Open(), and ~MemFile(). |
|
the current file pointer position
Definition at line 210 of file fileclasses.h. Referenced by Destroy(), Eof(), Getc(), Gets(), MemFile(), Open(), Read(), Rewind(), Seek(), and Tell(). |
|
the size of the file in bytes
Definition at line 207 of file fileclasses.h. Referenced by Destroy(), Eof(), Getc(), MemFile(), Open(), Read(), Seek(), and Size(). |