Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::PLearnCommandRegistry Class Reference

#include <PLearnCommandRegistry.h>

List of all members.

Public Member Functions

 PLearnCommandRegistry (PLearnCommand *plcommand)
 This constructor will simply register the given PLearnCommand.


Static Public Member Functions

void do_register (PLearnCommand *command)
 registers a command

bool is_registered (const string &commandname)
 checks wether a command is registered with that name

void print_command_summary (ostream &out)
 prints a list of all commands with their one-line summary

void run (const string &commandname, const vector< string > &args)
 run the given (registered) command with the given arguments

void help (const string &commandname, ostream &out)
 prints out detailed help for the given command on the given stream


Protected Types

typedef map< string, PLearnCommand * > command_map

Static Protected Member Functions

command_map & commands ()
 Returns a reference to the unique command map.

void badcommand (const string &commandname)
 Issues a "bad command" message.


Member Typedef Documentation

typedef map<string, PLearnCommand*> PLearn::PLearnCommandRegistry::command_map [protected]
 

Definition at line 54 of file PLearnCommandRegistry.h.

Referenced by commands().


Constructor & Destructor Documentation

PLearn::PLearnCommandRegistry::PLearnCommandRegistry (  PLearnCommand *  plcommand  )  [inline]
 

This constructor will simply register the given PLearnCommand.

Definition at line 81 of file PLearnCommandRegistry.h.


Member Function Documentation

void PLearn::PLearnCommandRegistry::badcommand (  const string &  commandname  )  [static, protected]
 

Issues a "bad command" message.

Definition at line 73 of file PLearnCommandRegistry.cc.

References PLearn::endl(), and print_command_summary().

Referenced by help(), and run().

PLearnCommandRegistry::command_map & PLearn::PLearnCommandRegistry::commands (   )  [static, protected]
 

Returns a reference to the unique command map.

Definition at line 47 of file PLearnCommandRegistry.cc.

References command_map.

Referenced by do_register(), help(), is_registered(), print_command_summary(), and run().

void PLearn::PLearnCommandRegistry::do_register (  PLearnCommand *  command  )  [static]
 

registers a command

Definition at line 54 of file PLearnCommandRegistry.cc.

References commands(), and PLearn::PLearnCommand::name.

void PLearn::PLearnCommandRegistry::help (  const string &  commandname,
ostream &  out
)  [static]
 

prints out detailed help for the given command on the given stream

Definition at line 90 of file PLearnCommandRegistry.cc.

References badcommand(), commands(), and PLearn::endl().

bool PLearn::PLearnCommandRegistry::is_registered (  const string &  commandname  )  [static]
 

checks wether a command is registered with that name

Definition at line 57 of file PLearnCommandRegistry.cc.

References commands().

void PLearn::PLearnCommandRegistry::print_command_summary (  ostream &  out  )  [static]
 

prints a list of all commands with their one-line summary

Definition at line 60 of file PLearnCommandRegistry.cc.

References commands(), and PLearn::endl().

Referenced by badcommand().

void PLearn::PLearnCommandRegistry::run (  const string &  commandname,
const vector< string > &  args
)  [static]
 

run the given (registered) command with the given arguments

Definition at line 81 of file PLearnCommandRegistry.cc.

References badcommand(), and commands().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:28:04 2004 for PLearn by doxygen 1.3.7