MongoDB  2.7.0
Public Member Functions | Public Attributes | List of all members
mongo::optionenvironment::OptionDescription Class Reference

The OptionDescription class is a container for information about the options we are expecting either on the command line or in config files. More...

#include <option_description.h>

Public Member Functions

 OptionDescription (const std::string &dottedName, const std::string &singleName, const OptionType type, const std::string &description)
 
OptionDescriptionhidden ()
 Parsing Attributes. More...
 
OptionDescriptionsetDefault (Value defaultValue)
 
OptionDescriptionsetImplicit (Value implicitValue)
 
OptionDescriptioncomposing ()
 
OptionDescriptionsetSources (OptionSources sources)
 
OptionDescriptionpositional (int start, int end)
 
OptionDescriptionvalidRange (long min, long max)
 Validation Constraints. More...
 
OptionDescriptionincompatibleWith (const std::string &otherDottedName)
 Specifies that this option is incompatible with another option. More...
 
OptionDescriptionrequires (const std::string &otherDottedName)
 Specifies that this option is requires another option to be specified. More...
 
OptionDescriptionformat (const std::string &regexFormat, const std::string &displayFormat)
 Specifies that this option is required to match the given format, specified as a regular expression. More...
 
OptionDescriptionaddConstraint (Constraint *c)
 Adds a constraint for this option. More...
 

Public Attributes

std::string _dottedName
 
std::string _singleName
 
OptionType _type
 
std::string _description
 
bool _isVisible
 
Value _default
 
Value _implicit
 
bool _isComposing
 
OptionSources _sources
 
int _positionalStart
 
int _positionalEnd
 
std::vector< boost::shared_ptr
< Constraint > > 
_constraints
 

Detailed Description

The OptionDescription class is a container for information about the options we are expecting either on the command line or in config files.

These should be registered in an OptionSection instance and passed to an OptionsParser.

Member Function Documentation

OptionDescription & mongo::optionenvironment::OptionDescription::addConstraint ( Constraint c)

Adds a constraint for this option.

During parsing, this Constraint will be added to the result Environment, ensuring that it will get checked when the environment is validated. See the documentation on the Constraint and Environment classes for more details.

WARNING: This function takes ownership of the Constraint pointer that is passed in.

OptionDescription & mongo::optionenvironment::OptionDescription::format ( const std::string &  regexFormat,
const std::string &  displayFormat 
)

Specifies that this option is required to match the given format, specified as a regular expression.

The displayFormat argument is what gets printed to the user in the case where this constraint is not satisfied. This is only allowed on String options.

OptionDescription & mongo::optionenvironment::OptionDescription::hidden ( )

Parsing Attributes.

The functions below specify various attributes of our option that are relevant for parsing.

OptionDescription & mongo::optionenvironment::OptionDescription::incompatibleWith ( const std::string &  otherDottedName)

Specifies that this option is incompatible with another option.

The string provided must be the dottedName, which is the name used to access the option in the result Environment.

TODO: Find a way to check that that option actually exists in our section somewhere.

OptionDescription & mongo::optionenvironment::OptionDescription::requires ( const std::string &  otherDottedName)

Specifies that this option is requires another option to be specified.

The string provided must be the dottedName, which is the name used to access the option in the result Environment.

OptionDescription & mongo::optionenvironment::OptionDescription::validRange ( long  min,
long  max 
)

Validation Constraints.

The functions below specify constraints that must be met in order for this option to be valid. These do not get checked during parsing, but will be added to the result Environment so that they will get checked when the Environment is validated. Specifies the range allowed for this option. Only allowed for options with numeric type.


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