OpenTTD Source: LanguageFileWriter Struct Reference

OpenTTD Source 13.1

Public Member Functions
LanguageFileWriter Struct Reference

Class for writing a language to disk. More...

Inheritance diagram for LanguageFileWriter:

## Public Member Functions
| LanguageFileWriter (const char *filename)
| Open a file to write to. More...
void | WriteHeader (const LanguagePackHeader *header)
| Write the header metadata. More...
void | Finalise ()
| Finalise writing the file.
void | Write (const byte *buffer, size_t length)
| Write a number of bytes. More...
Public Member Functions inherited from LanguageWriter
virtual | ~LanguageWriter ()
| 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 (FILE *file)
| Create the file writer, so it writes to a specific file. More...
| ~FileWriter ()
| Make sure everything is cleaned up.
void | Write (byte *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 char *filename)
| 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 (SaveFilter *chain)
| Initialise this filter. More...
virtual | ~SaveFilter ()
| Make sure the writers are properly closed.

## Additional Inherited Members
Data Fields inherited from FileWriter
FILE * | file
| The file to write to.
FILE * | fh
| The file handle we're writing to.
const char * | filename
| The file name we're writing to.
Data Fields inherited from SaveFilter
SaveFilter * | chain
| Chained to the (savegame) filters.

## Detailed Description

Class for writing a language to disk.

Definition at line 344 of file strgen.cpp.

## Constructor & Destructor Documentation

## ◆ LanguageFileWriter()

LanguageFileWriter::LanguageFileWriter | ( | const char * | filename | ) |
| inline

Open a file to write to.

Parameters

  filename | The file to open.

Definition at line 349 of file strgen.cpp.

## Member Function Documentation

## ◆ Write()

void LanguageFileWriter::Write | ( | const byte * | buffer,
|  | size_t | length
| ) |  |
| inlinevirtual

Write a number of bytes.

Parameters

  buffer | The buffer to write.
  length | The amount of byte to write.

Implements LanguageWriter.

Definition at line 366 of file strgen.cpp.

References FileWriter::fh.

Referenced by WriteHeader().

## ◆ WriteHeader()

void LanguageFileWriter::WriteHeader | ( | const LanguagePackHeader * | header | ) |
| inlinevirtual

Write the header metadata.

The multi-byte integers are already converted to the little endian format.

Parameters

  header | The header to write.

Implements LanguageWriter.

Definition at line 353 of file strgen.cpp.

References Write().

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

- src/strgen/strgen.cpp