Orxonox: orxonox::CommandExecutor Class Reference

# orxonox::CommandExecutor Class Reference

`#include <src/core/CommandExecutor.h>`

List of all members.

## Static Public Member Functions

static ConsoleCommand & | addConsoleCommandShortcut (ConsoleCommand *command, bool bDeleteAtExit=false)
static std::string | complete (const std::string &command)
static void | destroyExternalCommands ()
static CommandEvaluation | evaluate (const std::string &command)
static bool | execute (const std::string &command, bool useTcl=true)
static ConsoleCommand * | getConsoleCommandShortcut (const std::string &name)
| Returns the executor of a console command shortcut with given name.
static const std::map < std::string, ConsoleCommand * > & | getConsoleCommandShortcutMap ()
| Returns the map that stores all console commands.
static std::map< std::string, ConsoleCommand * > ::const_iterator | getConsoleCommandShortcutMapBegin ()
| Returns a const_iterator to the beginning of the map that stores all console commands.
static std::map< std::string, ConsoleCommand * > ::const_iterator | getConsoleCommandShortcutMapEnd ()
| Returns a const_iterator to the end of the map that stores all console commands.
static const CommandEvaluation & | getLastEvaluation ()
static ConsoleCommand * | getLowercaseConsoleCommandShortcut (const std::string &name)
| Returns the executor of a console command shortcut with given name in lowercase.
static const std::map < std::string, ConsoleCommand * > & | getLowercaseConsoleCommandShortcutMap ()
| Returns the map that stores all console commands with their names in lowercase.
static std::map< std::string, ConsoleCommand * > ::const_iterator | getLowercaseConsoleCommandShortcutMapBegin ()
| Returns a const_iterator to the beginning of the map that stores all console commands with their names in lowercase.
static std::map< std::string, ConsoleCommand * > ::const_iterator | getLowercaseConsoleCommandShortcutMapEnd ()
| Returns a const_iterator to the end of the map that stores all console commands with their names in lowercase.
static MultiType | getReturnValue ()
static std::string | getReturnValueString ()
static std::string | hint (const std::string &command)

## Private Member Functions

| CommandExecutor (const CommandExecutor &other)
| CommandExecutor ()
| ~CommandExecutor ()

## Static Private Member Functions

static unsigned int | argumentsFinished ()
static unsigned int | argumentsGiven ()
static void | createArgumentCompletionList (ConsoleCommand *command, unsigned int param)
static void | createListOfPossibleArguments (const std::string &fragment, ConsoleCommand *command, unsigned int param)
static void | createListOfPossibleFunctions (const std::string &fragment, Identifier *identifier=0)
static void | createListOfPossibleIdentifiers (const std::string &fragment)
static bool | enoughArgumentsGiven (ConsoleCommand *command)
static std::string | getArgument (unsigned int index)
static std::string | getCommonBegin (const ArgumentCompletionList &list)
static std::string | getCommonBegin (const std::list< std::pair< const std::string *, const std::string * > > &list)
static CommandEvaluation & | getEvaluation ()
static CommandExecutor & | getInstance ()
static std::string | getLastArgument ()
static std::string | getPossibleArgument (const std::string &name, ConsoleCommand *command, unsigned int param)
static ConsoleCommand * | getPossibleCommand (const std::string &name, Identifier *identifier=0)
static Identifier * | getPossibleIdentifier (const std::string &name)
static void | parse (const std::string &command, bool bInitialize=true)
static void | parseIfNeeded (const std::string &command)

## Private Attributes

std::set< ConsoleCommand * > | consoleCommandExternals_
std::map< std::string, ConsoleCommand * > | consoleCommandShortcuts_
std::map< std::string, ConsoleCommand * > | consoleCommandShortcuts_LC_
CommandEvaluation | evaluation_

## Constructor & Destructor Documentation

orxonox::CommandExecutor::CommandExecutor | ( |  | ) | `[inline, private]`

orxonox::CommandExecutor::CommandExecutor | ( | const CommandExecutor & | other | ) | `[private]`

orxonox::CommandExecutor::~CommandExecutor | ( |  | ) | `[inline, private]`

## Member Function Documentation

ConsoleCommand & orxonox::CommandExecutor::addConsoleCommandShortcut | ( | ConsoleCommand * | command,
|  | bool | bDeleteAtExit = `false` |
| ) |  |  | `[static]`

References consoleCommandExternals_, consoleCommandShortcuts_, consoleCommandShortcuts_LC_, COUT, getInstance(), orxonox::getLowercase(), and orxonox::Executor::getName().

Referenced by orxonox::GSRoot::activate(), orxonox::GSMainMenu::activate(), orxonox::GSLevel::activate(), orxonox::GSIOConsole::activate(), orxonox::GSGraphics::activate(), orxonox::Identifier::addConsoleCommand(), and orxonox::GraphicsManager::GraphicsManager().

unsigned int orxonox::CommandExecutor::argumentsFinished | ( |  | ) | `[static, private]`

References argumentsGiven().

unsigned int orxonox::CommandExecutor::argumentsGiven | ( |  | ) | `[static, private]`

References orxonox::CommandEvaluation::command_, orxonox::CommandEvaluation::commandTokens_, getEvaluation(), and orxonox::SubString::size().

Referenced by argumentsFinished(), createArgumentCompletionList(), enoughArgumentsGiven(), getLastArgument(), and parse().

std::string orxonox::CommandExecutor::complete | ( | const std::string & | command | ) | `[static]`

References orxonox::CommandEvaluation::complete(), getEvaluation(), and parseIfNeeded().

Referenced by orxonox::Shell::hintandcomplete(), and orxonox::GSDedicated::inputThread().

void orxonox::CommandExecutor::createArgumentCompletionList | ( | ConsoleCommand * | command,
|  | unsigned int | param |
| ) |  |  | `[static, private]`

References argumentsGiven(), orxonox::ConsoleCommand::createArgumentCompletionList(), orxonox::CommandEvaluation::functionclass_, getArgument(), and getEvaluation().

Referenced by createListOfPossibleArguments(), and getPossibleArgument().

void orxonox::CommandExecutor::createListOfPossibleArguments | ( | const std::string & | fragment,
|  | ConsoleCommand * | command,
|  | unsigned int | param |
| ) |  |  | `[static, private]`

References createArgumentCompletionList(), orxonox::ConsoleCommand::getArgumentCompletionListBegin(), orxonox::ConsoleCommand::getArgumentCompletionListEnd(), getEvaluation(), orxonox::getLowercase(), orxonox::CommandEvaluation::listOfPossibleArguments_, and orxonox::lowercase().

Referenced by parse().

void orxonox::CommandExecutor::createListOfPossibleFunctions | ( | const std::string & | fragment,
|  | Identifier * | identifier = `0` |
| ) |  |  | `[static, private]`

References getEvaluation(), orxonox::getLowercase(), orxonox::Identifier::getLowercaseConsoleCommandMapBegin(), orxonox::Identifier::getLowercaseConsoleCommandMapEnd(), getLowercaseConsoleCommandShortcutMapBegin(), getLowercaseConsoleCommandShortcutMapEnd(), orxonox::CommandEvaluation::listOfPossibleFunctions_, and orxonox::lowercase().

Referenced by parse().

void orxonox::CommandExecutor::createListOfPossibleIdentifiers | ( | const std::string & | fragment | ) | `[static, private]`

References getEvaluation(), orxonox::getLowercase(), orxonox::Identifier::getLowercaseIdentifierMapBegin(), orxonox::Identifier::getLowercaseIdentifierMapEnd(), orxonox::CommandEvaluation::listOfPossibleIdentifiers_, and orxonox::lowercase().

Referenced by parse().

void orxonox::CommandExecutor::destroyExternalCommands | ( |  | ) | `[static]`

