![]() |
NDEVR
API Documentation
|
Stores a groups of GenericOptions that can be used to group them. More...
Public Member Functions | |
| GenericOptionGroup ()=default | |
| Default constructor. | |
| GenericOptionGroup (const TranslatedString &group_name, const StringView &group_id=StringView()) | |
| Constructs an option group with the given name and optional identifier. | |
| virtual | ~GenericOptionGroup () |
| Virtual destructor. | |
| void | addOption (const GenericOption &option) |
| Adds a fully configured GenericOption to this group. | |
| template<class t_type> | |
| void | addOption (const TranslatedString &name, const t_type &value, bool is_editable=true) |
| Adds a new option to this group with the given name and typed value. | |
| void | addOptionsToINI (INIFactory &factory) |
| Adds all options in this group to an existing INIFactory for serialization. | |
| void | clear () |
| Removes all options from this group. | |
| virtual void | fromJSONNode (const JSONNode &node) |
| Deserializes this option group from a JSON node. | |
| GenericOption & | getOption (const TranslatedString &n) |
| Retrieves a mutable reference to the option with the given translated name. | |
| const GenericOption & | getOption (const TranslatedString &n) const |
| Retrieves a const reference to the option with the given translated name. | |
| template<class t_type> | |
| t_type | getValue (const StringView &name) const |
| Retrieves the value of an option converted to the requested type, looked up by string identifier. | |
| template<class t_type> | |
| t_type | getValue (const StringView &name, const t_type &value_if_not_exist) const |
| Retrieves the value of an option by string identifier, returning a fallback if the option does not exist. | |
| template<class t_type> | |
| t_type | getValue (const TranslatedString &name) const |
| Retrieves the value of an option converted to the requested type, looked up by translated name. | |
| template<class t_type> | |
| t_type | getValue (const TranslatedString &name, const t_type &value_if_not_exist) const |
| Retrieves the value of an option by translated name, returning a fallback if the option does not exist. | |
| bool | hasOption (const StringView &option_name) const |
| Checks whether an option with the given string identifier exists in this group. | |
| bool | hasOption (const TranslatedString &option_name) const |
| Checks whether an option with the given translated name exists in this group. | |
| INIFactory | ini () |
| Creates an INIFactory for serializing this option group to INI format. | |
| bool | operator!= (const GenericOptionGroup &option_group) const |
| Checks inequality between two option groups. | |
| bool | operator== (const GenericOptionGroup &option_group) const |
| Checks equality between two option groups by comparing all option values. | |
| void | setOption (const GenericOption &option) |
| Replaces an existing option with the given GenericOption, matched by its identifier. | |
| template<class t_type> | |
| void | setValue (const StringView &name, const t_type &value) |
| Sets the value of an existing option identified by its string name. | |
| template<class t_type> | |
| void | setValue (const TranslatedString &name, const t_type &value) |
| Sets the value of an existing option identified by its translated name. | |
| virtual JSONNode | toJSONNode (bool only_value=true) const |
| Serializes this option group to a JSON node. | |
Public Attributes | |
| String | id |
| The unique identifier for this option group. | |
| TranslatedString | name |
| The user-facing display name of this option group. | |
| Dictionary< String, GenericOption > | options |
| The dictionary mapping option identifiers to their GenericOption instances. | |
| Buffer< String > | ordered_options |
| The insertion-ordered list of option identifiers for preserving display order. | |
Stores a groups of GenericOptions that can be used to group them.
Definition at line 195 of file GenericOptions.h.
|
default |
| GenericOptionGroup::GenericOptionGroup | ( | const TranslatedString & | group_name, |
| const StringView & | group_id = StringView() ) |
Constructs an option group with the given name and optional identifier.
| [in] | group_name | The user-facing display name for this group. |
| [in] | group_id | An optional unique identifier for this group. |
|
inline |
Adds a fully configured GenericOption to this group.
| [in] | option | The GenericOption to add. |
Definition at line 229 of file GenericOptions.h.
References GenericOption::id, options, and ordered_options.
|
inline |
Adds a new option to this group with the given name and typed value.
| [in] | name | The user-facing display name for the option. |
| [in] | value | The initial value for the option. |
| [in] | is_editable | Whether the option should be editable by the user. |
Definition at line 219 of file GenericOptions.h.
References addOption(), GenericOption::is_editable, and name.
Referenced by addOption(), IMUNoiseSimulator::addVector(), IMUNoiseSimulator::groups(), and ProgressWidgetDemo::options().
| void GenericOptionGroup::addOptionsToINI | ( | INIFactory & | factory | ) |
Adds all options in this group to an existing INIFactory for serialization.
| [in] | factory | The INIFactory to add options to. |
|
virtual |
Deserializes this option group from a JSON node.
| [in] | node | The JSONNode to read option data from. |
|
inline |
Retrieves a mutable reference to the option with the given translated name.
| [in] | n | The translated name of the option. |
Definition at line 302 of file GenericOptions.h.
References options, and TranslatedString::readableID().
|
inline |
Retrieves a const reference to the option with the given translated name.
| [in] | n | The translated name of the option. |
Definition at line 293 of file GenericOptions.h.
References options, and TranslatedString::readableID().
|
inline |
Retrieves the value of an option converted to the requested type, looked up by string identifier.
| [in] | name | The string identifier of the option. |
Definition at line 323 of file GenericOptions.h.
|
inline |
Retrieves the value of an option by string identifier, returning a fallback if the option does not exist.
| [in] | name | The string identifier of the option. |
| [in] | value_if_not_exist | The fallback value returned if the option is not found. |
Definition at line 350 of file GenericOptions.h.
|
inline |
Retrieves the value of an option converted to the requested type, looked up by translated name.
| [in] | name | The translated name of the option. |
Definition at line 313 of file GenericOptions.h.
Referenced by IMUNoiseSimulator::setAccelerometerOptions(), IMUNoiseSimulator::setGyroOptions(), IMUNoiseSimulator::setVector(), and ProgressWidgetDemo::UpdateWidgetDemo().
|
inline |
Retrieves the value of an option by translated name, returning a fallback if the option does not exist.
| [in] | name | The translated name of the option. |
| [in] | value_if_not_exist | The fallback value returned if the option is not found. |
Definition at line 335 of file GenericOptions.h.
|
inline |
Checks whether an option with the given string identifier exists in this group.
| [in] | option_name | The string identifier to look up. |
Definition at line 249 of file GenericOptions.h.
References options.
|
inline |
Checks whether an option with the given translated name exists in this group.
| [in] | option_name | The translated name to look up. |
Definition at line 240 of file GenericOptions.h.
References options, and TranslatedString::readableID().
| INIFactory GenericOptionGroup::ini | ( | ) |
Creates an INIFactory for serializing this option group to INI format.
| bool GenericOptionGroup::operator!= | ( | const GenericOptionGroup & | option_group | ) | const |
Checks inequality between two option groups.
| [in] | option_group | The GenericOptionGroup to compare against. |
References GenericOptionGroup().
| bool GenericOptionGroup::operator== | ( | const GenericOptionGroup & | option_group | ) | const |
Checks equality between two option groups by comparing all option values.
| [in] | option_group | The GenericOptionGroup to compare against. |
References GenericOptionGroup().
|
inline |
Replaces an existing option with the given GenericOption, matched by its identifier.
| [in] | option | The GenericOption to replace with. |
Definition at line 280 of file GenericOptions.h.
References GenericOption::id, options, and ordered_options.
|
inline |
Sets the value of an existing option identified by its string name.
| [in] | name | The string identifier of the option to update. |
| [in] | value | The new value to set. |
Definition at line 271 of file GenericOptions.h.
|
inline |
Sets the value of an existing option identified by its translated name.
| [in] | name | The translated name of the option to update. |
| [in] | value | The new value to set. |
Definition at line 260 of file GenericOptions.h.
|
nodiscardvirtual |
Serializes this option group to a JSON node.
| [in] | only_value | Whether to serialize only the current values or include metadata. |