OpenTTD

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

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions
LanguageWriter Struct Reference

Base class for all language writers. More...

`#include <strgen.h>`

Inheritance diagram for LanguageWriter:

## Public Member Functions
virtual void | WriteHeader (const LanguagePackHeader *header)=0
| Write the header metadata.
virtual void | Write (const byte *buffer, size_t length)=0
| Write a number of bytes.
virtual void | Finalise ()=0
| Finalise writing the file.
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.

## Detailed Description

Base class for all language writers.

Definition at line 114 of file strgen.h.

## Constructor & Destructor Documentation

virtual LanguageWriter::~LanguageWriter | ( |  | ) |
| inline virtual

Especially destroy the subclasses.

Definition at line 135 of file strgen.h.

## Member Function Documentation

virtual void LanguageWriter::Write | ( | const byte * | buffer,
|  | size_t | length
| ) |  |
| pure virtual

Write a number of bytes.

Parameters

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

Implemented in LanguageFileWriter, and TranslationWriter.

Referenced by WriteLang(), and WriteLength().

virtual void LanguageWriter::WriteHeader | ( | const LanguagePackHeader * | header | ) |
| pure virtual

Write the header metadata.

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

Parameters

  header | The header to write.

Implemented in LanguageFileWriter, and TranslationWriter.

Referenced by WriteLang().

void LanguageWriter::WriteLang | ( | const StringData & | data | ) |
| virtual

Actually write the language.

Parameters

  data | The data about the string.

Definition at line 953 of file strgen_base.cpp.

References _cur_line, _translated, AllocaM, Buffer::AppendByte(), Buffer::AppendUtf8(), SmallVector< T, S >::Begin(), Case::caseidx, SmallVector< T, S >::Clear(), StringData::CountInUse(), LangString::english, GB(), LanguagePackHeader::IDENT, LanguagePackHeader::ident, SmallVector< T, S >::Length(), LangString::line, LanguagePackHeader::missing, LangString::name, Case::next, LanguagePackHeader::offsets, Case::string, StringData::strings, TAB_SIZE, StringData::tabs, LangString::translated, LangString::translated_case, LanguagePackHeader::version, StringData::Version(), LanguagePackHeader::winlangid, Write(), WriteHeader(), and WriteLength().

Referenced by GameStrings::Compile().

void LanguageWriter::WriteLength | ( | uint | length | ) |
| virtual

Write the length as a simple gamma.

Parameters

  length | The number to write.

Reimplemented in TranslationWriter.

Definition at line 934 of file strgen_base.cpp.

References Write().

Referenced by WriteLang().

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

- src/strgen/strgen.h
- src/strgen/strgen_base.cpp