References consoleCommandExternals_, and getInstance().

Referenced by orxonox::Core::~Core().

bool orxonox::CommandExecutor::enoughArgumentsGiven | ( | ConsoleCommand * | command | ) | `[static, private]`

References argumentsGiven(), getEvaluation(), and orxonox::Executor::getParamCount().

Referenced by parse().

CommandEvaluation orxonox::CommandExecutor::evaluate | ( | const std::string & | command | ) | `[static]`

References orxonox::CommandEvaluation::evaluateParams(), getEvaluation(), and parse().

Referenced by orxonox::Button::parse().

bool orxonox::CommandExecutor::execute | ( | const std::string & | command,
|  | bool | useTcl = `true` |
| ) |  |  | `[static]`

References orxonox::TclBind::eval(), orxonox::CommandEvaluation::execute(), getEvaluation(), and parseIfNeeded().

Referenced by orxonox::TclThreadManager::evalQuery(), orxonox::Shell::execute(), orxonox::executeDelayedCommand(), orxonox::GSDedicated::processQueue(), orxonox::source(), orxonox::TclBind::tcl_execute(), orxonox::TclBind::tcl_query(), tolua_Core_orxonox_CommandExecutor_execute00(), orxonox::GSIOConsole::update(), orxonox::TclThreadManager::update(), and orxonox::BigExplosion::~BigExplosion().

std::string orxonox::CommandExecutor::getArgument | ( | unsigned int | index | ) | `[static, private]`

References orxonox::CommandEvaluation::commandTokens_, and getEvaluation().

Referenced by createArgumentCompletionList(), getLastArgument(), and parse().

std::string orxonox::CommandExecutor::getCommonBegin | ( | const ArgumentCompletionList & | list | ) | `[static, private]`

std::string orxonox::CommandExecutor::getCommonBegin | ( | const std::list< std::pair< const std::string *, const std::string * > > & | list | ) | `[static, private]`

Referenced by parse().

ConsoleCommand * orxonox::CommandExecutor::getConsoleCommandShortcut | ( | const std::string & | name | ) | `[static]`

Returns the executor of a console command shortcut with given name.

name The name of the requested console command shortcut

Returns:
  The executor of the requested console command shortcut

References consoleCommandShortcuts_, and getInstance().

static const std::map<std::string, ConsoleCommand*>& orxonox::CommandExecutor::getConsoleCommandShortcutMap | ( |  | ) | `[inline, static]`

Returns the map that stores all console commands.

Returns:
  The const_iterator

References consoleCommandShortcuts_, and getInstance().

static std::map<std::string, ConsoleCommand*>::const_iterator orxonox::CommandExecutor::getConsoleCommandShortcutMapBegin | ( |  | ) | `[inline, static]`

Returns a const_iterator to the beginning of the map that stores all console commands.

Returns:
  The const_iterator

References consoleCommandShortcuts_, and getInstance().

static std::map<std::string, ConsoleCommand*>::const_iterator orxonox::CommandExecutor::getConsoleCommandShortcutMapEnd | ( |  | ) | `[inline, static]`

Returns a const_iterator to the end of the map that stores all console commands.

Returns:
  The const_iterator

References consoleCommandShortcuts_, and getInstance().

CommandEvaluation & orxonox::CommandExecutor::getEvaluation | ( |  | ) | `[static, private]`

References evaluation_, and getInstance().

Referenced by argumentsGiven(), complete(), createArgumentCompletionList(), createListOfPossibleArguments(), createListOfPossibleFunctions(), createListOfPossibleIdentifiers(), enoughArgumentsGiven(), evaluate(), execute(), getArgument(), getReturnValue(), getReturnValueString(), hint(), parse(), and parseIfNeeded().

CommandExecutor & orxonox::CommandExecutor::getInstance | ( |  | ) | `[static, private]`

