BDE 4.14.0 Production release
|
#include <balcl_occurrenceinfo.h>
Public Types | |
enum | OccurrenceType { e_REQUIRED = 0 , e_OPTIONAL = 1 , e_HIDDEN = 2 } |
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.
balcl::OccurrenceInfo::OccurrenceInfo | ( | ) |
|
explicit |
Construct an OccurrenceInfo
object that describes a command-line option that is optional but not hidden (i.e., e_OPTIONAL == occurrenceType()
) and has no default value. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
balcl::OccurrenceInfo::OccurrenceInfo | ( | OccurrenceType | type, |
bslma::Allocator * | basicAllocator = 0 |
||
) |
Construct an OccurrenceInfo
object that describes a command-line option of the specified type
and has no default value. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
Construct an OccurrenceInfo
object that describes a command-line option that is not required or hidden, and that has the specified defaultValue
. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
balcl::OccurrenceInfo::OccurrenceInfo | ( | const OccurrenceInfo & | original, |
bslma::Allocator * | basicAllocator = 0 |
||
) |
Construct a OccurrenceInfo
object having the value of the specified original
object. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
balcl::OccurrenceInfo::~OccurrenceInfo | ( | ) |
bslma::Allocator * balcl::OccurrenceInfo::allocator | ( | ) | const |
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.
balcl::OccurrenceInfo::BSLMF_NESTED_TRAIT_DECLARATION | ( | OccurrenceInfo | , |
bdlb::HasPrintMethod | |||
) |
balcl::OccurrenceInfo::BSLMF_NESTED_TRAIT_DECLARATION | ( | OccurrenceInfo | , |
bslma::UsesBslmaAllocator | |||
) |
const OptionValue & balcl::OccurrenceInfo::defaultValue | ( | ) | const |
bool balcl::OccurrenceInfo::hasDefaultValue | ( | ) | const |
Return true
if this object has a default value, and false
otherwise.
bool balcl::OccurrenceInfo::isHidden | ( | ) | const |
Return true
if the described option is hidden (i.e., not printed in the usage string), and false
otherwise.
bool balcl::OccurrenceInfo::isRequired | ( | ) | const |
Return true
if the described option is required, and false
otherwise.
OccurrenceType balcl::OccurrenceInfo::occurrenceType | ( | ) | const |
Return the occurrence type of the described option (i.e., required, optional, or hidden).
OccurrenceInfo & balcl::OccurrenceInfo::operator= | ( | const OccurrenceInfo & | rhs | ) |
Assign to this object the value of the specified rhs
object, and return a reference providing modifiable access to this object.
bsl::ostream & balcl::OccurrenceInfo::print | ( | bsl::ostream & | stream, |
int | level = 0 , |
||
int | spacesPerLevel = 4 |
||
) | const |
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.
void balcl::OccurrenceInfo::setDefaultValue | ( | const OptionValue & | defaultValue | ) |
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()
).
void balcl::OccurrenceInfo::setHidden | ( | ) |
Set the associated option to be hidden. The behavior is undefined unless the option is optional (e_REQUIRED != occurrenceType()
).