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

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

#include "../stdafx.h"
#include "../error_func.h"
#include "../string_func.h"
#include "../strings_type.h"
#include "../misc/getoptdata.h"
#include "../table/control_codes.h"
#include "../3rdparty/fmt/std.h"
#include "strgen.h"
#include <filesystem>
#include <fstream>
#include "../table/strgen_tables.h"
#include "../safeguards.h"

Go to the source code of this file.

Data Structures

struct  FileStringReader
 A reader that simply reads using fopen. More...
struct  FileWriter
 Yes, simply writing to a file. More...
struct  HeaderFileWriter
struct  LanguageFileWriter
 Class for writing a language to disk. More...

Macros

#define LINE_NUM_FMT(s)

Functions

void StrgenWarningI (const std::string &msg)
void StrgenErrorI (const std::string &msg)
void StrgenFatalI (const std::string &msg)
void FatalErrorI (const std::string &msg)
 Error handling for fatal non-user errors.
static bool CompareFiles (const std::filesystem::path &path1, const std::filesystem::path &path2)
int CDECL main (int argc, char *argv[])

Variables

static const OptionData _opts []
 Options of strgen.

Detailed Description

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

Definition in file strgen.cpp.

Macro Definition Documentation

◆ LINE_NUM_FMT

#define LINE_NUM_FMT ( s)
Value:
"{}:{}: " s ": {}\n"

Definition at line 31 of file strgen.cpp.

Function Documentation

◆ CompareFiles()

bool CompareFiles ( const std::filesystem::path & path1,
const std::filesystem::path & path2 )
static

Definition at line 171 of file strgen.cpp.

◆ FatalErrorI()

void FatalErrorI ( const std::string & msg)

Error handling for fatal non-user errors.

Parameters
strthe string to print.
Note
Does NEVER return.

Error handling for fatal non-user errors.

Parameters
sFormat string.
Note
Function does not return.

Definition at line 59 of file strgen.cpp.

References VideoDriver::GetInstance(), CrashLog::SetErrorMessage(), and ShowOSErrorBox().

◆ main()

int CDECL main ( int argc,
char * argv[] )

Definition at line 321 of file strgen.cpp.

◆ StrgenErrorI()

void StrgenErrorI ( const std::string & msg)

Definition at line 44 of file strgen.cpp.

◆ StrgenFatalI()

void StrgenFatalI ( const std::string & msg)

Definition at line 50 of file strgen.cpp.

◆ StrgenWarningI()

void StrgenWarningI ( const std::string & msg)

Definition at line 34 of file strgen.cpp.

Variable Documentation

◆ _opts

const OptionData _opts[]
static
Initial value:
= {
{ .type = ODF_NO_VALUE, .id = 'C', .longname = "-export-commands" },
{ .type = ODF_NO_VALUE, .id = 'L', .longname = "-export-plurals" },
{ .type = ODF_NO_VALUE, .id = 'P', .longname = "-export-pragmas" },
{ .type = ODF_NO_VALUE, .id = 't', .shortname = 't', .longname = "--todo" },
{ .type = ODF_NO_VALUE, .id = 'w', .shortname = 'w', .longname = "--warning" },
{ .type = ODF_NO_VALUE, .id = 'h', .shortname = 'h', .longname = "--help" },
{ .type = ODF_NO_VALUE, .id = 'h', .shortname = '?' },
{ .type = ODF_HAS_VALUE, .id = 's', .shortname = 's', .longname = "--source_dir" },
{ .type = ODF_HAS_VALUE, .id = 'd', .shortname = 'd', .longname = "--dest_dir" },
}
@ ODF_NO_VALUE
A plain option (no value attached to it).
Definition getoptdata.h:15
@ ODF_HAS_VALUE
An option with a value.
Definition getoptdata.h:16

Options of strgen.

Definition at line 309 of file strgen.cpp.