Manages command line definition and parsing of arguments.
More...
#include <CmdLine.h>
|
class | XorHandler |
| Handles lists of Arg's that are to be XOR'd on the command-line. More...
|
|
|
void | add (Arg &a) |
| Adds an argument to the list of arguments to be parsed. More...
|
|
void | add (Arg *a) |
| An alternative add. Functionally identical. More...
|
|
| CmdLine (const std::string &name, const std::string &project, const std::string &description, const std::string &example, const std::string &version, const std::string ©right="Copyright (c) University of Pennsylvania." " All rights reserved.", const std::string &license="See http://www.rad.upenn.edu/sbia/software/license.html" " or COPYING file.", const std::string &contact="SBIA Group <sbia-software at uphs.upenn.edu>", bool stdargs=true) |
| Constructor. More...
|
|
| CmdLine (const std::string &name, const std::string &project, const std::string &description, const std::vector< std::string > &examples, const std::string &version, const std::string ©right="Copyright (c) University of Pennsylvania." " All rights reserved.", const std::string &license="See http://www.rad.upenn.edu/sbia/software/license.html" " or COPYING file.", const std::string &contact="SBIA Group <sbia-software at uphs.upenn.edu>", bool stdargs=true) |
| Constructor. More...
|
|
std::string & | getContact () |
| Get contact information. More...
|
|
std::string & | getCopyright () |
| Get copyright notice. More...
|
|
std::string & | getDescription () |
| Get program description. More...
|
|
std::vector< std::string > & | getExamples () |
| Get usage example. More...
|
|
std::string & | getLicense () |
| Get license information. More...
|
|
std::string & | getProgramName () |
| Get name of program. More...
|
|
std::string & | getProjectName () |
| Get name of project the program belongs to. More...
|
|
XorHandler & | getXorHandler () |
| Get handler of XOR'd arguments. More...
|
|
void | parse (int argc, const char *const *argv) |
| Parses the command line. More...
|
|
void | parse (std::vector< std::string > &args) |
| Parses the command line. More...
|
|
void | print_help () const |
| Print help. More...
|
|
void | print_usage () const |
| Print short help, i.e., usage information. More...
|
|
void | print_version () const |
| Print version information. More...
|
|
void | xorAdd (Arg &a, Arg &b) |
| Add two Args that will be xor'd. More...
|
|
void | xorAdd (std::vector< Arg *> &xors) |
| Add a list of arguments that will be xor'd. More...
|
|
virtual | ~CmdLine () |
| Destructor. More...
|
|
|
void | setup (bool stdargs) |
| Set up command-line object. More...
|
|
Manages command line definition and parsing of arguments.
Copyright (c) 2011 University of Pennsylvania. All rights reserved.
See http://www.rad.upenn.edu/sbia/software/license.html or COPYING file.
Definition at line 37 of file CmdLine.h.
§ CmdLine() [1/2]
basis::CmdLine::CmdLine |
( |
const std::string & |
name, |
|
|
const std::string & |
project, |
|
|
const std::string & |
description, |
|
|
const std::string & |
example, |
|
|
const std::string & |
version, |
|
|
const std::string & |
copyright = "Copyright (c) University of Pennsylvania." " All rights reserved." , |
|
|
const std::string & |
license = "See http://www.rad.upenn.edu/sbia/software/license.html" " or COPYING file." , |
|
|
const std::string & |
contact = "SBIA Group <sbia-software at uphs.upenn.edu>" , |
|
|
bool |
stdargs = true |
|
) |
| |
Constructor.
- Parameters
-
[in] | name | Program name. Should be a constant string which helps to identify the program, not the name of the executable as determined at runtime. |
[in] | project | Name of project this program belongs to. |
[in] | description | Program description. |
[in] | example | Usage example. |
[in] | version | Program version. |
[in] | copyright | Copyright notice. |
[in] | license | License information. |
[in] | contact | Contact information. |
[in] | stdargs | Enable/disable handling of standard arguments. |
Definition at line 772 of file CmdLine.cxx.
§ CmdLine() [2/2]
basis::CmdLine::CmdLine |
( |
const std::string & |
name, |
|
|
const std::string & |
project, |
|
|
const std::string & |
description, |
|
|
const std::vector< std::string > & |
examples, |
|
|
const std::string & |
version, |
|
|
const std::string & |
copyright = "Copyright (c) University of Pennsylvania." " All rights reserved." , |
|
|
const std::string & |
license = "See http://www.rad.upenn.edu/sbia/software/license.html" " or COPYING file." , |
|
|
const std::string & |
contact = "SBIA Group <sbia-software at uphs.upenn.edu>" , |
|
|
bool |
stdargs = true |
|
) |
| |
Constructor.
- Parameters
-
[in] | name | Program name. Should be a constant string which helps to identify the program, not the name of the executable as determined at runtime. |
[in] | project | Name of project this program belongs to. |
[in] | description | Program description. |
[in] | examples | Usage examples. |
[in] | version | Program version. |
[in] | copyright | Copyright notice. |
[in] | license | License information. |
[in] | contact | Contact information. |
[in] | stdargs | Enable/disable handling of standard arguments. |
Definition at line 795 of file CmdLine.cxx.
§ ~CmdLine()
virtual basis::CmdLine::~CmdLine |
( |
| ) |
|
|
inlinevirtual |
§ add() [1/2]
void basis::CmdLine::add |
( |
Arg & |
a | ) |
|
Adds an argument to the list of arguments to be parsed.
- Parameters
-
[in] | a | Argument to be added. |
Definition at line 881 of file CmdLine.cxx.
§ add() [2/2]
void basis::CmdLine::add |
( |
Arg * |
a | ) |
|
An alternative add. Functionally identical.
- Parameters
-
[in] | a | Argument to be added. |
Definition at line 887 of file CmdLine.cxx.
§ getContact()
std::string& basis::CmdLine::getContact |
( |
| ) |
|
|
inline |
Get contact information.
- Returns
- Contact information.
Definition at line 277 of file CmdLine.h.
§ getCopyright()
std::string& basis::CmdLine::getCopyright |
( |
| ) |
|
|
inline |
Get copyright notice.
- Returns
- Copyright information of program.
Definition at line 263 of file CmdLine.h.
§ getDescription()
std::string& basis::CmdLine::getDescription |
( |
| ) |
|
|
inline |
Get program description.
- Returns
- Description of program this command-line object belongs to.
Definition at line 249 of file CmdLine.h.
§ getExamples()
std::vector<std::string>& basis::CmdLine::getExamples |
( |
| ) |
|
|
inline |
Get usage example.
- Returns
- Example command-line usage.
Definition at line 256 of file CmdLine.h.
§ getLicense()
std::string& basis::CmdLine::getLicense |
( |
| ) |
|
|
inline |
Get license information.
- Returns
- License information of program.
Definition at line 270 of file CmdLine.h.
§ getProgramName()
std::string& basis::CmdLine::getProgramName |
( |
| ) |
|
|
inline |
Get name of program.
- Returns
- Name of program this command-line object belongs to.
Definition at line 235 of file CmdLine.h.
§ getProjectName()
std::string& basis::CmdLine::getProjectName |
( |
| ) |
|
|
inline |
Get name of project the program belongs to.
- Returns
- Name of project this program belongs to.
Definition at line 242 of file CmdLine.h.
§ getXorHandler()
Get handler of XOR'd arguments.
Definition at line 282 of file CmdLine.h.
§ parse() [1/2]
void basis::CmdLine::parse |
( |
int |
argc, |
|
|
const char *const * |
argv |
|
) |
| |
Parses the command line.
- Parameters
-
[in] | argc | Number of arguments. |
[in] | argv | Array of arguments. |
Definition at line 937 of file CmdLine.cxx.
§ parse() [2/2]
void basis::CmdLine::parse |
( |
std::vector< std::string > & |
args | ) |
|
Parses the command line.
- Parameters
-
[in] | args | A vector of strings representing the args. args[0] is still the program name. |
Definition at line 945 of file CmdLine.cxx.
§ print_help()
void basis::CmdLine::print_help |
( |
| ) |
const |
§ print_usage()
void basis::CmdLine::print_usage |
( |
| ) |
const |
Print short help, i.e., usage information.
Definition at line 902 of file CmdLine.cxx.
§ print_version()
void basis::CmdLine::print_version |
( |
| ) |
const |
Print version information.
Definition at line 916 of file CmdLine.cxx.
§ setup()
void basis::CmdLine::setup |
( |
bool |
stdargs | ) |
|
|
protected |
Set up command-line object.
Definition at line 818 of file CmdLine.cxx.
§ xorAdd() [1/2]
void basis::CmdLine::xorAdd |
( |
Arg & |
a, |
|
|
Arg & |
b |
|
) |
| |
Add two Args that will be xor'd.
If this method is used, add does not need to be called.
- Parameters
-
[in] | a | Argument to be added and xor'd. |
[in] | b | Argument to be added and xor'd. |
Definition at line 893 of file CmdLine.cxx.
§ xorAdd() [2/2]
void basis::CmdLine::xorAdd |
( |
std::vector< Arg *> & |
xors | ) |
|
Add a list of arguments that will be xor'd.
If this method is used, add does not need to be called.
- Parameters
-
[in] | xors | List of Args to be added and xor'd. |
Definition at line 922 of file CmdLine.cxx.
§ _contact
std::string basis::CmdLine::_contact |
|
protected |
Contact information.
Definition at line 310 of file CmdLine.h.
§ _copyright
std::string basis::CmdLine::_copyright |
|
protected |
Program copyright.
Definition at line 308 of file CmdLine.h.
§ _examples
std::vector<std::string> basis::CmdLine::_examples |
|
protected |
Program usage example.
Definition at line 307 of file CmdLine.h.
§ _license
std::string basis::CmdLine::_license |
|
protected |
§ _name
std::string basis::CmdLine::_name |
|
protected |
§ _project
std::string basis::CmdLine::_project |
|
protected |
§ _xorHandler
The documentation for this class was generated from the following files: