core::CommandList Class Reference

`#include <CommandList.h>`

Inheritance diagram for core::CommandList:
[legend]
Collaboration diagram for core::CommandList:
[legend]

## Public Member Functions

void | add (Command &command, std::string name="")
void | remove (Command &command)
bool | processRequest (std::string request, TCPSession *session, std::stringstream &data)
bool | grabInput (TCPSession *session, Command &command)
void | clearGrab (TCPSession *session)
int | processCommand (std::string request, TCPSession *session, std::stringstream &data)
Public Member Functions inherited from core::Command
virtual bool | check (std::string request)
virtual void | output (Session *session)
void | setName (std::string name)
std::string | getName ()

## Protected Attributes

std::vector< Command * > | commands

## Additional Inherited Members

Public Attributes inherited from core::Object
std::string | name
std::string | tag

## Detailed Description

CommandList

This object organizes Command objects into a list that is used to parse an input and run the process associated with the selected command.

## Member Function Documentation

## add()

void core::CommandList::add | ( | Command & | command,
|  | std::string | name = `""`
| ) |  |

Add a new command to the command list and assign a default search value.

## clearGrab()

void core::CommandList::clearGrab | ( | TCPSession * | session | ) |

## grabInput()

bool core::CommandList::grabInput | ( | TCPSession * | session,
|  | Command & | command
| ) |  |

Use grabInput() within a Command object to force the requesting handler to receive all further input from the socket. Use releaseGrab() method to release the session back to normal command processing.

## processCommand()

int core::CommandList::processCommand | ( | std::string | request,
|  | TCPSession * | session,
|  | std::stringstream & | data
| ) |  |

virtual

This method is used to implement the functionality of the requested command. This pure virtual function must be implemented in your inheriting object.

Parameters

  request | The request that was entered by the user to invoke this command.
  session | Specify the requesting session so that the execution of the command process can return its output to the session.

Returns
  Returns 0 if execution of the command was successful. Otherwise returns a non-zero value indicating an error condition.

Reimplemented from core::Command.

## processRequest()

bool core::CommandList::processRequest | ( | std::string | request,
|  | TCPSession * | session,
|  | std::stringstream & | data
| ) |  |

Use this method to apply a parsed PString to the command set and execute the matching parameter. The selected command will return a true on a call to check(). If there is a handler that has a grab on the process handler then control is given to the process handler holding the grab on the input.

## remove()

void core::CommandList::remove | ( | Command & | command | ) |

Remove a command object from the command list.

## Member Data Documentation

## commands

std::vector<Command *> core::CommandList::commands

protected

The vector of all registered commands.

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

- CommandList.h
- CommandList.cpp