Plasma Engine  2.0
Loading...
Searching...
No Matches
plConsole Class Reference
Inheritance diagram for plConsole:

Public Member Functions

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

Events

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

Helpers

plMutex m_Mutex
 
plMutexGetMutex () const
 Returns the mutex that's used to prevent multi-threaded access.
 
static void SetMainConsole (plConsole *pConsole)
 
static plConsoleGetMainConsole ()
 

Command Interpreter

plSharedPtr< plCommandInterpreterm_pCommandInterpreter
 
void SetCommandInterpreter (const plSharedPtr< plCommandInterpreter > &pInterpreter)
 Replaces the current command interpreter.
 
const plSharedPtr< plCommandInterpreter > & GetCommandInterpreter () const
 Returns the currently used command interpreter.
 
virtual bool AutoComplete (plStringBuilder &ref_sText)
 Auto-completes the given text.
 
virtual void ExecuteCommand (plStringView sInput)
 Executes the given input string.
 

Input History

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

Member Function Documentation

◆ AddConsoleString()

void plConsole::AddConsoleString ( plStringView sText,
plConsoleString::Type type = plConsoleString::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 plQuakeConsole.

◆ AutoComplete()

bool plConsole::AutoComplete ( plStringBuilder & 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 plConsole::ExecuteCommand ( plStringView sInput)
virtual

Executes the given input string.

The command is forwarded to the set command interpreter.

Reimplemented in plQuakeConsole.

◆ GetInputHistory()

const plStaticArray< plString, 16 > & plConsole::GetInputHistory ( ) const
inline

Returns the current input history.

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

◆ SetCommandInterpreter()

void plConsole::SetCommandInterpreter ( const plSharedPtr< plCommandInterpreter > & 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: