OpenTTD Source  20241121-master-g67a0fccfad
strgen_base.cpp File Reference

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

#include "../stdafx.h"
#include "../core/alloc_func.hpp"
#include "../core/endian_func.hpp"
#include "../core/mem_func.hpp"
#include "../error_func.h"
#include "../string_func.h"
#include "../table/control_codes.h"
#include "strgen.h"
#include "../table/strgen_tables.h"
#include "../safeguards.h"

Go to the source code of this file.

Data Structures

struct  Buffer
 The buffer for writing a single string. More...
 

Functions

static const CmdStructParseCommandString (const char **str, std::string &param, int *argno, int *casei)
 
size_t Utf8Validate (const char *s)
 
void EmitSingleChar (Buffer *buffer, char *buf, int value)
 
bool ParseRelNum (char **buf, int *value, int *offset)
 
char * ParseWord (char **buf)
 
static int TranslateArgumentIdx (int arg, int offset=0)
 
static void EmitWordList (Buffer *buffer, const std::vector< const char * > &words, uint nw)
 
void EmitPlural (Buffer *buffer, char *buf, int)
 
void EmitGender (Buffer *buffer, char *buf, int)
 
static const CmdStructFindCmd (const char *s, int len)
 
static uint ResolveCaseName (const char *str, size_t len)
 
ParsedCommandStruct ExtractCommandString (const char *s, bool)
 
const CmdStructTranslateCmdForCompare (const CmdStruct *a)
 
static bool CheckCommandsMatch (const char *a, const char *b, const char *name)
 
static void StripTrailingWhitespace (std::string &str)
 
static void PutArgidxCommand (Buffer *buffer)
 
static void PutCommandString (Buffer *buffer, const char *str)
 

Variables

static bool _translated
 Whether the current language is not the master language.
 
static bool _translation
 Is the current file actually a translation or not.
 
const char * _file = "(unknown file)"
 The filename of the input, so we can refer to it in errors/warnings.
 
int _cur_line
 The current line we're parsing in the input file.
 
int _errors
 
int _warnings
 
int _show_todo
 
LanguagePackHeader _lang
 Header information about a language.
 
static const char * _cur_ident
 
static ParsedCommandStruct _cur_pcs
 
static int _cur_argidx
 

Detailed Description

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

Definition in file strgen_base.cpp.