OpenTTD Source: IConsole Struct Reference

OpenTTD Source 15.3

Public Types | Static Public Member Functions
IConsole Struct Reference

## Public Types
typedef std::map< std::string, IConsoleCmd > | CommandList
typedef std::map< std::string, IConsoleAlias > | AliasList

## 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 IConsoleCmd * | CmdGet (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 IConsoleAlias * | AliasGet (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

  name | alias to be found

Returns
  return Aliasstruct of the found alias, or nullptr on failure

Definition at line 170 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

  name | name of the alias that will be used
  cmd | name of the command that 'name' will be alias of

Definition at line 159 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

  name | command to be found

Returns
  return Cmdstruct of the found command, or nullptr on failure

Definition at line 147 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

  name | name of the command that will be used
  proc | function that will be called upon execution of command

Definition at line 137 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:

- src/console_internal.h
- src/console.cpp