OpenTTD Source 20241224-master-gee860a5c8e
|
Helper for reading strings. More...
#include <strgen.h>
Public Member Functions | |
StringReader (StringData &data, const std::string &file, bool master, bool translation) | |
Prepare reading. | |
void | HandleString (char *str) |
virtual std::optional< std::string > | ReadLine ()=0 |
Read a single line from the source of strings. | |
virtual void | HandlePragma (char *str) |
Handle the pragma of the file. | |
virtual void | ParseFile () |
Start parsing the file. | |
Data Fields | |
StringData & | data |
The data to fill during reading. | |
const std::string | 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. | |
StringReader::StringReader | ( | StringData & | data, |
const std::string & | file, | ||
bool | master, | ||
bool | translation | ||
) |
Prepare reading.
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 532 of file strgen_base.cpp.
|
virtual |
Handle the pragma of the file.
str | The pragma string to parse. |
Reimplemented in FileStringReader.
Definition at line 733 of file strgen_base.cpp.
References _lang, _plural_forms, lengthof, and LanguagePackHeader::plural_form.
Referenced by FileStringReader::HandlePragma().
void StringReader::HandleString | ( | char * | str | ) |
Definition at line 640 of file strgen_base.cpp.
|
virtual |
Start parsing the file.
Reimplemented in FileStringReader.
Definition at line 750 of file strgen_base.cpp.
References _cur_line, _file, _lang, _translation, data, LanguagePackHeader::digit_decimal_separator, LanguagePackHeader::digit_group_separator, LanguagePackHeader::digit_group_separator_currency, file, StringData::max_strings, MemSetT(), StringData::next_string_id, ReadLine(), strecpy(), and translation.
Referenced by GameStrings::Compile(), and FileStringReader::ParseFile().
|
pure virtual |
Read a single line from the source of strings.
Implemented in StringListReader, and FileStringReader.
Referenced by ParseFile().
StringData& StringReader::data |
The data to fill during reading.
Definition at line 59 of file strgen.h.
Referenced by FileStringReader::HandlePragma(), and ParseFile().
const std::string StringReader::file |
The file we are reading.
Definition at line 60 of file strgen.h.
Referenced by FileStringReader::FileStringReader(), and ParseFile().
bool StringReader::master |
Are we reading the master file?
Definition at line 61 of file strgen.h.
Referenced by FileStringReader::HandlePragma().
bool StringReader::translation |
Are we reading a translation, implies !master. However, the base translation will have this false.
Definition at line 62 of file strgen.h.
Referenced by ParseFile().