This class implements a special‐use value‐semantic variant type used to represent values parsed from process command lines.

Synopsis

Declared in <balcl_optionvalue.h>

class OptionValue;

Description

Accordingly, this class can represent values of any of the types defined in balcl_optiontype. Furthermore, that value can also be in a null state (defined type but no defined value) to represent allowed options that do not appear among the command‐line arguments (and for which no default value has been configured).

Member Functions

Name

Description

OptionValue [constructor]

Constructors

operator=

Assign to this object the value of the specified rhs object, and return a reference providing modifiable access to this object.

allocator

Return the allocator used by this object to supply memory.

hasNonVoidType

Return true if this object is in the unset state, and false otherwise. Note that if false == hasNonVoidType() then OptionType::e_VOID == type().

isNull

Return true if the value of this object (irrespective of non‐`void` type) is null. The behavior is undefined unless true == hasNonVoidType().

print

Write the value of this object to the specified output stream.

reset

Reset this object to its default constructed (unset) state. The existing value, if any, is destroyed. Note that on return OptionType::e_VOID == type().

set

Set the value of this object to the specified value.

setNull

Set the value of this object, irrespective of that value's type, to its null state.

setType

Set the type of this object to the specified type and the value to the default value of that type.

swap

Efficiently exchange the value of this object with the value of the specified other object.

the

the overloads

type

Return the type of this command‐line‐option value. The type OptionType::e_VOID represents the unset state.

operator BloombergLP::bslmf::NestedTraitDeclaration<OptionValue, HasPrintMethod>

Nested trait declaration for bslma::UsesBslmaAllocator.

Friends

Name

Description

BloombergLP::balcl::swap

Swap the value of the specified a object with the value of the specified b object.

BloombergLP::balcl::operator==

Return true if the specified lhs and rhs objects have the same value, and false otherwise.

Non-Member Functions

Name

Description

operator!=

Return true if the specified lhs and rhs objects do not have the same value, and false otherwise.

Created with MrDocs