Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 3 (modified by landauf, 16 years ago) (diff)

CommandExecutor

TracNav(TracNav/TOC_Development)?

Description

CommandExecutor is a parser that calls a function defined by a string. To do this, CommandExecutor searches for a ConsoleCommand with the given name, parses the arguments and calls the command. CommandExecutor is also able to give hints to a function (what the function does) and to complete classnames, functionnames and arguments (see ArgumentCompleter).

All existing ConsoleCommands are stored in maps: Commands belonging to a class are stored in the Identifier of the class while shortcuts are stored in a map located in the CommandExecutor itself.

Another feature: CommandExecutor can evaluate a given command without calling it. To achieve this, CommandExecutor returns a CommandEvaluation, containing a pointer to the ConsoleCommand and all arguments stored in MultiTypes, already converted to the requested type. This allows you to execute an evaluated command really fast, which is of interest if you execute the same command over and over.

To execute more complex commands, CommandExecutor uses TclBind.

Usage

execute()

hint()

complete()

evaluate()

Illustration

The illustration shows how the CommandExecutor executes a ConsoleCommand by searching for the specified command in the shortcut list and the lists of all Identifiers and then executes the command by calling the Functor. At the end, it stores the returnvalue.

Attachments (1)

Download all attachments as: .zip