Class Scine::Utils::UniversalSettings::OptionListDescriptor¶
-
class
OptionListDescriptor
: public Scine::Utils::UniversalSettings::SettingDescriptor¶ SettingDescriptor for a list of options, of which one must be chosen.
Public Functions
-
std::unique_ptr<SettingDescriptor>
clone
() const¶ Create a heap-allocated base pointer copy of this instance.
- Return
A heap-allocated copy of this instance
-
GenericValue
getDefaultGenericValue
() const¶ Creates a type-erased representation of the setting’s default value.
- Return
A type-erased representation of the setting’s default value
-
bool
validValue
(const GenericValue &v) const¶ Checks if a particular type-erased representation of a setting is a valid value for this kind of setting.
- Return
Whether the type-erased representation is a valid value for this kind of setting
- Parameters
v
: A type-erased setting representation
-
int
optionCount
() const¶ Returns the number of avilable options.
-
bool
optionExists
(const std::string &name) const¶ Returns whether a string-identified option exists.
-
int
getDefaultIndex
() const¶ Returns the index of the default option within the list of options.
- Exceptions
EmptyOptionListException
: if the list of options is empty
-
const std::string &
getDefaultValue
() const¶ Returns the default chosen value.
-
const std::string &
getDefaultOption
() const¶ Returns the default chosen value.
-
const std::vector<std::string> &
getAllOptions
() const¶ Returns the list of option strings.
-
void
addOption
(std::string option)¶ Adds a string option to the list of options.
- Parameters
option
: A new option string
- Exceptions
OptionAlreadyExistsException
: if the option already exists
-
void
setDefaultOption
(const std::string &def)¶ Sets the default option to a particular string.
- Parameters
def
: The option to select as default
- Exceptions
OptionDoesNotExistException
: if the supplied option does not match an existing option
-
std::unique_ptr<SettingDescriptor>