OpenTTD Source 20260206-master-g4d4e37dbf1
StringListReader Struct Reference

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

Inheritance diagram for StringListReader:
StringReader

Public Member Functions

 StringListReader (StringData &data, const LanguageStrings &strings, bool master, bool translation)
 Create the reader.
std::optional< std::string > ReadLine () override
 Read a single line from the source of strings.
Public Member Functions inherited from StringReader
 StringReader (StringData &data, const std::string &file, bool master, bool translation)
 Prepare reading.
void HandleString (std::string_view str)
virtual void HandlePragma (std::string_view str, LanguagePackHeader &lang)
 Handle the pragma of the file.
virtual void ParseFile ()
 Start parsing the file.

Data Fields

StringList::const_iterator p
 The current location of the iteration.
StringList::const_iterator end
 The end of the iteration.
Data Fields inherited from StringReader
StringDatadata
 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.

Detailed Description

A reader that simply reads using fopen.

Definition at line 81 of file game_text.cpp.

Constructor & Destructor Documentation

◆ StringListReader()

StringListReader::StringListReader ( StringData & data,
const LanguageStrings & strings,
bool master,
bool translation )
inline

Create the reader.

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

Definition at line 92 of file game_text.cpp.

References StringReader::data, end, StringReader::master, p, StringReader::StringReader(), and StringReader::translation.

Member Function Documentation

◆ ReadLine()

std::optional< std::string > StringListReader::ReadLine ( )
inlineoverridevirtual

Read a single line from the source of strings.

Returns
The line, or std::nullopt if at the end of the file.

Implements StringReader.

Definition at line 97 of file game_text.cpp.

Field Documentation

◆ end

StringList::const_iterator StringListReader::end

The end of the iteration.

Definition at line 83 of file game_text.cpp.

Referenced by StringListReader().

◆ p

StringList::const_iterator StringListReader::p

The current location of the iteration.

Definition at line 82 of file game_text.cpp.

Referenced by StringListReader().


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