Referenced by addConsoleCommandShortcut(), destroyExternalCommands(), getConsoleCommandShortcut(), getConsoleCommandShortcutMap(), getConsoleCommandShortcutMapBegin(), getConsoleCommandShortcutMapEnd(), getEvaluation(), getLastEvaluation(), getLowercaseConsoleCommandShortcut(), getLowercaseConsoleCommandShortcutMap(), getLowercaseConsoleCommandShortcutMapBegin(), and getLowercaseConsoleCommandShortcutMapEnd().

std::string orxonox::CommandExecutor::getLastArgument | ( |  | ) | `[static, private]`

References argumentsGiven(), and getArgument().

Referenced by parse().

const CommandEvaluation & orxonox::CommandExecutor::getLastEvaluation | ( |  | ) | `[static]`

References evaluation_, and getInstance().

Referenced by orxonox::TclThreadManager::evalQuery(), and orxonox::TclBind::tcl_query().

ConsoleCommand * orxonox::CommandExecutor::getLowercaseConsoleCommandShortcut | ( | const std::string & | name | ) | `[static]`

Returns the executor of a console command shortcut with given name in lowercase.

name The name of the requested console command shortcut in lowercase

Returns:
  The executor of the requested console command shortcut

References consoleCommandShortcuts_LC_, and getInstance().

static const std::map<std::string, ConsoleCommand*>& orxonox::CommandExecutor::getLowercaseConsoleCommandShortcutMap | ( |  | ) | `[inline, static]`

Returns the map that stores all console commands with their names in lowercase.

Returns:
  The const_iterator

References consoleCommandShortcuts_LC_, and getInstance().

Referenced by getPossibleCommand().

static std::map<std::string, ConsoleCommand*>::const_iterator orxonox::CommandExecutor::getLowercaseConsoleCommandShortcutMapBegin | ( |  | ) | `[inline, static]`

Returns a const_iterator to the beginning of the map that stores all console commands with their names in lowercase.

Returns:
  The const_iterator

References consoleCommandShortcuts_LC_, and getInstance().

Referenced by createListOfPossibleFunctions().

static std::map<std::string, ConsoleCommand*>::const_iterator orxonox::CommandExecutor::getLowercaseConsoleCommandShortcutMapEnd | ( |  | ) | `[inline, static]`

Returns a const_iterator to the end of the map that stores all console commands with their names in lowercase.

Returns:
  The const_iterator

References consoleCommandShortcuts_LC_, and getInstance().

Referenced by createListOfPossibleFunctions(), and getPossibleCommand().

std::string orxonox::CommandExecutor::getPossibleArgument | ( | const std::string & | name,
|  | ConsoleCommand * | command,
|  | unsigned int | param |
| ) |  |  | `[static, private]`

References createArgumentCompletionList(), orxonox::ConsoleCommand::getArgumentCompletionListBegin(), orxonox::ConsoleCommand::getArgumentCompletionListEnd(), orxonox::getLowercase(), and orxonox::lowercase().

Referenced by parse().

ConsoleCommand * orxonox::CommandExecutor::getPossibleCommand | ( | const std::string & | name,
|  | Identifier * | identifier = `0` |
| ) |  |  | `[static, private]`

References orxonox::getLowercase(), orxonox::Identifier::getLowercaseConsoleCommandMap(), orxonox::Identifier::getLowercaseConsoleCommandMapEnd(), getLowercaseConsoleCommandShortcutMap(), getLowercaseConsoleCommandShortcutMapEnd(), and orxonox::lowercase().

Referenced by parse().

Identifier * orxonox::CommandExecutor::getPossibleIdentifier | ( | const std::string & | name | ) | `[static, private]`

References orxonox::getLowercase(), orxonox::Identifier::getLowercaseIdentifierMap(), orxonox::Identifier::getLowercaseIdentifierMapEnd(), and orxonox::lowercase().

Referenced by parse().

MultiType orxonox::CommandExecutor::getReturnValue | ( |  | ) | `[static]`

