CRM64Pro GDK v0.80.0
A free cross-platform game development kit built on top of SDL 3.0
Loading...
Searching...
No Matches
CRM64Pro::Consolefinal

Console Object class. More...

Classes

struct  Completion
 A completion value and its display-only description. More...

Public Types

using CommandCallback = function<Sint32(vector<string>*, Console*)>
 Command callback; receives all tokens, including the command name, and returns 0 or a negative error.
using CompletionCallback = function<void(const vector<string>& vTokens, Sint32 iArgument, vector<Completion>& vMatches)>
 Completion callback; receives tokens through the caret, the active token index and output candidates.

Public Member Functions

Sint32 addCmdHandler (const string &sCommandName, const string &sCommandHelp, CommandCallback fnCmdHandler, CompletionCallback fnCompletion)
 Register a command with a callback that may capture application state.
Sint32 setCmdCompletion (const string &sCommandName, CompletionCallback fnCompletion)
 Set or clear argument completion for a registered command.
Sint32 getCmdCompletions (const string &sText, Sint32 iCaret, vector< Completion > &vMatches) const
 Query completion candidates without changing the prompt.
bool info (Sint32 iMode=0) override
 Request Console information.
const string & getName () const override
 Get the name.
Sint32 getID () const override
 Get the ID.
Widget & baseWidget ()
 Get the reference to base Widget for this object.
Sint32 attachTo (Sint32 idScreen)
 Attach this console to a screen.
Sint32 getScreen () const
 Return the screen id where this console is attached to.
Sint32 print (const char *format,...)
 Print a formatted message to the console.
Sint32 vPrint (const char *format, va_list args)
 Print a formatted message to the console.
Sint32 addCmdHandler (const string &sCommandName, const string &sCommandHelp, Sint32(*fnCmdHandler)(vector< string > *, Console *pCon))
 Add a new command handler to the console.
Sint32 executeCmd (const string &sCmd)
 Execute a command on this console.
Sint32 setReadOnly (bool bEnable=true)
 Enable or disable read-only mode for the console prompt.
bool isReadOnly () const
 Check whether the console prompt is in read-only mode.

Detailed Description

Console Object class.

Member Typedef Documentation

◆ CompletionCallback

using CRM64Pro::Console::CompletionCallback = function<void(const vector<string>& vTokens, Sint32 iArgument, vector<Completion>& vMatches)>

Completion callback; receives tokens through the caret, the active token index and output candidates.

The active token is present, even when empty. Append unquoted candidates to vMatches. Callbacks run on the main thread and must not execute commands or modify the console.