OpenTTD Source 20260206-master-g4d4e37dbf1
strgen_base.cpp File Reference

Tool to create computer readable (stand-alone) translation files. More...

Go to the source code of this file.

Data Structures

struct  ParsedCommandString

Functions

static ParsedCommandString ParseCommandString (StringConsumer &consumer)
static size_t TranslateArgumentIdx (size_t arg, size_t offset=0)
static uint32_t VersionHashStr (uint32_t hash, std::string_view s)
 Create a compound hash.
void EmitSingleChar (StringBuilder &builder, std::string_view param, char32_t value)
static std::pair< std::optional< size_t >, std::optional< size_t > > ParseRelNum (StringConsumer &consumer)
std::optional< std::string_view > ParseWord (StringConsumer &consumer)
static void EmitWordList (StringBuilder &builder, const std::vector< std::string > &words)
void EmitPlural (StringBuilder &builder, std::string_view param, char32_t)
void EmitGender (StringBuilder &builder, std::string_view param, char32_t)
static const CmdStructFindCmd (std::string_view s)
static uint8_t ResolveCaseName (std::string_view str)
ParsedCommandStruct ExtractCommandString (std::string_view s, bool)
const CmdStructTranslateCmdForCompare (const CmdStruct *a)
static bool CheckCommandsMatch (std::string_view a, std::string_view b, std::string_view name)
static void PutArgidxCommand (StringBuilder &builder)
static std::string PutCommandString (std::string_view str)

Variables

StrgenState _strgen
static bool _translated
 Whether the current language is not the master language.
static std::string_view _cur_ident
static ParsedCommandStruct _cur_pcs
static size_t _cur_argidx

Detailed Description

Tool to create computer readable (stand-alone) translation files.

Definition in file strgen_base.cpp.

Function Documentation

◆ CheckCommandsMatch()

bool CheckCommandsMatch ( std::string_view a,
std::string_view b,
std::string_view name )
static

Definition at line 429 of file strgen_base.cpp.

◆ EmitGender()

void EmitGender ( StringBuilder & builder,
std::string_view param,
char32_t value )

Definition at line 274 of file strgen_base.cpp.

◆ EmitPlural()

void EmitPlural ( StringBuilder & builder,
std::string_view param,
char32_t value )

Definition at line 219 of file strgen_base.cpp.

◆ EmitSingleChar()

void EmitSingleChar ( StringBuilder & builder,
std::string_view param,
char32_t value )

Definition at line 166 of file strgen_base.cpp.

◆ EmitWordList()

void EmitWordList ( StringBuilder & builder,
const std::vector< std::string > & words )
static

Definition at line 206 of file strgen_base.cpp.

◆ ExtractCommandString()

ParsedCommandStruct ExtractCommandString ( std::string_view s,
bool warnings )

Definition at line 382 of file strgen_base.cpp.

◆ FindCmd()

const CmdStruct * FindCmd ( std::string_view s)
static

Definition at line 313 of file strgen_base.cpp.

◆ ParseCommandString()

ParsedCommandString ParseCommandString ( StringConsumer & consumer)
static

Definition at line 328 of file strgen_base.cpp.

◆ ParseRelNum()

std::pair< std::optional< size_t >, std::optional< size_t > > ParseRelNum ( StringConsumer & consumer)
static

Definition at line 174 of file strgen_base.cpp.

◆ ParseWord()

std::optional< std::string_view > ParseWord ( StringConsumer & consumer)

Definition at line 188 of file strgen_base.cpp.

◆ PutArgidxCommand()

void PutArgidxCommand ( StringBuilder & builder)
static

Definition at line 642 of file strgen_base.cpp.

◆ PutCommandString()

std::string PutCommandString ( std::string_view str)
static

Definition at line 648 of file strgen_base.cpp.

◆ ResolveCaseName()

uint8_t ResolveCaseName ( std::string_view str)
static

Definition at line 320 of file strgen_base.cpp.

◆ TranslateArgumentIdx()

size_t TranslateArgumentIdx ( size_t arg,
size_t offset = 0 )
static

Definition at line 616 of file strgen_base.cpp.

◆ TranslateCmdForCompare()

const CmdStruct * TranslateCmdForCompare ( const CmdStruct * a)

Definition at line 411 of file strgen_base.cpp.

◆ VersionHashStr()

uint32_t VersionHashStr ( uint32_t hash,
std::string_view s )
static

Create a compound hash.

Parameters
hashThe hash to add the string hash to.
sThe string hash.
Returns
The new hash.

Definition at line 116 of file strgen_base.cpp.

Referenced by StringData::Version().

Variable Documentation

◆ _cur_argidx

size_t _cur_argidx
static

Definition at line 28 of file strgen_base.cpp.

◆ _cur_ident

std::string_view _cur_ident
static

Definition at line 26 of file strgen_base.cpp.

◆ _cur_pcs

ParsedCommandStruct _cur_pcs
static

Definition at line 27 of file strgen_base.cpp.

◆ _strgen

StrgenState _strgen

Definition at line 24 of file strgen_base.cpp.

◆ _translated

bool _translated
static

Whether the current language is not the master language.

Definition at line 25 of file strgen_base.cpp.

Referenced by LanguageWriter::WriteLang().