R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
server::HelpCommand Class Reference

Displays available commands to the player. More...

#include <HelpCommand.hpp>

Inheritance diagram for server::HelpCommand:
Inheritance graph
Collaboration diagram for server::HelpCommand:
Collaboration graph

Public Member Functions

 HelpCommand (const std::vector< std::shared_ptr< ICommand > > &commands)
 
 ~HelpCommand () override=default
 
std::string execute (const std::vector< std::string > &args, const CommandContext &context) override
 Execute the command.
 
std::string getName () const override
 Get command name.
 
std::string getDescription () const override
 Get command description.
 
std::string getUsage () const override
 Get command usage.
 
- Public Member Functions inherited from server::ICommand
virtual ~ICommand ()=default
 

Private Attributes

const std::vector< std::shared_ptr< ICommand > > & _commands
 

Detailed Description

Displays available commands to the player.

Usage: /help Lists all registered commands with their descriptions.

Definition at line 24 of file HelpCommand.hpp.

Constructor & Destructor Documentation

◆ HelpCommand()

server::HelpCommand::HelpCommand ( const std::vector< std::shared_ptr< ICommand > > &  commands)
inline

Definition at line 26 of file HelpCommand.hpp.

◆ ~HelpCommand()

server::HelpCommand::~HelpCommand ( )
overridedefault

Member Function Documentation

◆ execute()

std::string server::HelpCommand::execute ( const std::vector< std::string > &  args,
const CommandContext context 
)
overridevirtual

Execute the command.

Parameters
argsCommand arguments (without the command name)
contextExecution context with player and room information
Returns
Response message to send to the player

Implements server::ICommand.

Definition at line 13 of file HelpCommand.cpp.

References _commands.

◆ getDescription()

std::string server::HelpCommand::getDescription ( ) const
inlineoverridevirtual

Get command description.

Returns
Description of what the command does

Implements server::ICommand.

Definition at line 31 of file HelpCommand.hpp.

◆ getName()

std::string server::HelpCommand::getName ( ) const
inlineoverridevirtual

Get command name.

Returns
The command name (without /)

Implements server::ICommand.

Definition at line 30 of file HelpCommand.hpp.

◆ getUsage()

std::string server::HelpCommand::getUsage ( ) const
inlineoverridevirtual

Get command usage.

Returns
Usage example/syntax for the command

Implements server::ICommand.

Definition at line 32 of file HelpCommand.hpp.

Member Data Documentation

◆ _commands

const std::vector<std::shared_ptr<ICommand> >& server::HelpCommand::_commands
private

Definition at line 35 of file HelpCommand.hpp.

Referenced by execute().


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