C4 Engine
C4 Engine API Documentation

class Command

Defined in:  C4Commands.h
The Command class stores a system command.
Definition

class Command : public MapElement<Command>, public Observable<Command, const char *>

Member Functions
Command::GetCommandName Returns the command name.
Constructor

Command(const char *name, ObserverType *observer);

Parameters
name A pointer to the name of the command.
observer An observer to invoke when the command is executed.
Description
The Command class encapsulates the name and function pointer for a system command. The name of a system command is a text string containing up to kMaxCommandNameLength characters. The observer parameter specifies an observer that is invoked when the command with that name is executed. The const char * event parameter passed to an observer points to the string following the command name and any whitespace on the command line when the command is executed. This string can be parsed by the observer and interpreted as command parameters.

Once a command has been created, it can be registered with the engine by calling the Engine::AddCommand function. A command is unregistered by simply destroying it.
Base Classes
MapElement<Command> Used internally to store all commands in a map.
Observable<Command, const char *> The observers of a command are invoked when the command is executed.
See Also

Engine::AddCommand

Engine::GetCommand

Engine::GetFirstCommand