Class Scine::Utils::UniversalSettings::SettingDescriptor

class SettingDescriptor

Class to restrict a particular setting’s type and values.

Contains a string explaining what the setting is for, possibly a default value and a function that checks if the contained value is valid for the setting described.

This is an abstract base class for type-specific descriptor implementations. Other classes derive from it not because of the need for polymorphism, but to collect common functionality (i.e. property description).

Subclassed by Scine::Utils::UniversalSettings::BoolDescriptor, Scine::Utils::UniversalSettings::CollectionListDescriptor, Scine::Utils::UniversalSettings::DescriptorCollection, Scine::Utils::UniversalSettings::DirectoryDescriptor, Scine::Utils::UniversalSettings::DoubleDescriptor, Scine::Utils::UniversalSettings::FileDescriptor, Scine::Utils::UniversalSettings::IntDescriptor, Scine::Utils::UniversalSettings::IntListDescriptor, Scine::Utils::UniversalSettings::OptionListDescriptor, Scine::Utils::UniversalSettings::ParametrizedOptionListDescriptor, Scine::Utils::UniversalSettings::StringDescriptor, Scine::Utils::UniversalSettings::StringListDescriptor

Public Functions

virtual std::unique_ptr<SettingDescriptor> clone() const = 0

Create a heap-allocated base pointer copy of this instance.

Return

A heap-allocated copy of this instance

void setPropertyDescription(std::string propertyDescription)

Changes the string explanation of what the setting is for.

Parameters
  • propertyDescription: The string explanation of what the setting is for

const std::string &getPropertyDescription() const

Fetches the string explanation of what the setting is for.

Return

The string explanation of what the setting is for

virtual GenericValue getDefaultGenericValue() const = 0

Creates a type-erased representation of the setting’s default value.

Return

A type-erased representation of the setting’s default value

virtual bool validValue(const GenericValue &v) const = 0

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

Protected Functions

SettingDescriptor(std::string propertyDescription)

Allow instantiation only through derived classes.