OpenTTD Source 20241224-master-gee860a5c8e
FileStringReader Struct Reference

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

Inheritance diagram for FileStringReader:
StringReader

Public Member Functions

 FileStringReader (StringData &data, const std::filesystem::path &file, bool master, bool translation)
 Create the reader.
 
std::optional< std::string > ReadLine () override
 Read a single line from the source of strings.
 
void HandlePragma (char *str) override
 Handle the pragma of the file.
 
void ParseFile () override
 Start parsing the file.
 
- Public Member Functions inherited from StringReader
 StringReader (StringData &data, const std::string &file, bool master, bool translation)
 Prepare reading.
 
void HandleString (char *str)
 

Data Fields

std::ifstream input_stream
 
- 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 71 of file strgen.cpp.

Constructor & Destructor Documentation

◆ FileStringReader()

FileStringReader::FileStringReader ( StringData data,
const std::filesystem::path &  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 81 of file strgen.cpp.

References StringReader::file.

Member Function Documentation

◆ HandlePragma()

◆ ParseFile()

void FileStringReader::ParseFile ( )
inlineoverridevirtual

Start parsing the file.

Reimplemented from StringReader.

Definition at line 96 of file strgen.cpp.

References _lang, LanguagePackHeader::isocode, LanguagePackHeader::name, LanguagePackHeader::own_name, StringReader::ParseFile(), and StrEmpty().

◆ ReadLine()

std::optional< std::string > FileStringReader::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 87 of file strgen.cpp.

Field Documentation

◆ input_stream

std::ifstream FileStringReader::input_stream

Definition at line 72 of file strgen.cpp.


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