mElite  1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Static Public Member Functions | List of all members
Console Class Reference

Handles command parsing for a console and draws the console using OpenGL. More...

#include <Console.h>

Static Public Member Functions

static std::string getCommand (std::string commandString)
 Retrieve a command from a command line input.
 
static char getSingleCharacterOption (std::string commandString)
 Retrieve a single character option from a command line input.
 
static std::string getOption (std::string commandString)
 Retrieve an option from a command line input.
 

Detailed Description

Handles command parsing for a console and draws the console using OpenGL.

Provides some static functions to parse lines that are sent to the program as command lines. It contains a container that stores the last commands and can search through them. Also it can be tested if a command starts with a given string to implement auto filling for text input.

Definition at line 17 of file Console.h.

Member Function Documentation

string Console::getCommand ( std::string  commandString)
static

Retrieve a command from a command line input.

Static function that returns the first word of an command string. If the command string only contains one word, this is returned. Only space works as separator for words.

Parameters
commandStringA string that should be parsed
Returns
The command containing the commandString

Definition at line 18 of file Console.cpp.

string Console::getOption ( std::string  commandString)
static

Retrieve an option from a command line input.

Returns the first option of an command. This option begins after the first space. The option must not contain any space characters.

Parameters
commandStringThe string whose options should be extracted.
Returns
The first option in the string

Definition at line 51 of file Console.cpp.

char Console::getSingleCharacterOption ( std::string  commandString)
static

Retrieve a single character option from a command line input.

Static function that gets one single character option of any command. It simply searchges the first space and returns the next character. If we only get pointers to character arrays which last item is zero, this will work. If the command string contains more characters they are ignored.

Parameters
commandStringThe string whose options are searched
Returns
The option character.

Definition at line 36 of file Console.cpp.


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