OpenTTD Source 20241224-master-gf74b0cf984
|
Yes, simply writing to a file. More...
Public Member Functions | |
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. | |
Data Fields | |
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. | |
Yes, simply writing to a file.
Base class for writing data to disk.
Definition at line 2280 of file saveload.cpp.
|
inline |
Create the file writer, so it writes to a specific file.
file | The file to write to. |
Definition at line 2287 of file saveload.cpp.
|
inline |
Make sure everything is cleaned up.
Definition at line 2292 of file saveload.cpp.
References Finish().
|
inline |
Open a file to write to.
path | The path to the file to open. |
openmode | The openmode flags for opening the file. |
Definition at line 200 of file strgen.cpp.
References path.
|
inlinevirtual |
Make sure the file is closed.
Definition at line 212 of file strgen.cpp.
|
inline |
Finalise the writing.
Definition at line 206 of file strgen.cpp.
Referenced by LanguageFileWriter::Finalise(), and HeaderFileWriter::Finalise().
|
inlineoverridevirtual |
Prepare everything to finish writing the savegame.
Reimplemented from SaveFilter.
Definition at line 2305 of file saveload.cpp.
References _game_session_stats, and GameSessionStats::savegame_size.
Referenced by ~FileWriter().
|
inlineoverridevirtual |
Write a given number of bytes into the savegame.
buf | The bytes to write. |
len | The number of bytes to write. |
Implements SaveFilter.
Definition at line 2297 of file saveload.cpp.
References SlError().
std::optional<FileHandle> FileWriter::file |
The file to write to.
Definition at line 2281 of file saveload.cpp.
std::ofstream FileWriter::output_stream |
The stream to write all the output to.
Definition at line 192 of file strgen.cpp.
Referenced by LanguageFileWriter::Finalise(), HeaderFileWriter::Finalise(), HeaderFileWriter::HeaderFileWriter(), LanguageFileWriter::Write(), and HeaderFileWriter::WriteStringID().
const std::filesystem::path FileWriter::path |
The file name we're writing to.
Definition at line 193 of file strgen.cpp.
Referenced by FileWriter(), and HeaderFileWriter::Finalise().