- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# CommandParserInterface Class Reference

The interface used by command parsers. More...

`#include <CommandParserInterface.h>`

Inheritance diagram for CommandParserInterface:

List of all members.

## Public Member Functions
virtual char * | GetName (void) const =0
virtual void | OnNewIncomingConnection (PlayerID playerId, TransportInterface *transport)
virtual void | OnConnectionLost (PlayerID playerId, TransportInterface *transport)
virtual void | SendHelp (TransportInterface *transport, PlayerID playerId)=0
virtual bool | OnCommand (const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, PlayerID playerId, const char *originalString)=0
virtual void | OnTransportChange (TransportInterface *transport)
virtual bool | GetRegisteredCommand (const char *command, RegisteredCommand *rc)
virtual void | SendCommandList (TransportInterface *transport, PlayerID playerId)
## Static Public Member Functions
static void | ParseConsoleString (char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength)
## Static Public Attributes
static const unsigned char | VARIABLE_NUMBER_OF_PARAMETERS = 255
## Protected Member Functions
virtual void | RegisterCommand (unsigned char parameterCount, const char *command, const char *commandHelp)
virtual void | ReturnResult (bool res, const char *command, TransportInterface *transport, PlayerID playerId)
virtual void | ReturnResult (char *res, const char *command, TransportInterface *transport, PlayerID playerId)
virtual void | ReturnResult (PlayerID res, const char *command, TransportInterface *transport, PlayerID playerId)
virtual void | ReturnResult (int res, const char *command, TransportInterface *transport, PlayerID playerId)
virtual void | ReturnResult (const char *command, TransportInterface *transport, PlayerID playerId)
PlayerID | IntegersToPlayerID (int binaryAddress, int port)
## Protected Attributes
DataStructures::OrderedList< const char *, RegisteredCommand, RegisteredCommandComp > | commandList

## Detailed Description

The interface used by command parsers.

CommandParserInterface provides a set of functions and interfaces that plug into the ConsoleServer class. Each CommandParserInterface works at the same time as other interfaces in the system.

## Member Function Documentation

virtual char* CommandParserInterface::GetName | ( | void |  | ) | const`[pure virtual]`

| You are responsible for overriding this function and returning a static string, which will identifier your parser. This should return a static string Returns: The name that you return. Implemented in LogCommandParser, RakNetCommandParser, and RakNetTransportCommandParser.

PlayerID CommandParserInterface::IntegersToPlayerID | ( | int | binaryAddress,
|  | int | port
| ) | `[protected]`

  | Since there's no way to specify a playerID directly, the user needs to specify both the binary address and port. Given those parameters, this returns the corresponding PlayerID Parameters:
  `[in]` | binaryAddress | The binaryAddress portion of PlayerID
  `[in]` | port | The port portion of PlayerID

virtual bool CommandParserInterface::OnCommand | ( | const char * | command,
|  | unsigned | numParameters,
|  | char ** | parameterList,
|  | TransportInterface * | transport,
|  | PlayerID | playerId,
|  | const char * | originalString
| ) | `[pure virtual]`

  | Given command with parameters parameterList , do whatever processing you wish. Parameters:
  `[in]` | command | The command to process
  `[in]` | numParameters | How many parameters were passed along with the command
  `[in]` | parameterList | The list of parameters. parameterList[0] is the first parameter and so on.
  `[in]` | transport | The transport interface we can use to write to
  `[in]` | playerId | The player that sent this command.
  `[in]` | originalString | The string that was actually sent over the network, in case you want to do your own parsing
Implemented in LogCommandParser, RakNetCommandParser, and RakNetTransportCommandParser.

void CommandParserInterface::OnConnectionLost | ( | PlayerID | playerId,
|  | TransportInterface * | transport
| ) | `[virtual]`

  | A callback for when playerId has disconnected, either gracefully or forcefully Parameters:
  `[in]` | playerId | The player that has disconnected.
  `[in]` | transport | The transport interface that sent us this information.
Reimplemented in LogCommandParser.

void CommandParserInterface::OnNewIncomingConnection | ( | PlayerID | playerId,
|  | TransportInterface * | transport
| ) | `[virtual]`

  | A callback for when playerId has connected to us. Parameters:
  `[in]` | playerId | The player that has connected.
  `[in]` | transport | The transport interface that sent us this information. Can be used to send messages to this or other players.
Reimplemented in LogCommandParser.

void CommandParserInterface::OnTransportChange | ( | TransportInterface * | transport | ) | `[virtual]`

  | This is called every time transport interface is registered. If you want to save a copy of the TransportInterface pointer This is the place to do it Parameters:
  `[in]` | transport | The new TransportInterface
Reimplemented in LogCommandParser.

void CommandParserInterface::RegisterCommand | ( | unsigned char | parameterCount,
|  | const char * | command,
|  | const char * | commandHelp
| ) | `[protected, virtual]`

  | Registers a command. Parameters:
  `[in]` | parameterCount | How many parameters your command requires. If you want to accept a variable number of commands, pass CommandParserInterface::VARIABLE_NUMBER_OF_PARAMETERS
  `[in]` | command | A pointer to a STATIC string that has your command. I keep a copy of the pointer here so don't deallocate the string.
  `[in]` | commandHelp | A pointer to a STATIC string that has the help information for your command. I keep a copy of the pointer here so don't deallocate the string.

void CommandParserInterface::ReturnResult | ( | const char * | command,
|  | TransportInterface * | transport,
|  | PlayerID | playerId
| ) | `[protected, virtual]`

  | Just writes a string to the remote system when you are calling a function that has no return value This is not necessary to call, but makes it easier to return results of function calls Parameters:
  `[in]` | res | The result to write
  `[in]` | command | The command that this result came from
  `[in]` | transport | The transport interface that will be written to
  `[in]` | playerId | The player this result will be sent to

void CommandParserInterface::ReturnResult | ( | bool | res,
|  | const char * | command,
|  | TransportInterface * | transport,
|  | PlayerID | playerId
| ) | `[protected, virtual]`

  | Just writes a string to the remote system based on the result ( res )of your operation This is not necessary to call, but makes it easier to return results of function calls Parameters:
  `[in]` | res | The result to write
  `[in]` | command | The command that this result came from
  `[in]` | transport | The transport interface that will be written to
  `[in]` | playerId | The player this result will be sent to

virtual void CommandParserInterface::SendHelp | ( | TransportInterface * | transport,
|  | PlayerID | playerId
| ) | `[pure virtual]`

  | A callback for when you are expected to send a brief description of your parser to playerId Parameters:
  `[in]` | transport | The transport interface we can use to write to
  `[in]` | playerId | The player that requested help.
Implemented in LogCommandParser, RakNetCommandParser, and RakNetTransportCommandParser.

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

- C:/RakNet 2.518/Include/CommandParserInterface.h
- C:/RakNet 2.518/Source/CommandParserInterface.cpp