Public Types | Public Member Functions
CCmdOptionList Class Reference

The class to hold the list of options. More...

#include <mia/core/cmdlineparser.hh>

Public Types

enum  EHelpRequested {
  hr_no = 0, hr_help, hr_help_xml, hr_usage,
  hr_version, hr_copyright
}
 

Public Member Functions

void add (PCmdOption opt)
 
void add (const std::string &group, PCmdOption opt)
 
 CCmdOptionList (const SProgramDescription &description)
 
const std::vector< std::string > & get_remaining () const
 
CHistoryRecord get_values () const
 
EHelpRequested parse (size_t argc, char *args[], const std::string &additional_type, const CPluginHandlerBase *additional_help=NULL) __attribute__((warn_unused_result))
 
EHelpRequested parse (size_t argc, const char *args[], const std::string &additional_type, const CPluginHandlerBase *additional_help=NULL) __attribute__((warn_unused_result))
 
EHelpRequested parse (size_t argc, char *args[]) __attribute__((warn_unused_result))
 
EHelpRequested parse (size_t argc, const char *args[]) __attribute__((warn_unused_result))
 
void set_group (const std::string &group)
 
void set_logstream (std::ostream &os)
 
 ~CCmdOptionList ()
 cleanup More...
 

Detailed Description

The class to hold the list of options.

This class holds all the user defined and default command line option, handles the parsing and the printing of help.

Todo:
the whole command line option class structure needs a code cleanup

Definition at line 229 of file cmdlineparser.hh.

Member Enumeration Documentation

This enum describes the type of help information that has been requested

Enumerator
hr_no 

no help has been requested

hr_help 

standard help output has been requested

hr_help_xml 

XML-formatted help has been requested

hr_usage 

a short usage description has been requested

hr_version 

The version information has been requested

hr_copyright 

The long copyright information has been requested

Definition at line 235 of file cmdlineparser.hh.

Constructor & Destructor Documentation

CCmdOptionList::CCmdOptionList ( const SProgramDescription description)

Constructor creates the options list and adds some defaut options like –help, –verbose, –copyright, and –usage

Parameters
descriptiongive a description of the program
CCmdOptionList::~CCmdOptionList ( )

cleanup

Member Function Documentation

void CCmdOptionList::add ( PCmdOption  opt)

add a new option to the option list

Parameters
optthe option to add
void CCmdOptionList::add ( const std::string &  group,
PCmdOption  opt 
)

Add a new option to an option group

Parameters
groupoption group to add this option to
optthe option to add
const std::vector<std::string>& CCmdOptionList::get_remaining ( ) const
Returns
a vector of the remaining arguments
CHistoryRecord CCmdOptionList::get_values ( ) const
Returns
the values of all arguments as a history record to support tracking of changes on data worked on by mia
EHelpRequested CCmdOptionList::parse ( size_t  argc,
char *  args[],
const std::string &  additional_type,
const CPluginHandlerBase additional_help = NULL 
)

the work routine, can take the arguemnts straight from main This version parses the command line and allows for additional arguments that can be read by get_remaining().

Parameters
argcnumber of arguments
argsarray of arguments strings
additional_typewill is a help string to describe the type of free parameters
additional_helpIf you use a plug-in handler to process the free parameters then pass the pointer to the according plug-in handler here, so that the help system can create proper documentation
EHelpRequested CCmdOptionList::parse ( size_t  argc,
const char *  args[],
const std::string &  additional_type,
const CPluginHandlerBase additional_help = NULL 
)

the work routine, can take the arguemnts straight from main This version parses the command line and allows for additional arguments that can be read by get_remaining().

Parameters
argcnumber of arguments
argsarray of arguments strings
additional_typewill is a help string to describe the type of free parameters
additional_helpIf you use a plug-in handler to process the free parameters then pass the pointer to the according plug-in handler here, so that the help system can create proper documentation
EHelpRequested CCmdOptionList::parse ( size_t  argc,
char *  args[] 
)

the work routine, can take the arguemnts straight from main This version parses doesn't allow additional parameters.

Parameters
argcnumber of arguments
argsarray of arguments strings
EHelpRequested CCmdOptionList::parse ( size_t  argc,
const char *  args[] 
)

the work routine, can take the arguemnts straight from main This version parses doesn't allow additional parameters.

Parameters
argcnumber of arguments
argsarray of arguments strings
void CCmdOptionList::set_group ( const std::string &  group)

Set the option group to add subsequent options to

Parameters
group
void CCmdOptionList::set_logstream ( std::ostream &  os)

Set the output stream for help/usage messages

Parameters
osnew output stream

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