OpenTTD Source  14.0-beta3
strgen.cpp File Reference
#include "../stdafx.h"
#include "../core/endian_func.hpp"
#include "../core/mem_func.hpp"
#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)   "{}:{}: " s ": {}\n"
 

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. More...
 
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. More...
 

Detailed Description

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

Definition in file strgen.cpp.

Function Documentation

◆ 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 61 of file strgen.cpp.

Variable Documentation

◆ _opts

const OptionData _opts[]
static
Initial value:
= {
GETOPT_GENERAL('C', '\0', "-export-commands", ODF_NO_VALUE),
GETOPT_GENERAL('L', '\0', "-export-plurals", ODF_NO_VALUE),
GETOPT_GENERAL('P', '\0', "-export-pragmas", ODF_NO_VALUE),
GETOPT_NOVAL( 't', "--todo"),
GETOPT_NOVAL( 'w', "--warning"),
GETOPT_NOVAL( 'h', "--help"),
GETOPT_GENERAL('h', '?', nullptr, ODF_NO_VALUE),
GETOPT_VALUE( 's', "--source_dir"),
GETOPT_VALUE( 'd', "--dest_dir"),
}

Options of strgen.

Definition at line 314 of file strgen.cpp.

GETOPT_VALUE
#define GETOPT_VALUE(shortname, longname)
Short option with value.
Definition: getoptdata.h:76
GETOPT_NOVAL
#define GETOPT_NOVAL(shortname, longname)
Short option without value.
Definition: getoptdata.h:69
GETOPT_END
#define GETOPT_END()
Option terminator.
Definition: getoptdata.h:107
GETOPT_GENERAL
#define GETOPT_GENERAL(id, shortname, longname, flags)
General macro for creating an option.
Definition: getoptdata.h:62
ODF_NO_VALUE
@ ODF_NO_VALUE
A plain option (no value attached to it).
Definition: getoptdata.h:15