OpenTTD Source 20241224-master-gee860a5c8e
strgen.h File Reference

Structures related to strgen. More...

#include "../language.h"
#include "../3rdparty/fmt/format.h"
#include <unordered_map>
#include <array>

Go to the source code of this file.

Data Structures

struct  Case
 Container for the different cases of a string. More...
 
struct  LangString
 Information about a single string. More...
 
struct  StringData
 Information about the currently known strings. More...
 
struct  StringReader
 Helper for reading strings. More...
 
struct  HeaderWriter
 Base class for writing the header, i.e. More...
 
struct  LanguageWriter
 Base class for all language writers. More...
 
struct  CmdPair
 
struct  ParsedCommandStruct
 

Macros

#define StrgenWarning(format_string, ...)   StrgenWarningI(fmt::format(FMT_STRING(format_string) __VA_OPT__(,) __VA_ARGS__))
 
#define StrgenError(format_string, ...)   StrgenErrorI(fmt::format(FMT_STRING(format_string) __VA_OPT__(,) __VA_ARGS__))
 
#define StrgenFatal(format_string, ...)   StrgenFatalI(fmt::format(FMT_STRING(format_string) __VA_OPT__(,) __VA_ARGS__))
 

Functions

const CmdStructTranslateCmdForCompare (const CmdStruct *a)
 
ParsedCommandStruct ExtractCommandString (const char *s, bool warnings)
 
void StrgenWarningI (const std::string &msg)
 
void StrgenErrorI (const std::string &msg)
 
void StrgenFatalI (const std::string &msg)
 
char * ParseWord (char **buf)
 

Variables

const char * _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.
 

Detailed Description

Structures related to strgen.

Definition in file strgen.h.

Macro Definition Documentation

◆ StrgenError

#define StrgenError (   format_string,
  ... 
)    StrgenErrorI(fmt::format(FMT_STRING(format_string) __VA_OPT__(,) __VA_ARGS__))

Definition at line 154 of file strgen.h.

◆ StrgenFatal

#define StrgenFatal (   format_string,
  ... 
)    StrgenFatalI(fmt::format(FMT_STRING(format_string) __VA_OPT__(,) __VA_ARGS__))

Definition at line 155 of file strgen.h.

◆ StrgenWarning

#define StrgenWarning (   format_string,
  ... 
)    StrgenWarningI(fmt::format(FMT_STRING(format_string) __VA_OPT__(,) __VA_ARGS__))

Definition at line 153 of file strgen.h.

Function Documentation

◆ ExtractCommandString()

ParsedCommandStruct ExtractCommandString ( const char *  s,
bool  warnings 
)

Definition at line 537 of file strgen_base.cpp.

◆ ParseWord()

char * ParseWord ( char **  buf)

Definition at line 280 of file strgen_base.cpp.

◆ StrgenErrorI()

void StrgenErrorI ( const std::string &  msg)

Definition at line 32 of file game_text.cpp.

◆ StrgenFatalI()

void StrgenFatalI ( const std::string &  msg)

Definition at line 38 of file game_text.cpp.

◆ StrgenWarningI()

void StrgenWarningI ( const std::string &  msg)

Definition at line 26 of file game_text.cpp.

◆ TranslateCmdForCompare()

const CmdStruct * TranslateCmdForCompare ( const CmdStruct a)

Definition at line 570 of file strgen_base.cpp.

Variable Documentation

◆ _cur_line

int _cur_line
extern

The current line we're parsing in the input file.

Definition at line 30 of file strgen_base.cpp.

Referenced by FatalErrorI(), StringReader::ParseFile(), and LanguageWriter::WriteLang().

◆ _errors

int _errors
extern

Definition at line 31 of file strgen_base.cpp.

◆ _file

const char* _file
extern

The filename of the input, so we can refer to it in errors/warnings.

Definition at line 29 of file strgen_base.cpp.

Referenced by FatalErrorI(), and StringReader::ParseFile().

◆ _lang

◆ _show_todo

int _show_todo

Definition at line 160 of file strgen.h.

◆ _warnings

int _warnings

Definition at line 160 of file strgen.h.