OpenTTD Source 20241224-master-gee860a5c8e
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, const std::string &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 62 of file console_internal.h.

Member Typedef Documentation

◆ AliasList

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

Definition at line 65 of file console_internal.h.

◆ CommandList

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

Definition at line 64 of file console_internal.h.

Member Function Documentation

◆ Aliases()

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

Definition at line 31 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 193 of file console.cpp.

References RemoveUnderscores().

Referenced by IConsoleCmdExec().

◆ AliasRegister()

void IConsole::AliasRegister ( const std::string &  name,
const std::string &  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 182 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 170 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

Definition at line 160 of file console.cpp.

References RemoveUnderscores().

◆ Commands()

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

Definition at line 25 of file console.cpp.


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