Virtual base class for command line item. More...
#include <cmtkCommandLine.h>
Classes | |
class | Helper |
Helper class to avoid function template. More... | |
Public Types | |
typedef SmartPointer< Item > | SmartPtr |
Smart pointer to this class. | |
Public Member Functions | |
Item () | |
Constructor. | |
virtual | ~Item () |
Virtual destructor. | |
virtual Item * | SetProperties (const long int properties) |
Set item properties. | |
virtual long int | GetProperties () const |
Get item properties. | |
virtual Item * | SetAttribute (const std::string &key, const std::string &value) |
Set an attribute. | |
virtual void | Evaluate (const size_t argc, const char *argv[], size_t &index)=0 |
Virtual function: evaluate switch or option. | |
virtual mxml_node_t * | MakeXML (mxml_node_t *const parent) const =0 |
Virtual function that returns an XML tree describing this option. | |
virtual std::string | GetParamTypeString () const |
Virtual function returns a string that describes the parameter type associated with this option (derived classes only) | |
virtual std::ostringstream & | PrintHelp (std::ostringstream &fmt) const |
Format additional help information. | |
virtual void | PrintWiki () const |
Format additional help information. | |
virtual bool | IsDefault () const |
Return true if and only if this item is the default for the associated action or variable. | |
Protected Member Functions | |
template<class T > | |
T | Convert (const char *str) |
Convert function. | |
Static Protected Member Functions | |
static long int | ConvertStrToLong (const char *str) |
Safely convertstring argument to long integer. | |
static double | ConvertStrToDouble (const char *str) |
Safely convert string argument to double. | |
Protected Attributes | |
long int | m_Properties |
Item properties. | |
std::map< std::string, std::string > | m_Attributes |
Item attributes. These are free-form string key/value pairs. | |
Friends | |
class | CommandLine |
Allow command line class full access. |
Virtual base class for command line item.
Definition at line 265 of file cmtkCommandLine.h.
Smart pointer to this class.
Reimplemented in cmtk::CommandLine::NonOptionParameter, and cmtk::CommandLine::NonOptionParameterVector.
Definition at line 269 of file cmtkCommandLine.h.
cmtk::CommandLine::Item::Item | ( | ) | [inline] |
Constructor.
Definition at line 272 of file cmtkCommandLine.h.
virtual cmtk::CommandLine::Item::~Item | ( | ) | [inline, virtual] |
Virtual destructor.
Definition at line 275 of file cmtkCommandLine.h.
double cmtk::CommandLine::Item::ConvertStrToDouble | ( | const char * | str ) | [static, protected] |
Safely convert string argument to double.
Definition at line 48 of file cmtkCommandLineItem.cxx.
long int cmtk::CommandLine::Item::ConvertStrToLong | ( | const char * | str ) | [static, protected] |
Safely convertstring argument to long integer.
Definition at line 35 of file cmtkCommandLineItem.cxx.
virtual void cmtk::CommandLine::Item::Evaluate | ( | const size_t | argc, |
const char * | argv[], | ||
size_t & | index | ||
) | [pure virtual] |
Virtual function: evaluate switch or option.
Implemented in cmtk::CommandLine::Switch< T >, cmtk::CommandLine::Option< T >, cmtk::CommandLine::List< T >, cmtk::CommandLine::Vector< T >, cmtk::CommandLine::Callback, cmtk::CommandLine::NonOptionParameter, cmtk::CommandLine::NonOptionParameterVector, cmtk::CommandLine::Option< std::vector< std::string > >, and cmtk::CommandLine::Option< const char * >.
virtual std::string cmtk::CommandLine::Item::GetParamTypeString | ( | ) | const [inline, virtual] |
Virtual function returns a string that describes the parameter type associated with this option (derived classes only)
Reimplemented in cmtk::CommandLine::Option< T >, cmtk::CommandLine::Vector< T >, cmtk::CommandLine::Callback, cmtk::CommandLine::NonOptionParameter, cmtk::CommandLine::NonOptionParameterVector, cmtk::CommandLine::Option< std::vector< std::string > >, and cmtk::CommandLine::Option< const char * >.
Definition at line 305 of file cmtkCommandLine.h.
virtual long int cmtk::CommandLine::Item::GetProperties | ( | ) | const [inline, virtual] |
Get item properties.
Definition at line 285 of file cmtkCommandLine.h.
virtual bool cmtk::CommandLine::Item::IsDefault | ( | ) | const [inline, virtual] |
Return true if and only if this item is the default for the associated action or variable.
Reimplemented in cmtk::CommandLine::Switch< T >.
Definition at line 322 of file cmtkCommandLine.h.
virtual mxml_node_t* cmtk::CommandLine::Item::MakeXML | ( | mxml_node_t *const | parent ) | const [pure virtual] |
Virtual function that returns an XML tree describing this option.
parent | Parent in the XML tree for the new node. |
Implemented in cmtk::CommandLine::Switch< T >, cmtk::CommandLine::Option< T >, cmtk::CommandLine::List< T >, cmtk::CommandLine::Vector< T >, cmtk::CommandLine::Callback, cmtk::CommandLine::Option< std::vector< std::string > >, and cmtk::CommandLine::Option< const char * >.
virtual std::ostringstream& cmtk::CommandLine::Item::PrintHelp | ( | std::ostringstream & | fmt ) | const [inline, virtual] |
Format additional help information.
fmt | Stream that the additional help information is formatted into |
Reimplemented in cmtk::CommandLine::Switch< T >, cmtk::CommandLine::Option< T >, cmtk::CommandLine::NonOptionParameter, cmtk::CommandLine::NonOptionParameterVector, cmtk::CommandLine::Option< std::vector< std::string > >, and cmtk::CommandLine::Option< const char * >.
Definition at line 308 of file cmtkCommandLine.h.
virtual void cmtk::CommandLine::Item::PrintWiki | ( | ) | const [inline, virtual] |
Format additional help information.
Reimplemented in cmtk::CommandLine::Switch< T >, cmtk::CommandLine::Option< T >, cmtk::CommandLine::NonOptionParameter, cmtk::CommandLine::NonOptionParameterVector, cmtk::CommandLine::Option< std::vector< std::string > >, and cmtk::CommandLine::Option< const char * >.
Definition at line 316 of file cmtkCommandLine.h.
virtual Item* cmtk::CommandLine::Item::SetAttribute | ( | const std::string & | key, |
const std::string & | value | ||
) | [inline, virtual] |
Set an attribute.
Definition at line 291 of file cmtkCommandLine.h.
virtual Item* cmtk::CommandLine::Item::SetProperties | ( | const long int | properties ) | [inline, virtual] |
Set item properties.
Definition at line 278 of file cmtkCommandLine.h.
friend class CommandLine [friend] |
Allow command line class full access.
Definition at line 357 of file cmtkCommandLine.h.
std::map<std::string, std::string> cmtk::CommandLine::Item::m_Attributes [protected] |
Item attributes. These are free-form string key/value pairs.
Definition at line 332 of file cmtkCommandLine.h.
Referenced by cmtk::CommandLine::Item::Helper< T >::MakeXML().
long int cmtk::CommandLine::Item::m_Properties [protected] |
Item properties.
Definition at line 329 of file cmtkCommandLine.h.
Referenced by cmtk::CommandLine::Item::Helper< T >::GetParamTypeString(), and cmtk::CommandLine::Item::Helper< T >::MakeXML().