|
OpenTTD Source 20260208-master-g43af8e94d0
|
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 (std::string_view str) |
| virtual std::optional< std::string > | ReadLine ()=0 |
| Read a single line from the source of strings. | |
| virtual void | HandlePragma (std::string_view str, LanguagePackHeader &lang) |
| 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 377 of file strgen_base.cpp.
References data, file, master, and translation.
Referenced by FileStringReader::FileStringReader(), and StringListReader::StringListReader().
|
virtual |
Handle the pragma of the file.
| str | The pragma string to parse. |
| lang | The header metadata to write the parsed pragma data to. |
Reimplemented in FileStringReader.
Definition at line 561 of file strgen_base.cpp.
References _plural_forms, lengthof, LanguagePackHeader::plural_form, StringConsumer::ReadIntegerBase(), StringConsumer::ReadUntilChar(), and StringConsumer::SKIP_ALL_SEPARATORS.
Referenced by FileStringReader::HandlePragma().
| void StringReader::HandleString | ( | std::string_view | str | ) |
Definition at line 474 of file strgen_base.cpp.
|
virtual |
Start parsing the file.
Reimplemented in FileStringReader.
Definition at line 575 of file strgen_base.cpp.
References data, file, ReadLine(), translation, and StringConsumer::WHITESPACE_OR_NEWLINE.
Referenced by GameStrings::Compile(), and FileStringReader::ParseFile().
|
pure virtual |
Read a single line from the source of strings.
Implemented in FileStringReader, and StringListReader.
Referenced by ParseFile().
| StringData& StringReader::data |
The data to fill during reading.
Definition at line 60 of file strgen.h.
Referenced by FileStringReader::FileStringReader(), FileStringReader::HandlePragma(), ParseFile(), StringListReader::StringListReader(), and StringReader().
| const std::string StringReader::file |
The file we are reading.
Definition at line 61 of file strgen.h.
Referenced by FileStringReader::FileStringReader(), ParseFile(), and StringReader().
| bool StringReader::master |
Are we reading the master file?
Definition at line 62 of file strgen.h.
Referenced by FileStringReader::FileStringReader(), FileStringReader::HandlePragma(), StringListReader::StringListReader(), and StringReader().
| bool StringReader::translation |
Are we reading a translation, implies !master. However, the base translation will have this false.
Definition at line 63 of file strgen.h.
Referenced by FileStringReader::FileStringReader(), ParseFile(), StringListReader::StringListReader(), and StringReader().