HepCmdArg


The HepCmdArg class is a base class for one command line argument. HepCmdArg and its subclasses are used to represent one command line argument, either optional or positional. Optional arguments are those specified just after the command with a '-'. Positional arguments occur after all optional arguments.

Optional arguments can be either short args (eg. '-x', '-H') or long args (eg. '--nevents', '--Cut'). All arguments are case-sensitive.

This code was inspired by the CmdLine package of Brad Appleton

See also

HepCmdArgInt, HepCmdArgFloat, HepCmdArgBoolean, HepCmdArgString, HepCmdArgStringList, HepCmdLine,

Declaration

#include "CLHEP/String/CmdArg.h"

class HepCmdArg

Public Member Functions

Constructor
HepCmdArg(char optchar, const HepString & keyword,
const HepString & value, const HepString & description)
Constructor
HepCmdArg(char optchar, const HepString & keyword,
const HepString & description)
Constructor
HepCmdArg(const HepString & value,
const HepString & description)
Destructor
virtual ~HepCmdArg()
charName
inline char charName() const
Get the character (short-option) name of this argument.
description
inline const HepString & description() const
Get the description (help-message) of this argument.
isPositional
inline HepBoolean isPositional() const
Returns true if positional.
isRequired
inline HepBoolean isRequired() const
Returns true if required.
keywordName
inline const HepString & keywordName() const
Get the keyword (long-option) name of this argument.
required
void required(HepBoolean r = true)
Set flag whether this argument is required or not.
setValue
virtual int setValue(int argc, char **arg) = 0
Set the value from a character string. Return the number of args used, -1 if failed
valueName
inline const HepString & valueName() const
Get the value name of this argument.

Example

CLHEP/test/testCmd.cc


30 September 1997
EVC