![]() |
Public API Reference |
Convenience class for simple file element reading. More...
#include <csutil/filereadhelper.h>
Public Member Functions | |
| csFileReadHelper (iFile *file) | |
| Initialize reader. | |
| iFile * | GetFile () |
| Get the wrapped file. | |
| void | Skip (size_t num) |
| Skip a given amount of bytes. | |
Sized type reading | |
| |
| bool | ReadInt8 (int8 &val) |
| Read a specifically sized data value from the file. | |
| bool | ReadUInt8 (uint8 &val) |
| Read a specifically sized data value from the file. | |
| bool | ReadInt16 (int16 &val) |
| Read a specifically sized data value from the file. | |
| bool | ReadUInt16 (uint16 &val) |
| Read a specifically sized data value from the file. | |
| bool | ReadInt32 (int32 &val) |
| Read a specifically sized data value from the file. | |
| bool | ReadUInt32 (uint32 &val) |
| Read a specifically sized data value from the file. | |
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. | |
| int | ReadTextInt () |
| Read an integer value from the stream that is stored as ASCII. | |
| float | ReadTextFloat () |
| Read a floating-point value from the stream that is stored as ASCII. | |
| void | SkipWhitespace () |
| Skip any whitespace characters. | |
Convenience class for simple file element reading.
Definition at line 35 of file filereadhelper.h.
| csFileReadHelper::csFileReadHelper | ( | iFile * | file | ) | [inline] |
Initialize reader.
| file | The file to subsequently read from. |
Definition at line 43 of file filereadhelper.h.
| 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::ReadInt16 | ( | int16 & | val | ) |
Read a specifically sized data value from the file.
| val | The variable to read to. |
| bool csFileReadHelper::ReadInt32 | ( | int32 & | val | ) |
Read a specifically sized data value from the file.
| val | The variable to read to. |
| bool csFileReadHelper::ReadInt8 | ( | int8 & | val | ) |
Read a specifically sized data value from the file.
| val | The variable to read to. |
| 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.
| bool csFileReadHelper::ReadUInt16 | ( | uint16 & | val | ) |
Read a specifically sized data value from the file.
| val | The variable to read to. |
| bool csFileReadHelper::ReadUInt32 | ( | uint32 & | val | ) |
Read a specifically sized data value from the file.
| val | The variable to read to. |
| bool csFileReadHelper::ReadUInt8 | ( | uint8 & | val | ) |
Read a specifically sized data value from the file.
| val | The variable to read to. |
| void csFileReadHelper::Skip | ( | size_t | num | ) | [inline] |
Skip a given amount of bytes.
Definition at line 49 of file filereadhelper.h.
| void csFileReadHelper::SkipWhitespace | ( | ) |
Skip any whitespace characters.