OpenTTD Source 20260206-master-g4d4e37dbf1
IConsole Struct Reference

Public Types

typedef std::map< std::string, IConsoleCmdCommandList
typedef std::map< std::string, IConsoleAliasAliasList

Static Public Member Functions

static CommandList & Commands ()
static AliasList & Aliases ()
static void CmdRegister (const std::string &name, IConsoleCmdProc *proc, IConsoleHook *hook=nullptr)
 Register a new command to be used in the console.
static IConsoleCmdCmdGet (const std::string &name)
 Find the command pointed to by its string.
static void AliasRegister (const std::string &name, std::string_view cmd)
 Register a an alias for an already existing command in the console.
static IConsoleAliasAliasGet (const std::string &name)
 Find the alias pointed to by its string.

Detailed Description

Definition at line 61 of file console_internal.h.

Member Typedef Documentation

◆ AliasList

typedef std::map<std::string, IConsoleAlias> IConsole::AliasList

Definition at line 64 of file console_internal.h.

◆ CommandList

typedef std::map<std::string, IConsoleCmd> IConsole::CommandList

Definition at line 63 of file console_internal.h.

Member Function Documentation

◆ Aliases()

IConsole::AliasList & IConsole::Aliases ( )
static

Definition at line 32 of file console.cpp.

◆ AliasGet()

IConsoleAlias * IConsole::AliasGet ( const std::string & name)
static

Find the alias pointed to by its string.

Parameters
namealias to be found
Returns
return Aliasstruct of the found alias, or nullptr on failure

Definition at line 171 of file console.cpp.

References RemoveUnderscores().

Referenced by IConsoleCmdExec().

◆ AliasRegister()

void IConsole::AliasRegister ( const std::string & name,
std::string_view cmd )
static

Register a an alias for an already existing command in the console.

Parameters
namename of the alias that will be used
cmdname of the command that 'name' will be alias of

Definition at line 160 of file console.cpp.

References CC_ERROR, IConsolePrint(), and RemoveUnderscores().

◆ CmdGet()

IConsoleCmd * IConsole::CmdGet ( const std::string & name)
static

Find the command pointed to by its string.

Parameters
namecommand to be found
Returns
return Cmdstruct of the found command, or nullptr on failure

Definition at line 148 of file console.cpp.

References RemoveUnderscores().

Referenced by IConsoleCmdExec().

◆ CmdRegister()

void IConsole::CmdRegister ( const std::string & name,
IConsoleCmdProc * proc,
IConsoleHook * hook = nullptr )
static

Register a new command to be used in the console.

Parameters
namename of the command that will be used
procfunction that will be called upon execution of command
hookCallback to check whether the command is allowed to run in the current context.

Definition at line 138 of file console.cpp.

References RemoveUnderscores().

◆ Commands()

IConsole::CommandList & IConsole::Commands ( )
static

Definition at line 26 of file console.cpp.


The documentation for this struct was generated from the following files: