BloombergLP::balcl::Option

This class is an allocator-aware, in-core descriptor for a command-line option.

Synopsis

Declared in <balcl_option.h>

class Option;

Description

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.

Member Functions

NameDescription
Option [constructor]Constructors
~Option [destructor]Destroy this command-line option object.
operator= Assignment operators
allocator Return the allocator used by this object to supply memory.
argType Return whether this option is a flag, option, or non-option argument.
description Return the description of this option.
environmentVariableName Return the environment variable name of this option.
isArray Return true if the value of this option is of array type, and false otherwise.
isDescriptionValid Return whether the description is valid for this option.
isLongTagValid Return whether the specified longTag is valid for this option.
isNameValid 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 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 Return the long tag for this option, or 0 if none.
name Return the name of this option.
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).
print Format this object to the specified output stream and return a reference to stream.
shortTag Return the short tag character for this option, or 0 if none.
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 Return a const reference to the type info for this option.
operator BloombergLP::bslmf::NestedTraitDeclaration<Option, HasPrintMethod> Nested trait declaration for bslma::UsesBslmaAllocator.
operator OptionInfo const& Return a const reference to the OptionInfo object having the value of this option.

Non-Member Functions

NameDescription
operator!=Return true if the specified lhs and rhs do not have the same value.
operator==Return true if the specified lhs and rhs have the same value.