1#ifndef STORM_SETTINGS_OPTIONBUILDER_H_
2#define STORM_SETTINGS_OPTIONBUILDER_H_
4#include <boost/algorithm/string.hpp>
9#include <unordered_set>
36 OptionBuilder(std::string
const& moduleName, std::string
const& longName,
bool requireModulePrefix, std::string
const& description)
40 description(description),
41 moduleName(moduleName),
42 requireModulePrefix(requireModulePrefix),
58 this->shortName = shortName;
59 this->hasShortName =
true;
70 this->isRequired = isRequired;
78 this->isAdvanced = isAdvanced;
89 STORM_LOG_THROW(!this->isBuild, storm::exceptions::IllegalFunctionCallException,
90 "Cannot add an argument to an option builder that was already used to build the option.");
92 storm::exceptions::IllegalArgumentException,
"Unable to add non-optional argument after an option that is optional.");
96 "Unable to add argument to option, because it already has an argument with the same name.");
110 STORM_LOG_THROW(!this->isBuild, storm::exceptions::IllegalFunctionCallException,
"Cannot rebuild an option with one builder.");
111 this->isBuild =
true;
113 if (this->hasShortName) {
114 return std::shared_ptr<Option>(
new Option(this->moduleName, this->longName, this->shortName, this->description, this->isRequired,
115 this->requireModulePrefix, this->isAdvanced, this->arguments));
117 return std::shared_ptr<Option>(
new Option(this->moduleName, this->longName, this->description, this->isRequired, this->requireModulePrefix,
118 this->isAdvanced, this->arguments));
124 std::string longName;
127 std::string shortName;
133 std::string description;
136 std::string moduleName;
139 bool requireModulePrefix;
151 std::vector<std::shared_ptr<ArgumentBase>> arguments;
154 std::unordered_set<std::string> argumentNameSet;
This class provides the interface to create an option...
OptionBuilder & setShortName(std::string const &shortName)
Sets a short name for the option.
OptionBuilder & addArgument(std::shared_ptr< ArgumentBase > argument)
Adds the given argument to the arguments of this option.
OptionBuilder & setIsRequired(bool isRequired)
Sets whether the option is required.
std::shared_ptr< Option > build()
Builds an option from the data that was added to this builder.
OptionBuilder & setIsAdvanced(bool isAdvanced=true)
Sets whether the option is only displayed in the advanced help.
OptionBuilder(std::string const &moduleName, std::string const &longName, bool requireModulePrefix, std::string const &description)
Creates a new option builder for an option with the given module, name and description.
This class represents one command-line option.
#define STORM_LOG_THROW(cond, exception, message)
SettingsType const & getModule()
Get module.