#include <simple_file.h>
Public Member Functions | |
operator Common::SeekableReadStream & () | |
operator Common::WriteStream & () | |
virtual void | open (Common::SeekableReadStream *stream) |
virtual void | open (Common::OutSaveFile *stream) |
virtual void | close () |
virtual void | safeRead (void *dst, size_t count) |
virtual size_t | unsafeRead (void *dst, size_t count) |
virtual size_t | write (const void *src, size_t count) const |
virtual void | seek (int offset, int origin) |
byte | readByte () |
uint | readUint16LE () |
uint | readUint32LE () |
CString | readString () |
int | readNumber () |
double | readFloat () |
Point | readPoint () |
Rect | readRect () |
Rect | readBounds () |
void | readBuffer (char *buffer=nullptr, size_t count=0) |
bool | scanf (const char *format,...) |
void | writeByte (byte b) |
void | writeUint16LE (uint val) |
void | writeUint32LE (uint val) |
void | writeLine (const CString &str) const |
void | writeString (const CString &str) const |
void | writeQuotedString (const CString &str) const |
void | writeQuotedLine (const CString &str, int indent) const |
void | writeNumber (int val) const |
void | writeNumberLine (int val, int indent) const |
void | writeFloat (double val) const |
void | writeFloatLine (double val, int indent) const |
void | writePoint (const Point &pt, int indent) const |
void | writeRect (const Rect &r, int indent) const |
void | writeBounds (const Rect &r, int indent) const |
void | writeFormat (const char *format,...) const |
void | writeIndent (uint indent) const |
bool | isClassStart () |
void | writeClassStart (const CString &classStr, int indent) |
void | writeClassEnd (int indent) |
bool | eos () const |
Protected Attributes | |
Common::SeekableReadStream * | _inStream |
Common::OutSaveFile * | _outStream |
int | _lineCount |
This class implements basic reading and writing to files
|
virtual |
Set up a stream for read access
Reimplemented in Titanic::StdCWadFile, and Titanic::CompressedFile.
|
virtual |
Set up a stream for write access
Reimplemented in Titanic::StdCWadFile, and Titanic::CompressedFile.
|
virtual |
Close the file
|
virtual |
Read from the file with validation
|
virtual |
Read from the file
|
virtual |
Write out data
|
virtual |
Seek
byte Titanic::SimpleFile::readByte | ( | ) |
Read a byte
uint Titanic::SimpleFile::readUint16LE | ( | ) |
Read a 16-bit LE number
uint Titanic::SimpleFile::readUint32LE | ( | ) |
Read a 32-bit LE number
CString Titanic::SimpleFile::readString | ( | ) |
Read a string from the file
int Titanic::SimpleFile::readNumber | ( | ) |
Read a number from the file
double Titanic::SimpleFile::readFloat | ( | ) |
Read a floating point number from the file
Point Titanic::SimpleFile::readPoint | ( | ) |
Read in a point
Rect Titanic::SimpleFile::readRect | ( | ) |
Read in a rect
void Titanic::SimpleFile::readBuffer | ( | char * | buffer = nullptr , |
size_t | count = 0 |
||
) |
Read a string and copy it into an optionally passed buffer
bool Titanic::SimpleFile::scanf | ( | const char * | format, |
... | |||
) |
Scan in values from the file
|
inline |
Write out a byte
void Titanic::SimpleFile::writeUint16LE | ( | uint | val | ) |
Write out a raw 16-bit LE number
void Titanic::SimpleFile::writeUint32LE | ( | uint | val | ) |
Write out a raw 32-bit LE number
void Titanic::SimpleFile::writeLine | ( | const CString & | str | ) | const |
Write a string line
void Titanic::SimpleFile::writeString | ( | const CString & | str | ) | const |
Write a string
void Titanic::SimpleFile::writeQuotedString | ( | const CString & | str | ) | const |
Write a quoted string
void Titanic::SimpleFile::writeQuotedLine | ( | const CString & | str, |
int | indent | ||
) | const |
Write a quoted string line
void Titanic::SimpleFile::writeNumber | ( | int | val | ) | const |
Write a number to file
void Titanic::SimpleFile::writeNumberLine | ( | int | val, |
int | indent | ||
) | const |
Write a number line to file
void Titanic::SimpleFile::writeFloat | ( | double | val | ) | const |
Write a floating point number
void Titanic::SimpleFile::writeFloatLine | ( | double | val, |
int | indent | ||
) | const |
Write a floating point number as a line
void Titanic::SimpleFile::writePoint | ( | const Point & | pt, |
int | indent | ||
) | const |
Write out a point line
void Titanic::SimpleFile::writeRect | ( | const Rect & | r, |
int | indent | ||
) | const |
Write out a rect line
void Titanic::SimpleFile::writeBounds | ( | const Rect & | r, |
int | indent | ||
) | const |
Write out a bounds line
void Titanic::SimpleFile::writeFormat | ( | const char * | format, |
... | |||
) | const |
Write out a string using a format specifier, just like fprintf
void Titanic::SimpleFile::writeIndent | ( | uint | indent | ) | const |
Write out a number of tabs to form an indent in the output
bool Titanic::SimpleFile::isClassStart | ( | ) |
Validates that the following non-space character is either an opening or closing squiggly bracket denoting a class definition start or end. Returns true if it's a class start
void Titanic::SimpleFile::writeClassStart | ( | const CString & | classStr, |
int | indent | ||
) |
Write the starting header for a class definition
void Titanic::SimpleFile::writeClassEnd | ( | int | indent | ) |
Write out the ending footer for a class definition
|
inline |
Return true if the stream has finished being read