BASIS  version 1.2.3 (revision 2104)
Public Member Functions | Protected Member Functions | Protected Attributes
sbia::basis::CmdLine Class Reference

Manages command line definition and parsing of arguments. More...

#include <CmdLine.h>

+ Inheritance diagram for sbia::basis::CmdLine:
+ Collaboration diagram for sbia::basis::CmdLine:

List of all members.

Public Member Functions

void add (Arg &a)
 Adds an argument to the list of arguments to be parsed.
void add (Arg *a)
 An alternative add. Functionally identical.
 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 https://www.cbica.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.
 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 https://www.cbica.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.
std::string & getContact ()
 Get contact information.
std::string & getCopyright ()
 Get copyright notice.
std::string & getDescription ()
 Get program description.
std::vector< std::string > & getExamples ()
 Get usage example.
std::string & getLicense ()
 Get license information.
std::string & getProgramName ()
 Get name of program.
std::string & getProjectName ()
 Get name of project the program belongs to.
void parse (int argc, const char *const *argv)
 Parses the command line.
void parse (std::vector< std::string > &args)
 Parses the command line.
void xorAdd (Arg &a, Arg &b)
 Add two Args that will be xor'd.
void xorAdd (std::vector< Arg * > &xors)
 Add a list of arguments that will be xor'd.
virtual ~CmdLine ()
 Destructor.

Protected Member Functions

void setup (bool stdargs)
 Set up command-line object.

Protected Attributes

std::string _contact
 Contact information.
std::string _copyright
 Program copyright.
std::vector< std::string > _examples
 Program usage example.
std::string _license
 Program license.
std::string _name
 Program name.
std::string _project
 Name of project.

Detailed Description

Manages command line definition and parsing of arguments.

See Parsing the Command-line Arguments in C++ for an example use of this class.

Copyright (c) 2011 University of Pennsylvania. All rights reserved.
See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file.

Definition at line 39 of file basis/CmdLine.h.


Constructor & Destructor Documentation

sbia::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 https://www.cbica.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]nameProgram name. Should be a constant string which helps to identify the program, not the name of the executable as determined at runtime.
[in]projectName of project this program belongs to.
[in]descriptionProgram description.
[in]exampleUsage example.
[in]versionProgram version.
[in]copyrightCopyright notice.
[in]licenseLicense information.
[in]contactContact information.
[in]stdargsEnable/disable handling of standard arguments.

Definition at line 701 of file CmdLine.cxx.

sbia::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 https://www.cbica.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]nameProgram name. Should be a constant string which helps to identify the program, not the name of the executable as determined at runtime.
[in]projectName of project this program belongs to.
[in]descriptionProgram description.
[in]examplesUsage examples.
[in]versionProgram version.
[in]copyrightCopyright notice.
[in]licenseLicense information.
[in]contactContact information.
[in]stdargsEnable/disable handling of standard arguments.

Definition at line 723 of file CmdLine.cxx.


Member Function Documentation

void sbia::basis::CmdLine::add ( Arg a) [virtual]

Adds an argument to the list of arguments to be parsed.

Parameters:
[in]aArgument to be added.

Reimplemented from TCLAP::CmdLine.

Definition at line 811 of file CmdLine.cxx.

void sbia::basis::CmdLine::add ( Arg a) [virtual]

An alternative add. Functionally identical.

Parameters:
[in]aArgument to be added.

Reimplemented from TCLAP::CmdLine.

Definition at line 817 of file CmdLine.cxx.

std::string& sbia::basis::CmdLine::getContact ( ) [inline]

Get contact information.

Returns:
Contact information.

Definition at line 218 of file basis/CmdLine.h.

std::string& sbia::basis::CmdLine::getCopyright ( ) [inline]

Get copyright notice.

Returns:
Copyright information of program.

Definition at line 204 of file basis/CmdLine.h.

std::string& sbia::basis::CmdLine::getDescription ( ) [inline]

Get program description.

Returns:
Description of program this command-line object belongs to.

Definition at line 190 of file basis/CmdLine.h.

std::vector<std::string>& sbia::basis::CmdLine::getExamples ( ) [inline]

Get usage example.

Returns:
Example command-line usage.

Definition at line 197 of file basis/CmdLine.h.

std::string& sbia::basis::CmdLine::getLicense ( ) [inline]

Get license information.

Returns:
License information of program.

Definition at line 211 of file basis/CmdLine.h.

std::string& sbia::basis::CmdLine::getProgramName ( ) [inline, virtual]

Get name of program.

Returns:
Name of program this command-line object belongs to.

Reimplemented from TCLAP::CmdLine.

Definition at line 176 of file basis/CmdLine.h.

std::string& sbia::basis::CmdLine::getProjectName ( ) [inline]

Get name of project the program belongs to.

Returns:
Name of project this program belongs to.

Definition at line 183 of file basis/CmdLine.h.

void sbia::basis::CmdLine::parse ( int  argc,
const char *const *  argv 
) [virtual]

Parses the command line.

Parameters:
[in]argcNumber of arguments.
[in]argvArray of arguments.

Reimplemented from TCLAP::CmdLine.

Definition at line 848 of file CmdLine.cxx.

void sbia::basis::CmdLine::parse ( std::vector< std::string > &  args)

Parses the command line.

Parameters:
[in]argsA vector of strings representing the args. args[0] is still the program name.

Reimplemented from TCLAP::CmdLine.

Definition at line 854 of file CmdLine.cxx.

void sbia::basis::CmdLine::xorAdd ( Arg a,
Arg b 
) [virtual]

Add two Args that will be xor'd.

If this method is used, add does not need to be called.

Parameters:
[in]aArgument to be added and xor'd.
[in]bArgument to be added and xor'd.

Reimplemented from TCLAP::CmdLine.

Definition at line 823 of file CmdLine.cxx.

void sbia::basis::CmdLine::xorAdd ( std::vector< Arg * > &  xors) [virtual]

Add a list of arguments that will be xor'd.

If this method is used, add does not need to be called.

Parameters:
[in]xorsList of Args to be added and xor'd.

Reimplemented from TCLAP::CmdLine.

Definition at line 832 of file CmdLine.cxx.


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