BDE 4.14.0 Production release
Loading...
Searching...
No Matches
balcl::OccurrenceInfo Class Reference

#include <balcl_occurrenceinfo.h>

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 ()
 Destroy this object.
 
OccurrenceInfooperator= (const OccurrenceInfo &rhs)
 
void setDefaultValue (const OptionValue &defaultValue)
 
void setHidden ()
 
const OptionValuedefaultValue () const
 Return a const reference to the default value of this object.
 
bool hasDefaultValue () const
 
bool isHidden () const
 
bool isRequired () const
 
OccurrenceType occurrenceType () const
 
bslma::Allocatorallocator () 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 balcl_occurrenceinfo

Member Enumeration Documentation

◆ OccurrenceType

Enumerator
e_REQUIRED 
e_OPTIONAL 
e_HIDDEN 

Constructor & Destructor Documentation

◆ OccurrenceInfo() [1/20]

balcl::OccurrenceInfo::OccurrenceInfo ( )

◆ OccurrenceInfo() [2/20]

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.

◆ OccurrenceInfo() [3/20]

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.

◆ OccurrenceInfo() [4/20]

balcl::OccurrenceInfo::OccurrenceInfo ( char  defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [5/20]

balcl::OccurrenceInfo::OccurrenceInfo ( int  defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [6/20]

balcl::OccurrenceInfo::OccurrenceInfo ( bsls::Types::Int64  defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [7/20]

balcl::OccurrenceInfo::OccurrenceInfo ( double  defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [8/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bsl::string defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [9/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bdlt::Datetime defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [10/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bdlt::Date defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [11/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bdlt::Time defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [12/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bsl::vector< char > &  defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [13/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bsl::vector< int > &  defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [14/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bsl::vector< bsls::Types::Int64 > &  defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [15/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bsl::vector< double > &  defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [16/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bsl::vector< bsl::string > &  defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [17/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bsl::vector< bdlt::Datetime > &  defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [18/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bsl::vector< bdlt::Date > &  defaultValue,
bslma::Allocator basicAllocator = 0 
)
explicit

◆ OccurrenceInfo() [19/20]

balcl::OccurrenceInfo::OccurrenceInfo ( const bsl::vector< bdlt::Time > &  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.

◆ OccurrenceInfo() [20/20]

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.

◆ ~OccurrenceInfo()

balcl::OccurrenceInfo::~OccurrenceInfo ( )

Member Function Documentation

◆ allocator()

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.

◆ BSLMF_NESTED_TRAIT_DECLARATION() [1/2]

balcl::OccurrenceInfo::BSLMF_NESTED_TRAIT_DECLARATION ( OccurrenceInfo  ,
bdlb::HasPrintMethod   
)

◆ BSLMF_NESTED_TRAIT_DECLARATION() [2/2]

balcl::OccurrenceInfo::BSLMF_NESTED_TRAIT_DECLARATION ( OccurrenceInfo  ,
bslma::UsesBslmaAllocator   
)

◆ defaultValue()

const OptionValue & balcl::OccurrenceInfo::defaultValue ( ) const

◆ hasDefaultValue()

bool balcl::OccurrenceInfo::hasDefaultValue ( ) const

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

◆ isHidden()

bool balcl::OccurrenceInfo::isHidden ( ) const

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

◆ isRequired()

bool balcl::OccurrenceInfo::isRequired ( ) const

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

◆ occurrenceType()

OccurrenceType balcl::OccurrenceInfo::occurrenceType ( ) const

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

◆ operator=()

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.

◆ print()

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.

◆ setDefaultValue()

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()).

◆ setHidden()

void balcl::OccurrenceInfo::setHidden ( )

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


The documentation for this class was generated from the following file: