OpenTTD
Public Member Functions | Data Fields
FileStringReader Struct Reference

A reader that simply reads using fopen. More...

Inheritance diagram for FileStringReader:
StringReader

Public Member Functions

 FileStringReader (StringData &data, const char *file, bool master, bool translation)
 Create the reader.
virtual ~FileStringReader ()
 Free/close the file.
char * ReadLine (char *buffer, const char *last)
 Read a single line from the source of strings.
void HandlePragma (char *str)
 Handle the pragma of the file.
void ParseFile ()
 Start parsing the file.
- Public Member Functions inherited from StringReader
 StringReader (StringData &data, const char *file, bool master, bool translation)
 Prepare reading.
virtual ~StringReader ()
 Make sure the right reader gets freed.
void HandleString (char *str)

Data Fields

FILE * fh
 The file we are reading.
- Data Fields inherited from StringReader
StringDatadata
 The data to fill during reading.
const char * file
 The file we are reading.
bool master
 Are we reading the master file?
bool translation
 Are we reading a translation, implies !master. However, the base translation will have this false.

Detailed Description

A reader that simply reads using fopen.

Definition at line 102 of file strgen.cpp.

Constructor & Destructor Documentation

FileStringReader::FileStringReader ( StringData data,
const char *  file,
bool  master,
bool  translation 
)
inline

Create the reader.

Parameters
dataThe data to fill during reading.
fileThe file we are reading.
masterAre we reading the master file?
translationAre we reading a translation?

Definition at line 112 of file strgen.cpp.

References error(), and fh.

virtual FileStringReader::~FileStringReader ( )
inlinevirtual

Free/close the file.

Definition at line 120 of file strgen.cpp.

References fh.

Member Function Documentation

void FileStringReader::HandlePragma ( char *  str)
virtual
char* FileStringReader::ReadLine ( char *  buffer,
const char *  last 
)
inlinevirtual

Read a single line from the source of strings.

Parameters
bufferThe buffer to read the data in to.
lastThe last element in the buffer.
Returns
The buffer, or NULL if at the end of the file.

Implements StringReader.

Definition at line 125 of file strgen.cpp.

References ClampToU16(), and fh.


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