Planeshift
Public Types | Public Member Functions | Protected Attributes

CmdHandler Class Reference

#include <cmdhandler.h>

List of all members.

Public Types

enum  { INVISIBLE_TO_USER = 0, VISIBLE_TO_USER = 1 }

Public Member Functions

 CmdHandler (iObjectRegistry *obj)
void Execute (const char *script, bool breakSemiColon=true)
 Eventually will execute script commands, but now just wrapper to Publish.
void GetSubscribedCommands (csRedBlackTree< psString > &tree)
 Return a list (alpha-sorted with unique entries) of the subscribed commands.
const char * Publish (const csString &cmd)
 Call all HandleCommand funcs for all subscribed commands.
bool Subscribe (const char *cmd, iCmdSubscriber *subscriber)
 Any subclass of iCmdSubscriber can subscribe to typed commands with this function.
bool Unsubscribe (const char *cmd, iCmdSubscriber *subscriber)
 Remove subscriber from list.
bool UnsubscribeAll (iCmdSubscriber *subscriber)
 remove subscriber from list for all commands previously subscribed
virtual ~CmdHandler ()

Protected Attributes

iObjectRegistry * objreg
csPDelArray< CmdSubscriptionsubscribers

Detailed Description

Definition at line 54 of file cmdhandler.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
INVISIBLE_TO_USER 
VISIBLE_TO_USER 

Definition at line 64 of file cmdhandler.h.


Constructor & Destructor Documentation

CmdHandler::CmdHandler ( iObjectRegistry *  obj)
virtual CmdHandler::~CmdHandler ( ) [virtual]

Member Function Documentation

void CmdHandler::Execute ( const char *  script,
bool  breakSemiColon = true 
)

Eventually will execute script commands, but now just wrapper to Publish.

Parameters:
scriptThe full script to run.
breakSemiColonIf true assume that the script is a collection seperated by ';'. If false then assume it is one string.
void CmdHandler::GetSubscribedCommands ( csRedBlackTree< psString > &  tree)

Return a list (alpha-sorted with unique entries) of the subscribed commands.

const char* CmdHandler::Publish ( const csString &  cmd)

Call all HandleCommand funcs for all subscribed commands.

bool CmdHandler::Subscribe ( const char *  cmd,
iCmdSubscriber subscriber 
)

Any subclass of iCmdSubscriber can subscribe to typed commands with this function.

bool CmdHandler::Unsubscribe ( const char *  cmd,
iCmdSubscriber subscriber 
)

Remove subscriber from list.

bool CmdHandler::UnsubscribeAll ( iCmdSubscriber subscriber)

remove subscriber from list for all commands previously subscribed


Member Data Documentation

iObjectRegistry* CmdHandler::objreg [protected]

Definition at line 57 of file cmdhandler.h.

csPDelArray<CmdSubscription> CmdHandler::subscribers [protected]

Definition at line 58 of file cmdhandler.h.


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