Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends

cmtk::CommandLine::KeyToAction Class Reference

Local class that connects command line options with their evaluators. More...

#include <cmtkCommandLine.h>

Inheritance diagram for cmtk::CommandLine::KeyToAction:
Inheritance graph
[legend]
Collaboration diagram for cmtk::CommandLine::KeyToAction:
Collaboration graph
[legend]

List of all members.

Public Types

typedef SmartPointer< KeyToActionSmartPtr
 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.

Detailed Description

Local class that connects command line options with their evaluators.

Definition at line 712 of file cmtkCommandLine.h.


Member Typedef Documentation

Smart pointer to this class.

Reimplemented in cmtk::CommandLine::KeyToActionSingle, and cmtk::CommandLine::KeyToActionEnum.

Definition at line 716 of file cmtkCommandLine.h.


Constructor & Destructor Documentation

cmtk::CommandLine::KeyToAction::KeyToAction ( const Key key,
const std::string &  comment 
) [inline]

Constructor.

Parameters:
keyKey: 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.


Member Function Documentation

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.

Parameters:
parentParent 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.

Parameters:
keyCharKey (long option) from the command line.
argcTotal number of command line arguments.
argvCommand line argument list.
indexCurrent 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.

Parameters:
keyKey (long option) from the command line.
argcTotal number of command line arguments.
argvCommand line argument list.
indexCurrent 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.

Returns:
true is the two string match, or their only differences are hyphens vs. underlines.

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.


Friends And Related Function Documentation

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.


Member Data Documentation

Comment (description).

Definition at line 773 of file cmtkCommandLine.h.

Key for this key-action pair.

Definition at line 719 of file cmtkCommandLine.h.

Group properties.

Definition at line 776 of file cmtkCommandLine.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines