This class is a simple attribute class that describes a command‐line option occurrence requirement (i.e., required, optional, or optional but hidden) and default value, if any.

Synopsis

Declared in <balcl_occurrenceinfo.h>

class OccurrenceInfo;

Enums

Name

Description

OccurrenceType

Enumerate the occurrence requirements for a command‐line option.

Member Functions

Name

Description

OccurrenceInfo [constructor]

Constructors

~OccurrenceInfo [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.

defaultValue

Return a const reference to the default value of this object.

hasDefaultValue

Return true if this object has a default value, and false otherwise.

isHidden

Return true if the described option is hidden (i.e., not printed in the usage string), and false otherwise.

isRequired

Return true if the described option is required, and false otherwise.

occurrenceType

Return the occurrence type of the described option (i.e., required, optional, or hidden).

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.

setDefaultValue

Set the type and default value of the associated option to the specified defaultValue. The behavior is undefined unless the this object describes an optional argument (e_REQUIRED != occurrenceType()) and defaultValue.type() is neither OptionType::e_BOOL nor 'OptionType::e_VOID nor a null value (false == defaultValue.isNull()).

setHidden

Set the associated option to be hidden. The behavior is undefined unless the option is optional (e_REQUIRED != occurrenceType()).

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

Nested trait declaration for bslma::UsesBslmaAllocator.

Non-Member Functions

Name

Description

operator!=

Return true if the specified lhs and rhs do not have the same value, and false otherwise. Two objects of type OccurrenceInfo do not have the same value if and only if they have different occurrence types, or exactly one has a default value, or else both have a default value but their respective default values have either different types or different values.

operator==

Return true if the specified lhs and rhs have the same value, and false otherwise. Two objects of type OccurrenceInfo have the same value if and only if they have the same occurrence type and either both do not have a default value, or their respective default values have the same type and value.

Created with MrDocs