OpenTTD Source 20241224-master-gee860a5c8e
|
Class for writing a language to disk. More...
Public Member Functions | |
LanguageFileWriter (const std::filesystem::path &path) | |
Open a file to write to. | |
void | WriteHeader (const LanguagePackHeader *header) override |
Write the header metadata. | |
void | Finalise () override |
Finalise writing the file. | |
void | Write (const uint8_t *buffer, size_t length) override |
Write a number of bytes. | |
Public Member Functions inherited from LanguageWriter | |
virtual | ~LanguageWriter ()=default |
Especially destroy the subclasses. | |
virtual void | WriteLength (uint length) |
Write the length as a simple gamma. | |
virtual void | WriteLang (const StringData &data) |
Actually write the language. | |
Public Member Functions inherited from FileWriter | |
FileWriter (FileHandle &&file) | |
Create the file writer, so it writes to a specific file. | |
~FileWriter () | |
Make sure everything is cleaned up. | |
void | Write (uint8_t *buf, size_t size) override |
Write a given number of bytes into the savegame. | |
void | Finish () override |
Prepare everything to finish writing the savegame. | |
FileWriter (const std::filesystem::path &path, std::ios_base::openmode openmode) | |
Open a file to write to. | |
void | Finalise () |
Finalise the writing. | |
virtual | ~FileWriter () |
Make sure the file is closed. | |
Public Member Functions inherited from SaveFilter | |
SaveFilter (std::shared_ptr< SaveFilter > chain) | |
Initialise this filter. | |
virtual | ~SaveFilter ()=default |
Make sure the writers are properly closed. | |
Additional Inherited Members | |
Data Fields inherited from FileWriter | |
std::optional< FileHandle > | file |
The file to write to. | |
std::ofstream | output_stream |
The stream to write all the output to. | |
const std::filesystem::path | path |
The file name we're writing to. | |
Data Fields inherited from SaveFilter | |
std::shared_ptr< SaveFilter > | chain |
Chained to the (savegame) filters. | |
Class for writing a language to disk.
Definition at line 284 of file strgen.cpp.
|
inline |
Open a file to write to.
path | The path to the file to open. |
Definition at line 289 of file strgen.cpp.
|
inlineoverridevirtual |
Finalise writing the file.
Implements LanguageWriter.
Definition at line 298 of file strgen.cpp.
References FileWriter::Finalise(), and FileWriter::output_stream.
|
inlineoverridevirtual |
Write a number of bytes.
buffer | The buffer to write. |
length | The amount of byte to write. |
Implements LanguageWriter.
Definition at line 304 of file strgen.cpp.
References FileWriter::output_stream.
Referenced by WriteHeader().
|
inlineoverridevirtual |
Write the header metadata.
The multi-byte integers are already converted to the little endian format.
header | The header to write. |
Implements LanguageWriter.
Definition at line 293 of file strgen.cpp.
References Write().