OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

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

## Detailed Description

Class for writing a language to disk.

Definition at line 342 of file strgen.cpp.

## Constructor & Destructor Documentation

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

Open a file to write to.

Parameters

  filename | The file to open.

Definition at line 347 of file strgen.cpp.

## Member Function Documentation

void LanguageFileWriter::Finalise | ( |  | ) |
| inline

Finalise the writing.

Reimplemented from FileWriter.

Definition at line 356 of file strgen.cpp.

References error(), FileWriter::fh, and FileWriter::filename.

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

Write a number of bytes.

Parameters

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

Implements LanguageWriter.

Definition at line 364 of file strgen.cpp.

References error(), FileWriter::fh, and FileWriter::filename.

Referenced by WriteHeader().

void LanguageFileWriter::WriteHeader | ( | const LanguagePackHeader * | header | ) |
| inline virtual

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 351 of file strgen.cpp.

References Write().

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

- src/strgen/strgen.cpp