#include <LDK/VFile.h>
Inheritance diagram for LDK::VFile:
Public Member Functions | |
VFile () | |
Constructor. | |
virtual | ~VFile () throw () |
Destructor. Closes this file if it was open. | |
const char * | name () |
virtual void | openRead (const char *fileName, bool text=false)=0 |
virtual void | openWrite (const char *fileName, bool text=false)=0 |
virtual void | openAppend (const char *fileName, bool text=false)=0 |
virtual void | close ()=0 |
virtual int64 | length ()=0 |
virtual bool | eof ()=0 |
virtual int64 | tell ()=0 |
virtual int64 | seek (int64 offset, int whence)=0 |
virtual void | flush ()=0 |
virtual int64 | read (void *buffer, uint32 objCount, uint32 objSize=1)=0 |
virtual int32 | getc ()=0 |
virtual int32 | ungetc (char c)=0 |
virtual uint32 | getString (char *buffer, uint32 size) |
virtual const char * | gets (char *buffer, uint32 size)=0 |
int16 | readSLE16 () |
uint16 | readULE16 () |
int16 | readSBE16 () |
uint16 | readUBE16 () |
int32 | readSLE32 () |
uint32 | readULE32 () |
int32 | readSBE32 () |
uint32 | readUBE32 () |
int64 | readSLE64 () |
uint64 | readULE64 () |
int64 | readSBE64 () |
uint64 | readUBE64 () |
virtual int64 | write (const void *buffer, uint32 objCount, uint32 objSize=1)=0 |
virtual int32 | putc (char c)=0 |
virtual int32 | puts (const char *str)=0 |
virtual int32 | printf (const char *format,...)=0 |
virtual int32 | vprintf (const char *format, va_list ap)=0 |
void | writeSLE16 (int16 dat) |
void | writeULE16 (uint16 dat) |
void | writeSBE16 (int16 dat) |
void | writeUBE16 (uint16 dat) |
void | writeSLE32 (int32 dat) |
void | writeULE32 (uint32 dat) |
void | writeSBE32 (int32 dat) |
void | writeUBE32 (uint32 dat) |
void | writeSLE64 (int64 dat) |
void | writeULE64 (uint64 dat) |
void | writeSBE64 (int64 dat) |
void | writeUBE64 (uint64 dat) |
bool | writeable () |
Returns true if the file is writable, false if readable. | |
Protected Attributes | |
bool | mTextMode |
bool | mWriteable |
String | mName |
Definition at line 71 of file VFile.h.
const char* LDK::VFile::name | ( | ) | [inline] |
virtual void LDK::VFile::openRead | ( | const char * | fileName, | |
bool | text = false | |||
) | [pure virtual] |
Open a file for reading. Genrally only called by the user for re-opening files.
fileName | The name of the file to open. | |
text | Open this file in text (true) or binary (false) mode. |
IOError | if this file cannot be opened. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual void LDK::VFile::openWrite | ( | const char * | fileName, | |
bool | text = false | |||
) | [pure virtual] |
Open a file for writing. Genrally only called by the user for re-opening files.
fileName | The name of the file to open. | |
text | Open this file in text (true) or binary (false) mode. |
IOError | if this file cannot be opened. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual void LDK::VFile::openAppend | ( | const char * | fileName, | |
bool | text = false | |||
) | [pure virtual] |
Open a file for appending (writing at the end). Genrally only called by the user for re-opening files.
fileName | The name of the file to open. | |
text | Open this file in text (true) or binary (false) mode. |
IOError | if this file cannot be opened. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual void LDK::VFile::close | ( | ) | [pure virtual] |
Close this file.
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual int64 LDK::VFile::length | ( | ) | [pure virtual] |
Gets the length of the file in bytes. Use with care in text mode, as may not take into account strange line terminations like on windows.
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual bool LDK::VFile::eof | ( | ) | [pure virtual] |
Test for end of file condition.
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual int64 LDK::VFile::tell | ( | ) | [pure virtual] |
Determine the current file position.
IOError | if the file handle is invalid or an error occurred. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual int64 LDK::VFile::seek | ( | int64 | offset, | |
int | whence | |||
) | [pure virtual] |
Seek to a new position within this file.
offset | The distance to seek. | |
whence | May be SEEK_CUR (seek from current pos) or SEEK_END (seek from the end of the file). Anything else means seek from the beginning. |
IOError | If the file handle is invalid or an error occurred. | |
EofError | On an attempt to seek past the start or end of the file. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual void LDK::VFile::flush | ( | ) | [pure virtual] |
Flush any buffers associated with this file.
IOError | if the file handle is invalid or an error occurred. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual int64 LDK::VFile::read | ( | void * | buffer, | |
uint32 | objCount, | |||
uint32 | objSize = 1 | |||
) | [pure virtual] |
Read a number of objects from this file.
buffer | The buffer to store read data into. | |
objCount | The number of objects to read. | |
objSize | The size in bytes of each object. |
IOError | If the file handle is invalid or the file is not readable. | |
ArgumentError | If objCount or objSize is 0. | |
EofError | On an attempt to read past the end of the file. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual int32 LDK::VFile::getc | ( | ) | [pure virtual] |
Read a single character (byte) from this file. Mostly used in text mode.
IOError | if the file handle is invalid or the file is not readable. | |
EofError | On an attempt to read past the end of the file. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual int32 LDK::VFile::ungetc | ( | char | c | ) | [pure virtual] |
Push one character back into the stream. Mostly used in text mode for programming language lexers and parsers. Character is lost by seeking or flushing, and only one character may be held in the pushed back buffer at a time.
c | The character to push back. |
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file position is at the beginning of the file. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
Read at most 1 less than size characters until whitespace into buffer.
buffer | The buffer to store read data into. | |
size | The maximum number of characters to read + 1. |
virtual const char* LDK::VFile::gets | ( | char * | buffer, | |
uint32 | size | |||
) | [pure virtual] |
Read at most 1 less than size characters into buffer
buffer | The buffer to store read data into. | |
size | The size of the buffer in characters. |
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before whitespace or size-1 characters. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
int16 LDK::VFile::readSLE16 | ( | ) | [inline] |
Read a signed 16-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 2 bytes have been read. |
Definition at line 186 of file VFile.h.
References LDK::swapSLE16().
Here is the call graph for this function:
uint16 LDK::VFile::readULE16 | ( | ) | [inline] |
Read an unsigned 16-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 2 bytes have been read. |
Definition at line 199 of file VFile.h.
References LDK::swapULE16().
Here is the call graph for this function:
int16 LDK::VFile::readSBE16 | ( | ) | [inline] |
Read a signed 16-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 2 bytes have been read. |
Definition at line 212 of file VFile.h.
References LDK::swapSBE16().
Here is the call graph for this function:
uint16 LDK::VFile::readUBE16 | ( | ) | [inline] |
Read an unsigned 16-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 2 bytes have been read. |
Definition at line 225 of file VFile.h.
References LDK::swapUBE16().
Here is the call graph for this function:
int32 LDK::VFile::readSLE32 | ( | ) | [inline] |
Read a signed 32-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 4 bytes have been read. |
Definition at line 238 of file VFile.h.
References LDK::swapSLE32().
Here is the call graph for this function:
uint32 LDK::VFile::readULE32 | ( | ) | [inline] |
Read an unsigned 32-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 4 bytes have been read. |
Definition at line 251 of file VFile.h.
References LDK::swapULE32().
Here is the call graph for this function:
int32 LDK::VFile::readSBE32 | ( | ) | [inline] |
Read a signed 32-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 4 bytes have been read. |
Definition at line 264 of file VFile.h.
References LDK::swapSBE32().
Here is the call graph for this function:
uint32 LDK::VFile::readUBE32 | ( | ) | [inline] |
Read an unsigned 32-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 4 bytes have been read. |
Definition at line 277 of file VFile.h.
References LDK::swapUBE32().
Here is the call graph for this function:
int64 LDK::VFile::readSLE64 | ( | ) | [inline] |
Read a signed 64-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 8 bytes have been read. |
Definition at line 290 of file VFile.h.
References LDK::swapSLE64().
Here is the call graph for this function:
uint64 LDK::VFile::readULE64 | ( | ) | [inline] |
Read an unsigned 64-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 8 bytes have been read. |
Definition at line 303 of file VFile.h.
References LDK::swapULE64().
Here is the call graph for this function:
int64 LDK::VFile::readSBE64 | ( | ) | [inline] |
Read a signed 64-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 8 bytes have been read. |
Definition at line 316 of file VFile.h.
References LDK::swapSBE64().
Here is the call graph for this function:
uint64 LDK::VFile::readUBE64 | ( | ) | [inline] |
Read an unsigned 64-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
IOError | If the file handle is invalid or the file is not readable. | |
EofError | If the file ends before 8 bytes have been read. |
Definition at line 329 of file VFile.h.
References LDK::swapUBE64().
Here is the call graph for this function:
virtual int64 LDK::VFile::write | ( | const void * | buffer, | |
uint32 | objCount, | |||
uint32 | objSize = 1 | |||
) | [pure virtual] |
Write a number of objects to this file.
buffer | The buffer that holds the data to be written. | |
objCount | The number of objects to be written. | |
objSize | The size of each object to be written. |
IOError | If the file handle is invalid, the file is not writable, or the requested number of objects written does not match the actual number of objects written. | |
ArgumentError | If ObjCount or ObjSize are 0. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual int32 LDK::VFile::putc | ( | char | c | ) | [pure virtual] |
Write a single character to this file.
c | The character to write. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual int32 LDK::VFile::puts | ( | const char * | str | ) | [pure virtual] |
Write a string to this file. Behaves like "fputs" i.e. no newline is appended.
str | The string to write. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual int32 LDK::VFile::printf | ( | const char * | format, | |
... | ||||
) | [pure virtual] |
Produce output according to format, as described in your compiler/OS documentation.
format | the format string | |
... | The data to format |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
virtual int32 LDK::VFile::vprintf | ( | const char * | format, | |
va_list | ap | |||
) | [pure virtual] |
Produce output according to format, as described in your compiler/OS documentation.
format | the format string | |
ap | A variable length argument list containing the data to format. |
Implemented in LDK::PhysFSFile, and LDK::StdFile.
void LDK::VFile::writeSLE16 | ( | int16 | dat | ) | [inline] |
Write a signed 16-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 377 of file VFile.h.
References LDK::swapSLE16().
Here is the call graph for this function:
void LDK::VFile::writeULE16 | ( | uint16 | dat | ) | [inline] |
Write an unsigned 16-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 389 of file VFile.h.
References LDK::swapULE16().
Here is the call graph for this function:
void LDK::VFile::writeSBE16 | ( | int16 | dat | ) | [inline] |
Write a signed 16-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 401 of file VFile.h.
References LDK::swapSBE16().
Here is the call graph for this function:
void LDK::VFile::writeUBE16 | ( | uint16 | dat | ) | [inline] |
Write an unsigned 16-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 413 of file VFile.h.
References LDK::swapUBE16().
Here is the call graph for this function:
void LDK::VFile::writeSLE32 | ( | int32 | dat | ) | [inline] |
Write a signed 32-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 425 of file VFile.h.
References LDK::swapSLE32().
Here is the call graph for this function:
void LDK::VFile::writeULE32 | ( | uint32 | dat | ) | [inline] |
Write an unsigned 32-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 437 of file VFile.h.
References LDK::swapULE32().
Here is the call graph for this function:
void LDK::VFile::writeSBE32 | ( | int32 | dat | ) | [inline] |
Write a signed 32-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 449 of file VFile.h.
References LDK::swapSBE32().
Here is the call graph for this function:
void LDK::VFile::writeUBE32 | ( | uint32 | dat | ) | [inline] |
Write an unsigned 32-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 461 of file VFile.h.
References LDK::swapUBE32().
Here is the call graph for this function:
void LDK::VFile::writeSLE64 | ( | int64 | dat | ) | [inline] |
Write a signed 64-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 473 of file VFile.h.
References LDK::swapSLE64().
Here is the call graph for this function:
void LDK::VFile::writeULE64 | ( | uint64 | dat | ) | [inline] |
Write an unsigned 64-bit little endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 485 of file VFile.h.
References LDK::swapULE64().
Here is the call graph for this function:
void LDK::VFile::writeSBE64 | ( | int64 | dat | ) | [inline] |
Write a signed 64-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 497 of file VFile.h.
References LDK::swapSBE64().
Here is the call graph for this function:
void LDK::VFile::writeUBE64 | ( | uint64 | dat | ) | [inline] |
Write an unsigned 64-bit big endian integer, performing byte swapping if nessecary. Can only be used in binary mode.
dat | The integer to write. |
IOError | If the file handle is invalid, this file is not writable, or the integer cannot be completely written. |
Definition at line 509 of file VFile.h.
References LDK::swapUBE64().
Here is the call graph for this function: