Console::Console Class Reference

#include <Console.h>

List of all members.

Public Member Functions

 Console (std::string configFile, bool autolog=false)
 Console (bool autolog=false)
void addAction (const std::string &name, Action *action)
void addVariable (const std::string &name, Variable *variable)
void removeAction (const std::string &name)
void removeVariable (const std::string &name)
void output (const std::string &str)
void render () const
void parseStream (std::istream &is)
bool handleBinding (char c)
void handleChar (char c)
void handleBackspace ()
void handleEnter ()
void handleTab ()
void handleDownArrow ()
void handleUpArrow ()
void saveLog (const std::string &filename)
void loadConfiguration (const std::string &filename)


Detailed Description

The Console class represent a console where specified commands can execute actions (represented by an Action object) and set variables (represented by a Variable object). The console has a text based interface, and it can be rendered to the screen using OpenGL. The console window rendered consists of two parts: a large output area and an input text area at the bottom.

The console has 5 built-in commands:
"help" - lists all action commands currently present in the console.
"list" - lists all variables commands currently present in the console.
"save <filename>" - saves all variables currently present in the console and their values to the specified file.
"load <filename>" - loads a specified configuration file, and executes all lines in the configuration as a command.
"bind" - lists all bindings (between a character and a command) currently present in the console.
"bind <char>" - outputs the command associated with the specified character.
"bind <char> <command>" - make a binding between the specified character and the specified command. <command> can consists of a list of command parameters in addition to the command itself.


Constructor & Destructor Documentation

Console::Console::Console std::string  configFile,
bool  autolog = false
 

Constructs a console and executes the commands specified in the config file.

Parameters:
configFile the file with the commands to be executed.
autolog whether the console shall log all outputs to a log file.

Console::Console::Console bool  autolog = false  ) 
 

Constructs a console.

Parameters:
autolog whether the console shall log all outputs to a log file.


Member Function Documentation

void Console::Console::addAction const std::string &  name,
Action action
 

Adds an action to the console.

Parameters:
name the command name associated with the added action.
action the action to be added.

void Console::Console::addVariable const std::string &  name,
Variable variable
 

Adds a variable to the console.

Parameters:
name the command name associated with the added variable.
variable the variable to be added.

void Console::Console::handleBackspace  ) 
 

Handles a backspace keystroke.

bool Console::Console::handleBinding char  c  ) 
 

Handles a binding for a specified character. The binding acts as a mapping between a single character and a command. A binding can be activated using the built-in console command "bind".

Parameters:
c the bind character.
Returns:
true if there exists a binding for the specified character.

void Console::Console::handleChar char  c  ) 
 

Handles a single character keystroke.

Parameters:
c the input character.

void Console::Console::handleDownArrow  ) 
 

Handles a down arrow keystroke.

void Console::Console::handleEnter  ) 
 

Handles an enter keystroke.

void Console::Console::handleTab  ) 
 

Handles a tab keystroke.

void Console::Console::handleUpArrow  ) 
 

Handles an up arrow keystroke.

void Console::Console::loadConfiguration const std::string &  filename  ) 
 

Loads a configuration from a specified file, and executes all lines in the configuration as a command.

Parameters:
filename the name of the file to load the configuration.

void Console::Console::output const std::string &  str  ) 
 

Outputs a string in the console window.

Parameters:
str the string to output.

void Console::Console::parseStream std::istream &  is  ) 
 

Parses an input stream into lines, and executes all lines as a command.

Parameters:
is the input stream to be parsed.

void Console::Console::removeAction const std::string &  name  ) 
 

Removes an action from the console.

Parameters:
name the command name associated with the action to remove.

void Console::Console::removeVariable const std::string &  name  ) 
 

Removes a variable from the console.

Parameters:
name the command name associated with the variable to remove.

void Console::Console::render  )  const
 

Renders the console to the screen using OpenGL.

void Console::Console::saveLog const std::string &  filename  ) 
 

Saves the log to a file.

Parameters:
filename the name of the file to save the log.


The documentation for this class was generated from the following file:
Generated on Fri Jun 16 08:42:48 2006 for GPU Thesis by  doxygen 1.4.6-NO