CrystalSpace

Public API Reference

csFileReadHelper Class Reference

Convenience class for simple file element reading. More...

#include <csutil/filereadhelper.h>

List of all members.

Public Member Functions

 csFileReadHelper (iFile *file)
 Initialize reader.
iFileGetFile ()
 Get the wrapped file.
void Skip (size_t num)
 Skip a given amount of bytes.
Character reading
int GetChar ()
 Read a single character. Returns EOF if the stream has finished.
int LookChar ()
 Return the next character (or EOF), but don't move forward.
String reading
bool GetString (char *buf, size_t len, bool OmitNewline=true)
 Read a line of text.
float ReadTextFloat ()
 Read a floating-point value from the stream that is stored as ASCII.
int ReadTextInt ()
 Read an integer value from the stream that is stored as ASCII.
void SkipWhitespace ()
 Skip any whitespace characters.
Sized type reading
Remarks:
No endian conversion is done.


bool ReadInt16 (int16 &val)
bool ReadInt32 (int32 &val)
bool ReadInt8 (int8 &val)
 Read a specifically sized data value from the file.
bool ReadUInt16 (uint16 &val)
bool ReadUInt32 (uint32 &val)
bool ReadUInt8 (uint8 &val)


Detailed Description

Convenience class for simple file element reading.

Definition at line 35 of file filereadhelper.h.


Constructor & Destructor Documentation

csFileReadHelper::csFileReadHelper ( iFile file  )  [inline]

Initialize reader.

Parameters:
file The file to subsequently read from.

Definition at line 43 of file filereadhelper.h.


Member Function Documentation

int csFileReadHelper::GetChar (  ) 

Read a single character. Returns EOF if the stream has finished.

iFile* csFileReadHelper::GetFile (  )  [inline]

Get the wrapped file.

Definition at line 46 of file filereadhelper.h.

bool csFileReadHelper::GetString ( char *  buf,
size_t  len,
bool  OmitNewline = true 
)

Read a line of text.

Returns false if the stream has finished. If 'OmitNewline' is true then the newline character will be thrown away.

int csFileReadHelper::LookChar (  ) 

Return the next character (or EOF), but don't move forward.

bool csFileReadHelper::ReadInt8 ( int8 val  ) 

Read a specifically sized data value from the file.

Parameters:
val The variable to read to.
Returns:
False on EOF.

float csFileReadHelper::ReadTextFloat (  ) 

Read a floating-point value from the stream that is stored as ASCII.

int csFileReadHelper::ReadTextInt (  ) 

Read an integer value from the stream that is stored as ASCII.

void csFileReadHelper::Skip ( size_t  num  )  [inline]

Skip a given amount of bytes.

Definition at line 49 of file filereadhelper.h.

References iFile::SetPos().

void csFileReadHelper::SkipWhitespace (  ) 

Skip any whitespace characters.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.4.7