Local class that connects command line options with their evaluators. More...
#include <cmtkCommandLine.h>
Public Types | |
typedef SmartPointer< KeyToAction > | SmartPtr |
Smart pointer to this class. | |
Public Member Functions | |
KeyToAction (const Key &key, const std::string &comment) | |
Constructor. | |
virtual | ~KeyToAction () |
Virtual destructor. | |
virtual bool | MatchAndExecute (const std::string &key, const size_t argc, const char *argv[], size_t &index)=0 |
Test long key from command line and execute if match. | |
virtual bool | MatchAndExecute (const char keyChar, const size_t argc, const char *argv[], size_t &index)=0 |
Test short key from command line and execute if match. | |
virtual void | SetProperties (const long int properties) |
Set action properties. | |
virtual long int | GetProperties () const |
Get item properties. | |
virtual mxml_node_t * | MakeXML (mxml_node_t *const parent) const |
Returns an XML tree describing this key and action. | |
virtual void | PrintHelp (const size_t globalIndent=0) const =0 |
Print help for this item. | |
Public Attributes | |
const Key | m_Key |
Key for this key-action pair. | |
Protected Member Functions | |
virtual void | FormatHelp (std::ostringstream &fmt) const |
Format help for key part of this key/action.. | |
virtual void | PrintWikiWithPrefix (const std::string &prefix="") const |
Print help for this item. | |
virtual std::string | GetActionTypeInfo () const |
Get type info for action parameter (if any). | |
virtual bool | MatchLongOption (const std::string &key) const |
Match two long options but be tolerant to hyphens, i.e., consider '-' and '_' the same. | |
Protected Attributes | |
std::string | m_Comment |
Comment (description). | |
long int | m_Properties |
Group properties. | |
Friends | |
class | CommandLine |
Give command line class full access. | |
class | CommandLine::EnumGroupBase |
Give enum group class full access. |
Local class that connects command line options with their evaluators.
Definition at line 712 of file cmtkCommandLine.h.
Smart pointer to this class.
Reimplemented in cmtk::CommandLine::KeyToActionSingle, and cmtk::CommandLine::KeyToActionEnum.
Definition at line 716 of file cmtkCommandLine.h.
cmtk::CommandLine::KeyToAction::KeyToAction | ( | const Key & | key, |
const std::string & | comment | ||
) | [inline] |
Constructor.
key | Key: long and/or short command line option for this action. |
Definition at line 722 of file cmtkCommandLine.h.
virtual cmtk::CommandLine::KeyToAction::~KeyToAction | ( | ) | [inline, virtual] |
Virtual destructor.
Definition at line 730 of file cmtkCommandLine.h.
void cmtk::CommandLine::KeyToAction::FormatHelp | ( | std::ostringstream & | fmt ) | const [protected, virtual] |
Format help for key part of this key/action..
Definition at line 92 of file cmtkCommandLineKeyToAction.cxx.
References cmtk::CommandLine::HelpTextIndent.
virtual std::string cmtk::CommandLine::KeyToAction::GetActionTypeInfo | ( | ) | const [inline, protected, virtual] |
Get type info for action parameter (if any).
Reimplemented in cmtk::CommandLine::KeyToActionSingle.
Definition at line 767 of file cmtkCommandLine.h.
long int cmtk::CommandLine::KeyToAction::GetProperties | ( | ) | const [virtual] |
Get item properties.
Definition at line 46 of file cmtkCommandLineKeyToAction.cxx.
mxml_node_t * cmtk::CommandLine::KeyToAction::MakeXML | ( | mxml_node_t *const | parent ) | const [virtual] |
Returns an XML tree describing this key and action.
parent | Parent in the XML tree for the new node. |
Reimplemented in cmtk::CommandLine::KeyToActionSingle, and cmtk::CommandLine::KeyToActionEnum.
Definition at line 53 of file cmtkCommandLineKeyToAction.cxx.
References NULL.
virtual bool cmtk::CommandLine::KeyToAction::MatchAndExecute | ( | const char | keyChar, |
const size_t | argc, | ||
const char * | argv[], | ||
size_t & | index | ||
) | [pure virtual] |
Test short key from command line and execute if match.
keyChar | Key (long option) from the command line. |
argc | Total number of command line arguments. |
argv | Command line argument list. |
index | Current index in command line list |
Implemented in cmtk::CommandLine::KeyToActionSingle, and cmtk::CommandLine::KeyToActionEnum.
virtual bool cmtk::CommandLine::KeyToAction::MatchAndExecute | ( | const std::string & | key, |
const size_t | argc, | ||
const char * | argv[], | ||
size_t & | index | ||
) | [pure virtual] |
Test long key from command line and execute if match.
key | Key (long option) from the command line. |
argc | Total number of command line arguments. |
argv | Command line argument list. |
index | Current index in command line list |
Implemented in cmtk::CommandLine::KeyToActionSingle, and cmtk::CommandLine::KeyToActionEnum.
bool cmtk::CommandLine::KeyToAction::MatchLongOption | ( | const std::string & | key ) | const [protected, virtual] |
Match two long options but be tolerant to hyphens, i.e., consider '-' and '_' the same.
This allows us to be tolerant with Slicer's requirement that there are no hyphens in long options, while maintaining the ability to use them on the command line for compatibility.
Definition at line 171 of file cmtkCommandLineKeyToAction.cxx.
virtual void cmtk::CommandLine::KeyToAction::PrintHelp | ( | const size_t | globalIndent = 0 ) |
const [pure virtual] |
Print help for this item.
Implemented in cmtk::CommandLine::KeyToActionSingle, and cmtk::CommandLine::KeyToActionEnum.
void cmtk::CommandLine::KeyToAction::PrintWikiWithPrefix | ( | const std::string & | prefix = "" ) |
const [protected, virtual] |
Print help for this item.
Reimplemented in cmtk::CommandLine::KeyToActionSingle, and cmtk::CommandLine::KeyToActionEnum.
Definition at line 134 of file cmtkCommandLineKeyToAction.cxx.
References cmtk::StdOut.
void cmtk::CommandLine::KeyToAction::SetProperties | ( | const long int | properties ) | [virtual] |
Set action properties.
Definition at line 39 of file cmtkCommandLineKeyToAction.cxx.
References cmtk::CommandLine::m_Properties.
friend class CommandLine [friend] |
Give command line class full access.
Definition at line 787 of file cmtkCommandLine.h.
friend class CommandLine::EnumGroupBase [friend] |
Give enum group class full access.
Definition at line 790 of file cmtkCommandLine.h.
std::string cmtk::CommandLine::KeyToAction::m_Comment [protected] |
Comment (description).
Definition at line 773 of file cmtkCommandLine.h.
Key for this key-action pair.
Definition at line 719 of file cmtkCommandLine.h.
long int cmtk::CommandLine::KeyToAction::m_Properties [protected] |
Group properties.
Definition at line 776 of file cmtkCommandLine.h.