#include <parsecl.hpp>
Inheritance diagram for Arak::Util::CommandLine::Option:
Definition at line 27 of file parsecl.hpp.
Public Member Functions | |
Option (const char *sflag, const char *lflag, const char *desc, bool required=false) | |
Constructor. | |
virtual | ~Option () |
Destructor. | |
virtual bool | supplied () const |
Returns true (after parsing) if this option was supplied on the command line. | |
virtual bool | hasArg () |
Returns true if this option takes an argument. | |
Protected Member Functions | |
bool | matches (const char *flag) const |
Returns true if the supplied flag matches this option. | |
virtual bool | read (const char *str) |
This is a placeholder for functionality in a derived class. | |
virtual void | printUsage (std::ostream &out) const |
Prints the usage of this option to the supplied output stream. | |
Protected Attributes | |
const char * | sflag |
The short form of the option. | |
const char * | lflag |
The lflag form of the option. | |
const char * | desc |
A description of the option. | |
bool | _supplied |
This flag is true iff the option was supplied on the command line. | |
const bool | required |
This flag is true iff the option is required. | |
Friends | |
class | CommandLine |
|
Constructor.
Definition at line 114 of file parsecl.hpp. |
|
Destructor.
Definition at line 122 of file parsecl.hpp. |
|
Returns true if this option takes an argument.
Reimplemented in Arak::Util::CommandLine::Parameter< T >, and Arak::Util::CommandLine::MultiParameter< T >. Definition at line 133 of file parsecl.hpp. Referenced by Arak::Util::CommandLine::parse(). |
|
Returns true if the supplied flag matches this option. A flag matches if it is a prefix of the option's short or long flag names.
Definition at line 70 of file parsecl.hpp. Referenced by Arak::Util::CommandLine::parse(). |
|
Prints the usage of this option to the supplied output stream.
Reimplemented in Arak::Util::CommandLine::Parameter< T >, and Arak::Util::CommandLine::MultiParameter< T >. Definition at line 91 of file parsecl.hpp. References desc, lflag, and sflag. Referenced by Arak::Util::CommandLine::printUsage(). |
|
This is a placeholder for functionality in a derived class. It should not be called.
Reimplemented in Arak::Util::CommandLine::Parameter< T >, and Arak::Util::CommandLine::MultiParameter< T >. Definition at line 83 of file parsecl.hpp. Referenced by Arak::Util::CommandLine::parse(). |
|
Returns true (after parsing) if this option was supplied on the command line.
Definition at line 128 of file parsecl.hpp. References _supplied. Referenced by main(). |
|
Reimplemented in Arak::Util::CommandLine::Parameter< T >, and Arak::Util::CommandLine::MultiParameter< T >. Definition at line 29 of file parsecl.hpp. |
|
This flag is true iff the option was supplied on the command line.
Definition at line 55 of file parsecl.hpp. Referenced by Option(), Arak::Util::CommandLine::parse(), and supplied(). |
|
A description of the option. This should be a string with no formatting (e.g., no newlines). Definition at line 49 of file parsecl.hpp. Referenced by printUsage(). |
|
The lflag form of the option. This is usually preceded by a double dash, as in "--help". Definition at line 43 of file parsecl.hpp. Referenced by matches(), and printUsage(). |
|
This flag is true iff the option is required.
Definition at line 60 of file parsecl.hpp. Referenced by Option(), and Arak::Util::CommandLine::parse(). |
|
The short form of the option. This is usually preceded by a single dash and consists of a single letter, as in "-h". Definition at line 37 of file parsecl.hpp. Referenced by matches(), Arak::Util::CommandLine::parse(), and printUsage(). |