This class is a attribute class that describes the type, the variable to be linked, and the constraint on an option. Note that the constraint type is opaque, but it is possible to apply the constraint to an element of the same type as the option and see whether it is valid (using the satisfiesConstraint methods of TypeInfoUtil).

Synopsis

Declared in <balcl_typeinfo.h>

class TypeInfo;

Enums

Name

Description

ParseInputSource

This enumeration differentiates the source of input when parsing an option type. Note that boolean options, in particular, are treated differently when supplied on the command line from how they are treated when supplied by an environment variable (see 'balcl_commandline').

Member Functions

Name

Description

TypeInfo [constructor]

Constructors

~TypeInfo [destructor]

Destroy this object.

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. Note that if no allocator was supplied at construction the currently installed default allocator at construction is used.

constraint

Return a shared pointer to the (opaque) object storing the constraint associated with the described option. If this object has no constraint an empty shared pointer is returned. The lifetime of any shared reference to this object's constraint must not exceed that of this object's allocator.

isOptionalLinkedVariable

Return true if the described option has a linked variable and that variable is a bsl::optional object, and false otherwise.

linkedVariable

Return the address of the modifiable variable linked to the described option, or 0 if no variable is linked.

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. Note that the precondition on spacesPerLevel is atypical for the print aspect; a negative spacesPerLevel typically indicates that the entire output should be formatted on one line.

resetConstraint

Reset this object so that it no longer has a constraint. This method has no effect if the object has no constraint. Note that neither the type attribute nor the linked variable, if any, are changed.

resetLinkedVariableAndConstraint

Reset this object so that it has neither a linked variable nor a constraint. This method has no effect if the object has no linked variable or constraint. Note that the type attribute is not changed.

setConstraint

setConstraint overloads

setLinkedVariable

setLinkedVariable overloads

type

Return the type of the described option. Note that the option is a flag if it is of type OptionType::e_BOOL.

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

Nested trait declaration for bslma::UsesBslmaAllocator.

Data Members

Name

Description

d_allocator_p

memory allocator (held)

d_constraint_p

constraint on the option value

d_elemType

type of the option value

d_isOptionalLinkedVariable

true if the linked variable is a bsl::optional object

d_linkedVariable_p

Address of the variable linked to this option value (held, not owned).

Non-Member Functions

Name

Description

operator!=

Return true if the specified lhs command‐line option info has a different value from the specified rhs command‐line option info, and false otherwise. Two TypeInfo objects do not have the same value if the associated options have different types, or one object has a linked variable and the other either does not or refers to a different variable, and one has a constraint and the other either does not or refers to a different constraint. Note that two objects constructed from copies of the same constraint will not be identical. (Use constraint/`setConstraint` to ensure that both constraints are the same.)

operator==

Return true if the specified lhs and rhs have the same value, and false otherwise. Two TypeInfo objects have the same value if their associated options have the same type, both objects do not have a linked variable or both refer to the same variable, and both do not have a constraint or both refer to the same constraint. Note that two objects constructed from copies of the same constraint will not be identical. (Use constraint/`setConstraint` to ensure that both constraints are the same.)

Created with MrDocs