OpenTTD Source
20241121-master-g67a0fccfad
|
Class for writing a language to disk. More...
Public Member Functions | |
LanguageFileWriter (const std::filesystem::path &path) | |
Open a file to write to. More... | |
void | WriteHeader (const LanguagePackHeader *header) override |
Write the header metadata. More... | |
void | Finalise () override |
Finalise writing the file. | |
void | Write (const uint8_t *buffer, size_t length) override |
Write a number of bytes. More... | |
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. More... | |
virtual void | WriteLang (const StringData &data) |
Actually write the language. More... | |
Public Member Functions inherited from FileWriter | |
FileWriter (FileHandle &&file) | |
Create the file writer, so it writes to a specific file. More... | |
~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. More... | |
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. More... | |
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. More... | |
virtual | ~SaveFilter () |
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 |
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().