#include <balcl_occurrenceinfo.h>
List of all members.
Public Types |
enum | OccurrenceType { e_REQUIRED = 0,
e_OPTIONAL = 1,
e_HIDDEN = 2
} |
Public Member Functions |
| BSLMF_NESTED_TRAIT_DECLARATION (OccurrenceInfo, bslma::UsesBslmaAllocator) |
| BSLMF_NESTED_TRAIT_DECLARATION (OccurrenceInfo, bdlb::HasPrintMethod) |
| OccurrenceInfo () |
| OccurrenceInfo (bslma::Allocator *basicAllocator) |
| OccurrenceInfo (OccurrenceType type, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (char defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (int defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (bsls::Types::Int64 defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (double defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bsl::string &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bdlt::Datetime &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bdlt::Date &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bdlt::Time &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bsl::vector< char > &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bsl::vector< int > &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bsl::vector< bsls::Types::Int64 > &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bsl::vector< double > &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bsl::vector< bsl::string > &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bsl::vector< bdlt::Datetime > &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bsl::vector< bdlt::Date > &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const bsl::vector< bdlt::Time > &defaultValue, bslma::Allocator *basicAllocator=0) |
| OccurrenceInfo (const OccurrenceInfo &original, bslma::Allocator *basicAllocator=0) |
| ~OccurrenceInfo () |
OccurrenceInfo & | operator= (const OccurrenceInfo &rhs) |
void | setDefaultValue (const OptionValue &defaultValue) |
void | setHidden () |
const OptionValue & | defaultValue () const |
bool | hasDefaultValue () const |
bool | isHidden () const |
bool | isRequired () const |
OccurrenceType | occurrenceType () const |
bslma::Allocator * | allocator () const |
bsl::ostream & | print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const |
Detailed Description
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.
See Component balcl_occurrenceinfo
Member Enumeration Documentation
- Enumerator:
e_REQUIRED |
option is required and not hidden
|
e_OPTIONAL |
option is optional and not hidden
|
e_HIDDEN |
option is optional and hidden
|
Constructor & Destructor Documentation
balcl::OccurrenceInfo::OccurrenceInfo |
( |
|
) |
|
balcl::OccurrenceInfo::OccurrenceInfo |
( |
bslma::Allocator * |
basicAllocator |
) |
[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.
IMPLICIT: 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.
balcl::OccurrenceInfo::OccurrenceInfo |
( |
char |
defaultValue, |
|
|
bslma::Allocator * |
basicAllocator = 0 | |
|
) |
| | [explicit] |
balcl::OccurrenceInfo::OccurrenceInfo |
( |
int |
defaultValue, |
|
|
bslma::Allocator * |
basicAllocator = 0 | |
|
) |
| | [explicit] |
balcl::OccurrenceInfo::OccurrenceInfo |
( |
double |
defaultValue, |
|
|
bslma::Allocator * |
basicAllocator = 0 | |
|
) |
| | [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.
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 |
( |
|
) |
|
Member Function Documentation
Assign to this object the value of the specified rhs
object, and return a reference providing modifiable access to this object.
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 'OptionTypee_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()
).
const OptionValue& balcl::OccurrenceInfo::defaultValue |
( |
|
) |
const |
Return a const
reference to the default value of this object.
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.
Return the occurrence type of the described option (i.e., required, optional, or hidden).
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.
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.
The documentation for this class was generated from the following file: