[#BloombergLP-balcl-TypeInfo] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balcl.adoc[balcl]::TypeInfo :relfileprefix: ../../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class TypeInfo; ---- == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balcl/TypeInfo/ParseInputSource.adoc[`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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balcl/TypeInfo/2constructor-0e4d.adoc[`TypeInfo`] [.small]#[constructor]# | Constructors | xref:BloombergLP/balcl/TypeInfo/2destructor.adoc[`~TypeInfo`] [.small]#[destructor]# | Destroy this object. | xref:BloombergLP/balcl/TypeInfo/operator_assign.adoc[`operator=`] | Assign to this object the value of the specified `rhs` object and return a reference providing modifiable access to this object. | xref:BloombergLP/balcl/TypeInfo/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/TypeInfo/constraint.adoc[`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. | xref:BloombergLP/balcl/TypeInfo/isOptionalLinkedVariable.adoc[`isOptionalLinkedVariable`] | Return `true` if the described option has a linked variable and that variable is a `bsl::optional` object, and `false` otherwise. | xref:BloombergLP/balcl/TypeInfo/linkedVariable.adoc[`linkedVariable`] | Return the address of the modifiable variable linked to the described option, or 0 if no variable is linked. | xref:BloombergLP/balcl/TypeInfo/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. 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. | xref:BloombergLP/balcl/TypeInfo/resetConstraint.adoc[`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. | xref:BloombergLP/balcl/TypeInfo/resetLinkedVariableAndConstraint.adoc[`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. | xref:BloombergLP/balcl/TypeInfo/setConstraint-02.adoc[`setConstraint`] | `setConstraint` overloads | xref:BloombergLP/balcl/TypeInfo/setLinkedVariable-012.adoc[`setLinkedVariable`] | `setLinkedVariable` overloads | xref:BloombergLP/balcl/TypeInfo/type.adoc[`type`] | Return the type of the described option. Note that the option is a flag if it is of type `OptionType::e_BOOL`. | xref:BloombergLP/balcl/TypeInfo/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<TypeInfo, HasPrintMethod>`] | Nested trait declaration for `bslma::UsesBslmaAllocator`. |=== == Data Members [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balcl/TypeInfo/d_allocator_p.adoc[`d_allocator_p`] | memory allocator (held) | xref:BloombergLP/balcl/TypeInfo/d_constraint_p.adoc[`d_constraint_p`] | constraint on the option value | xref:BloombergLP/balcl/TypeInfo/d_elemType.adoc[`d_elemType`] | type of the option value | xref:BloombergLP/balcl/TypeInfo/d_isOptionalLinkedVariable.adoc[`d_isOptionalLinkedVariable`] | `true` if the linked variable is a `bsl::optional` object | xref:BloombergLP/balcl/TypeInfo/d_linkedVariable_p.adoc[`d_linkedVariable_p`] | Address of the variable linked to this option value (held, not owned). |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balcl/operator_not_eq-04.adoc[`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.) | xref:BloombergLP/balcl/operator_eq-07.adoc[`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.) |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#