#include <balcl_option.h>
This class
, constructible from and implicitly convertible to OptionInfo
, provides the same attributes, but also uses a bslma::Allocator
and thus can be stored in a container. A minor subtlety arises in the name
attribute, whereby any suffix starting with an =
sign in the name
attribute of a OptionInfo
is removed in order to derive the name
of the Option
.
See balcl_option
◆ Option() [1/4]
balcl::Option::Option |
( |
| ) |
|
◆ Option() [2/4]
Create a default (empty) command-line option. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
◆ Option() [3/4]
Create a command-line option containing the value of the specified optionInfo
. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
◆ Option() [4/4]
Create a Option
object having the same value as the specified original
object. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
◆ ~Option()
balcl::Option::~Option |
( |
| ) |
|
◆ allocator()
Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the currently installed default allocator at construction is used.
◆ argType()
Return the ArgType
enumerator identifying whether this option is a flag (i.e., a tag not followed by a value), or whether it is an option (i.e., a tag followed by a value), or a non-option argument (i.e., a value not preceded by a short or long tag).
◆ BSLMF_NESTED_TRAIT_DECLARATION() [1/2]
◆ BSLMF_NESTED_TRAIT_DECLARATION() [2/2]
◆ description()
const bsl::string & balcl::Option::description |
( |
| ) |
const |
◆ environmentVariableName()
const bsl::string & balcl::Option::environmentVariableName |
( |
| ) |
const |
◆ isArray()
bool balcl::Option::isArray |
( |
| ) |
const |
Return true
if the value of this option is of array type, and false
otherwise.
◆ isDescriptionValid()
bool balcl::Option::isDescriptionValid |
( |
bsl::ostream & |
stream | ) |
const |
Return true
if the description is valid for this option, leaving the specified stream
unaffected; otherwise, write a diagnostic message to stream
and return false
.
◆ isLongTagValid()
bool balcl::Option::isLongTagValid |
( |
const char * |
longTag, |
|
|
bsl::ostream & |
stream |
|
) |
| const |
Return true
if the specified longTag
is valid for this option, leaving the specified stream
unaffected; otherwise, write a diagnostic message to stream
and return false
.
◆ isNameValid()
bool balcl::Option::isNameValid |
( |
bsl::ostream & |
stream | ) |
const |
Return true
if the name is valid for this option, leaving the specified stream
unaffected; otherwise, write a diagnostic message to stream
and return false
.
◆ isTagValid()
bool balcl::Option::isTagValid |
( |
bsl::ostream & |
stream | ) |
const |
Return true
if the tag is valid for this option, leaving the specified stream
unaffected; otherwise, write a diagnostic message to stream
and return false
.
◆ longTag()
const char * balcl::Option::longTag |
( |
| ) |
const |
Return the string used to identify this option on a command line preceded with --
, or 0 if there is no long tag associated with this option. The behavior is undefined if this option is a non-option argument (i.e., has no tag).
◆ name()
◆ occurrenceInfo()
Return a const
reference to the occurrence info for this option (i.e., whether the option is required, optional, or hidden, and its default value, if any).
◆ operator const OptionInfo &()
balcl::Option::operator const OptionInfo & |
( |
| ) |
const |
Return a const
reference to the OptionInfo
object having the value of this option.
◆ operator=() [1/2]
Assign to this object the value of the specified rhs
object and return a reference providing modifiable access to this object.
◆ operator=() [2/2]
◆ print()
bsl::ostream & balcl::Option::print |
( |
bsl::ostream & |
stream, |
|
|
int |
level = 0 , |
|
|
int |
spacesPerLevel = 4 |
|
) |
| const |
Format this object to the specified output stream
at the (absolute value of) the optionally specified indentation level
and return a reference to stream
. If level
is specified, optionally specify spacesPerLevel
, the number of spaces per indentation level for this object. If level
is negative, suppress indentation of the first line. If stream
is not valid on entry, this operation has no effect. The behavior is undefined if spacesPerLevel
is negative.
◆ shortTag()
char balcl::Option::shortTag |
( |
| ) |
const |
Return the single character used to identify this option on a command line preceded with a single -
, or 0 if this option only has a long tag. The behavior is undefined if this option is a non-option argument (i.e., has no tag).
◆ tagString()
Return the tag string provided to this object at construction. Note that this string is empty if this is a non-option argument.
◆ typeInfo()
const TypeInfo & balcl::Option::typeInfo |
( |
| ) |
const |
Return a const
reference to the type info for this option (i.e., the type of the option, whether the option is linked to a variable, and whether it has a constraint).
The documentation for this class was generated from the following file: