DtChatCommand defines the interface for all executable chat commands in the application. Derived classes implement specific command functionality through the execute method. Commands can be entered in the chat window with a leading slash followed by the command name and any parameters.
#include <vreChatCommandsManager.h>
|
| static bool | splitString (const std::string &stringToSplit, std::vector< std::string > &tokenized, const char delimiter=' ') |
| |
◆ ~DtChatCommand()
| makVre::DtChatCommand::~DtChatCommand |
( |
| ) |
|
|
default |
Virtual destructor.
Default destructor for proper cleanup of derived command classes.
◆ execute()
| virtual bool makVre::DtChatCommand::execute |
( |
const std::string & | parameters | ) |
|
|
pure virtual |
Executes the command with given parameters.
- Parameters
-
| parameters | String containing parameters passed to the command |
- Returns
- True if the command executed successfully, false otherwise
Pure virtual method that must be implemented by derived classes to provide the actual command functionality. The parameters string contains everything after the command name.
◆ getWeak()
| virtual std::weak_ptr< DtChatCommand > makVre::DtChatCommand::getWeak |
( |
| ) |
|
|
inlinevirtual |
Gets a weak pointer to this command.
- Returns
- Weak pointer to this command instance
Returns a weak_ptr to this command instance, which helps prevent circular references while allowing access to the command.
◆ help()
| virtual std::string makVre::DtChatCommand::help |
( |
const std::string & | parameters | ) |
|
|
inlinevirtual |
Gets help text for the command.
- Parameters
-
| parameters | Optional parameters to customize help output |
- Returns
- String containing help text for the command
Returns documentation about how to use the command. The default implementation simply returns the parameters string, but derived classes should override this to provide meaningful help text.
◆ showInHelp()
| virtual bool makVre::DtChatCommand::showInHelp |
( |
| ) |
const |
|
inlinevirtual |
Checks if this command should be visible in help listings.
- Returns
- True if the command should appear in help, false otherwise
Determines whether this command should be included in the list of available commands when users request help. The default implementation returns false, meaning the command is hidden unless overridden.
◆ splitString()
| static bool makVre::DtChatCommand::splitString |
( |
const std::string & | stringToSplit, |
|
|
std::vector< std::string > & | tokenized, |
|
|
const char | delimiter = ' ' ) |
|
static |
Utility function to split a string into tokens.
- Parameters
-
| stringToSplit | String to be split |
| tokenized | Vector to store the resulting tokens |
| delimiter | Character to use as the splitting delimiter |
- Returns
- True if the string was successfully split, false otherwise
Splits a string into tokens based on the specified delimiter. This is useful for parsing command parameters into individual arguments.
The documentation for this class was generated from the following file: