XII Release 0.1.0
Loading...
Searching...
No Matches
xiiConsole Class Reference
Inheritance diagram for xiiConsole:
[legend]

Public Member Functions

Console Display
virtual void AddConsoleString (xiiStringView sText, xiiConsoleString::Type type=xiiConsoleString::Type::Default)
 Adds a string to the console.
 

Events

xiiEvent< const xiiConsoleEvent & > m_Events
 The console event variable, to attach to.
 
const xiiEvent< const xiiConsoleEvent & > & Events () const
 Grants access to subscribe and unsubscribe from console events.
 

Helpers

xiiMutex m_Mutex
 
xiiMutexGetMutex () const
 Returns the mutex that's used to prevent multi-threaded access.
 
static void SetMainConsole (xiiConsole *pConsole)
 
static xiiConsoleGetMainConsole ()
 

Command Interpreter

xiiSharedPtr< xiiCommandInterpreterm_pCommandInterpreter
 
void SetCommandInterpreter (const xiiSharedPtr< xiiCommandInterpreter > &pInterpreter)
 Replaces the current command interpreter.
 
const xiiSharedPtr< xiiCommandInterpreter > & GetCommandInterpreter () const
 Returns the currently used command interpreter.
 
virtual bool AutoComplete (xiiStringBuilder &ref_sText)
 Auto-completes the given text.
 
virtual void ExecuteCommand (xiiStringView sInput)
 Executes the given input string.
 

Input History

xiiInt32 m_iCurrentInputHistoryElement = -1
 
xiiStaticArray< xiiString, 16 > m_InputHistory
 
void AddToInputHistory (xiiStringView sText)
 Adds an item to the input history.
 
const xiiStaticArray< xiiString, 16 > & GetInputHistory () const
 Returns the current input history.
 
void RetrieveInputHistory (xiiInt32 iHistoryUp, xiiStringBuilder &ref_sResult)
 Replaces the input line by the next (or previous) history item.
 
xiiResult SaveInputHistory (xiiStringView sFile)
 Writes the current input history to a text file.
 
void LoadInputHistory (xiiStringView sFile)
 Reads the text file and appends all lines to the input history.
 

Member Function Documentation

◆ AddConsoleString()

void xiiConsole::AddConsoleString ( xiiStringView sText,
xiiConsoleString::Type type = xiiConsoleString::Type::Default )
virtual

Adds a string to the console.

The base class only broadcasts an event, but does not store the string anywhere.

Reimplemented in xiiQuakeConsole.

◆ AutoComplete()

bool xiiConsole::AutoComplete ( xiiStringBuilder & ref_sText)
virtual

Auto-completes the given text.

Returns true, if the string was modified in any way. Adds additional strings to the console output, if there are further auto-completion suggestions.

◆ ExecuteCommand()

void xiiConsole::ExecuteCommand ( xiiStringView sInput)
virtual

Executes the given input string.

The command is forwarded to the set command interpreter.

Reimplemented in xiiQuakeConsole.

◆ GetInputHistory()

const xiiStaticArray< xiiString, 16 > & xiiConsole::GetInputHistory ( ) const
inline

Returns the current input history.

Make sure to lock the console's mutex while working with the history.

◆ SetCommandInterpreter()

void xiiConsole::SetCommandInterpreter ( const xiiSharedPtr< xiiCommandInterpreter > & pInterpreter)
inline

Replaces the current command interpreter.

This base class doesn't set any default interpreter, but derived classes may do so.


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