ScummVM API documentation
Titanic::SimpleFile Class Reference

#include <simple_file.h>

Inheritance diagram for Titanic::SimpleFile:
Titanic::CompressedFile Titanic::CTitleStream Titanic::StdCWadFile

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
 

Detailed Description

This class implements basic reading and writing to files

Member Function Documentation

◆ open() [1/2]

virtual void Titanic::SimpleFile::open ( Common::SeekableReadStream stream)
virtual

Set up a stream for read access

Reimplemented in Titanic::StdCWadFile, and Titanic::CompressedFile.

◆ open() [2/2]

virtual void Titanic::SimpleFile::open ( Common::OutSaveFile stream)
virtual

Set up a stream for write access

Reimplemented in Titanic::StdCWadFile, and Titanic::CompressedFile.

◆ close()

virtual void Titanic::SimpleFile::close ( )
virtual

Close the file

◆ safeRead()

virtual void Titanic::SimpleFile::safeRead ( void *  dst,
size_t  count 
)
virtual

Read from the file with validation

◆ unsafeRead()

virtual size_t Titanic::SimpleFile::unsafeRead ( void *  dst,
size_t  count 
)
virtual

Read from the file

◆ write()

virtual size_t Titanic::SimpleFile::write ( const void *  src,
size_t  count 
) const
virtual

Write out data

◆ seek()

virtual void Titanic::SimpleFile::seek ( int  offset,
int  origin 
)
virtual

Seek

◆ readByte()

byte Titanic::SimpleFile::readByte ( )

Read a byte

◆ readUint16LE()

uint Titanic::SimpleFile::readUint16LE ( )

Read a 16-bit LE number

◆ readUint32LE()

uint Titanic::SimpleFile::readUint32LE ( )

Read a 32-bit LE number

◆ readString()

CString Titanic::SimpleFile::readString ( )

Read a string from the file

◆ readNumber()

int Titanic::SimpleFile::readNumber ( )

Read a number from the file

◆ readFloat()

double Titanic::SimpleFile::readFloat ( )

Read a floating point number from the file

◆ readPoint()

Point Titanic::SimpleFile::readPoint ( )

Read in a point

◆ readRect()

Rect Titanic::SimpleFile::readRect ( )

Read in a rect

◆ readBounds()

Rect Titanic::SimpleFile::readBounds ( )

Rect in a bounds

◆ readBuffer()

void Titanic::SimpleFile::readBuffer ( char *  buffer = nullptr,
size_t  count = 0 
)

Read a string and copy it into an optionally passed buffer

◆ scanf()

bool Titanic::SimpleFile::scanf ( const char *  format,
  ... 
)

Scan in values from the file

◆ writeByte()

void Titanic::SimpleFile::writeByte ( byte  b)
inline

Write out a byte

◆ writeUint16LE()

void Titanic::SimpleFile::writeUint16LE ( uint  val)

Write out a raw 16-bit LE number

◆ writeUint32LE()

void Titanic::SimpleFile::writeUint32LE ( uint  val)

Write out a raw 32-bit LE number

◆ writeLine()

void Titanic::SimpleFile::writeLine ( const CString str) const

Write a string line

◆ writeString()

void Titanic::SimpleFile::writeString ( const CString str) const

Write a string

◆ writeQuotedString()

void Titanic::SimpleFile::writeQuotedString ( const CString str) const

Write a quoted string

◆ writeQuotedLine()

void Titanic::SimpleFile::writeQuotedLine ( const CString str,
int  indent 
) const

Write a quoted string line

◆ writeNumber()

void Titanic::SimpleFile::writeNumber ( int  val) const

Write a number to file

◆ writeNumberLine()

void Titanic::SimpleFile::writeNumberLine ( int  val,
int  indent 
) const

Write a number line to file

◆ writeFloat()

void Titanic::SimpleFile::writeFloat ( double  val) const

Write a floating point number

◆ writeFloatLine()

void Titanic::SimpleFile::writeFloatLine ( double  val,
int  indent 
) const

Write a floating point number as a line

◆ writePoint()

void Titanic::SimpleFile::writePoint ( const Point pt,
int  indent 
) const

Write out a point line

◆ writeRect()

void Titanic::SimpleFile::writeRect ( const Rect r,
int  indent 
) const

Write out a rect line

◆ writeBounds()

void Titanic::SimpleFile::writeBounds ( const Rect r,
int  indent 
) const

Write out a bounds line

◆ writeFormat()

void Titanic::SimpleFile::writeFormat ( const char *  format,
  ... 
) const

Write out a string using a format specifier, just like fprintf

◆ writeIndent()

void Titanic::SimpleFile::writeIndent ( uint  indent) const

Write out a number of tabs to form an indent in the output

◆ isClassStart()

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

◆ writeClassStart()

void Titanic::SimpleFile::writeClassStart ( const CString classStr,
int  indent 
)

Write the starting header for a class definition

◆ writeClassEnd()

void Titanic::SimpleFile::writeClassEnd ( int  indent)

Write out the ending footer for a class definition

◆ eos()

bool Titanic::SimpleFile::eos ( ) const
inline

Return true if the stream has finished being read


The documentation for this class was generated from the following file: