[#BloombergLP-balcl-Option] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balcl.adoc[balcl]::Option :relfileprefix: ../../ :mrdocs: 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`. == Synopsis Declared in `<balcl_option.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class Option; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balcl/Option/2constructor-09.adoc[`Option`] [.small]#[constructor]# | Constructors | xref:BloombergLP/balcl/Option/2destructor.adoc[`~Option`] [.small]#[destructor]# | Destroy this command‐line option object. | xref:BloombergLP/balcl/Option/operator_assign-0f.adoc[`operator=`] | Assignment operators | xref:BloombergLP/balcl/Option/allocator.adoc[`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. | xref:BloombergLP/balcl/Option/argType.adoc[`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). | xref:BloombergLP/balcl/Option/description.adoc[`description`] | Return the description of this option. | xref:BloombergLP/balcl/Option/environmentVariableName.adoc[`environmentVariableName`] | Return the environment variable name of this option. | xref:BloombergLP/balcl/Option/isArray.adoc[`isArray`] | Return `true` if the value of this option is of array type, and `false` otherwise. | xref:BloombergLP/balcl/Option/isDescriptionValid.adoc[`isDescriptionValid`] | 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`. | xref:BloombergLP/balcl/Option/isLongTagValid.adoc[`isLongTagValid`] | 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`. | xref:BloombergLP/balcl/Option/isNameValid.adoc[`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`. | xref:BloombergLP/balcl/Option/isTagValid.adoc[`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`. | xref:BloombergLP/balcl/Option/longTag.adoc[`longTag`] | 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). | xref:BloombergLP/balcl/Option/name.adoc[`name`] | Return the name of this option. | xref:BloombergLP/balcl/Option/occurrenceInfo.adoc[`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). | xref:BloombergLP/balcl/Option/print.adoc[`print`] | 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. | xref:BloombergLP/balcl/Option/shortTag.adoc[`shortTag`] | 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). | xref:BloombergLP/balcl/Option/tagString.adoc[`tagString`] | Return the tag string provided to this object at construction. Note that this string is empty if this is a non‐option argument. | xref:BloombergLP/balcl/Option/typeInfo.adoc[`typeInfo`] | 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). | xref:BloombergLP/balcl/Option/2conversion-04.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<Option, HasPrintMethod>`] | Nested trait declaration for `bslma::UsesBslmaAllocator`. | xref:BloombergLP/balcl/Option/2conversion-0f.adoc[`operator OptionInfo const&`] | Return a `const` reference to the `OptionInfo` object having the value of this option. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balcl/operator_not_eq-009.adoc[`operator!=`] | Return `true` if the specified `lhs` command‐line option has a different value from the specified `rhs` command‐line option, and `false` otherwise. Two `Option` objects do not have the same value if their underlying `OptionInfo` objects do not have the same value. | xref:BloombergLP/balcl/operator_eq-09.adoc[`operator==`] | Return `true` if the specified `lhs` and `rhs` have the same value, and `false` otherwise. Two `Option` objects have the same value if their underlying `OptionInfo` objects have the same value. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#