OpenTTD Source: FileStringReader Struct Reference

OpenTTD Source 12.0-beta1

Public Member Functions | Data Fields
FileStringReader Struct Reference

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

Inheritance diagram for FileStringReader:

## Public Member Functions
| FileStringReader (StringData &data, const char *file, bool master, bool translation)
| Create the reader. More...
virtual | ~FileStringReader ()
| Free/close the file.
char * | ReadLine (char *buffer, const char *last) override
| Read a single line from the source of strings. More...
void | HandlePragma (char *str) override
| Handle the pragma of the file. More...
void | ParseFile () override
| Start parsing the file.
Public Member Functions inherited from StringReader
| StringReader (StringData &data, const char *file, bool master, bool translation)
| Prepare reading. More...
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
StringData & | data
| 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 97 of file strgen.cpp.

## Constructor & Destructor Documentation

## ◆ FileStringReader()

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

Create the reader.

Parameters

  data | The data to fill during reading.
  file | The file we are reading.
  master | Are we reading the master file?
  translation | Are we reading a translation?

Definition at line 107 of file strgen.cpp.

References StringReader::file.

## Member Function Documentation

## ◆ HandlePragma()

void FileStringReader::HandlePragma | ( | char * | str | ) |
| overridevirtual

Handle the pragma of the file.

Parameters

  str | The pragma string to parse.

Reimplemented from StringReader.

Definition at line 137 of file strgen.cpp.

References _lang, StringReader::data, LanguagePackHeader::isocode, lastof, LanguagePackHeader::name, StringData::next_string_id, LanguagePackHeader::own_name, strecpy(), TD_LTR, TD_RTL, and LanguagePackHeader::text_dir.

## ◆ ReadLine()

char* FileStringReader::ReadLine | ( | char * | buffer,
|  | const char * | last
| ) |  |
| inlineoverridevirtual

Read a single line from the source of strings.

Parameters

  buffer | The buffer to read the data in to.
  last | The last element in the buffer.

Returns
  The buffer, or nullptr if at the end of the file.

Implements StringReader.

Definition at line 120 of file strgen.cpp.

References ClampToU16().

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

- src/strgen/strgen.cpp