References getEvaluation(), and orxonox::CommandEvaluation::getReturnvalue().

std::string orxonox::CommandExecutor::getReturnValueString | ( |  | ) | `[static]`

References getEvaluation(), orxonox::CommandEvaluation::getReturnvalue(), and orxonox::MultiType::getString().

Referenced by tolua_Core_orxonox_CommandExecutor_getReturnValueString00().

std::string orxonox::CommandExecutor::hint | ( | const std::string & | command | ) | `[static]`

References getEvaluation(), orxonox::CommandEvaluation::hint(), and parseIfNeeded().

Referenced by orxonox::Shell::hintandcomplete(), and orxonox::GSDedicated::inputThread().

void orxonox::CommandExecutor::parse | ( | const std::string & | command,
|  | bool | bInitialize = `true` |
| ) |  |  | `[static, private]`

References AddLanguageEntry, orxonox::CommandEvaluation::argument_, argumentsGiven(), orxonox::CommandEvaluation::bCommandChanged_, orxonox::CommandEvaluation::command_, orxonox::CommandEvaluation::commandTokens_, createListOfPossibleArguments(), createListOfPossibleFunctions(), createListOfPossibleIdentifiers(), orxonox::CommandState::Empty, enoughArgumentsGiven(), orxonox::CommandState::Error, orxonox::CommandEvaluation::errorMessage_, orxonox::CommandState::Finished, orxonox::CommandState::Function, orxonox::CommandEvaluation::function_, orxonox::CommandEvaluation::functionclass_, getArgument(), getCommonBegin(), getEvaluation(), getLastArgument(), GetLocalisation, orxonox::getLowercase(), orxonox::Identifier::getName(), orxonox::Executor::getName(), getPossibleArgument(), getPossibleCommand(), getPossibleIdentifier(), orxonox::CommandEvaluation::initialize(), orxonox::CommandEvaluation::listOfPossibleArguments_, orxonox::CommandEvaluation::listOfPossibleFunctions_, orxonox::CommandEvaluation::listOfPossibleIdentifiers_, orxonox::CommandState::ParamPreparation, orxonox::CommandState::Params, orxonox::CommandEvaluation::possibleArgument_, orxonox::CommandState::ShortcutOrIdentifier, orxonox::SubString::split(), orxonox::CommandEvaluation::state_, orxonox::CommandState::Uninitialized, and orxonox::SubString::WhiteSpaces.

Referenced by evaluate(), and parseIfNeeded().

void orxonox::CommandExecutor::parseIfNeeded | ( | const std::string & | command | ) | `[static, private]`

References orxonox::CommandEvaluation::bNewCommand_, getEvaluation(), parse(), and orxonox::CommandState::Uninitialized.

Referenced by complete(), execute(), and hint().

## Member Data Documentation

std::set<ConsoleCommand*> orxonox::CommandExecutor::consoleCommandExternals_`[private]`

Referenced by addConsoleCommandShortcut(), and destroyExternalCommands().

std::map<std::string, ConsoleCommand*> orxonox::CommandExecutor::consoleCommandShortcuts_`[private]`

Referenced by addConsoleCommandShortcut(), getConsoleCommandShortcut(), getConsoleCommandShortcutMap(), getConsoleCommandShortcutMapBegin(), and getConsoleCommandShortcutMapEnd().

std::map<std::string, ConsoleCommand*> orxonox::CommandExecutor::consoleCommandShortcuts_LC_`[private]`

Referenced by addConsoleCommandShortcut(), getLowercaseConsoleCommandShortcut(), getLowercaseConsoleCommandShortcutMap(), getLowercaseConsoleCommandShortcutMapBegin(), and getLowercaseConsoleCommandShortcutMapEnd().

CommandEvaluation orxonox::CommandExecutor::evaluation_`[private]`

Referenced by getEvaluation(), and getLastEvaluation().

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

- src/core/CommandExecutor.h
- src/core/CommandExecutor.cc