NDEVR
API Documentation
ApplicationOptions

The container for storing N-number of ApplicationOption for the program. More...

Collaboration diagram for ApplicationOptions:
[legend]

Public Member Functions

 ApplicationOptions ()
 Constructs an empty ApplicationOptions container.
void addOption (const TranslatedString &group_name, const TranslatedString &name, ApplicationOptionBase *value)
 Adds an option under a specific group name.
void addOption (const TranslatedString &name, ApplicationOptionBase *value)
 Adds an option with no group, placing it in the default group.
void addToINI (const TranslatedString &group_name, INIFactory &factory)
 Serializes a specific option group into the given INI factory.
void addToINI (INIFactory &factory)
 Serializes all option groups into the given INI factory.
const ApplicationOptionBasegetOption (const TranslatedString &group, const TranslatedString &name) const
 Retrieves an option by group and name.
const ApplicationOptionBasegetOption (const TranslatedString &name) const
 Retrieves an option from the default group by name.
void logOptions (LogPtr &log, bool log_only_non_defaults)
 Writes option names and values to the given log.
Dictionary< TranslatedString, ApplicationOptionBase * > optionGroup (TranslatedString)
 Returns all options belonging to a specific group.
void setToDefaults ()
 Resets all options across all groups to their default values.
void setToDefaults (const TranslatedString &group_name)
 Resets all options in a specific group to their default values.

Static Public Member Functions

static ApplicationOptionsUserOptions ()
 Returns the global user options container singleton.

Protected Attributes

Dictionary< TranslatedString, Dictionary< TranslatedString, ApplicationOptionBase * > > m_options
 Nested dictionary mapping group names to option dictionaries.

Detailed Description

The container for storing N-number of ApplicationOption for the program.


Almost all options are typically "user options" and are added to that container by default.

Stores data of any type that can easily be saved or retrieved at runtime. Option belongs to a specific group for easy sorting and can be used to automatically generate widgets.

Definition at line 64 of file ApplicationOptions.h.

Member Function Documentation

◆ addOption() [1/2]

void ApplicationOptions::addOption ( const TranslatedString & group_name,
const TranslatedString & name,
ApplicationOptionBase * value )
inline

Adds an option under a specific group name.

Parameters
[in]group_nameThe translated group name for categorization.
[in]nameThe translated display name of the option.
[in]valuePointer to the ApplicationOptionBase to register.

Definition at line 88 of file ApplicationOptions.h.

References m_options, and name.

◆ addOption() [2/2]

void ApplicationOptions::addOption ( const TranslatedString & name,
ApplicationOptionBase * value )
inline

Adds an option with no group, placing it in the default group.

Parameters
[in]nameThe translated display name of the option.
[in]valuePointer to the ApplicationOptionBase to register.

Definition at line 77 of file ApplicationOptions.h.

References addOption(), and name.

Referenced by addOption().

◆ addToINI() [1/2]

void ApplicationOptions::addToINI ( const TranslatedString & group_name,
INIFactory & factory )

Serializes a specific option group into the given INI factory.

Parameters
[in]group_nameThe translated group name to serialize.
[in]factoryThe INIFactory to write options into.

◆ addToINI() [2/2]

void ApplicationOptions::addToINI ( INIFactory & factory)

Serializes all option groups into the given INI factory.

Parameters
[in]factoryThe INIFactory to write options into.

◆ getOption() [1/2]

const ApplicationOptionBase * ApplicationOptions::getOption ( const TranslatedString & group,
const TranslatedString & name ) const
inline

Retrieves an option by group and name.

Parameters
[in]groupThe translated group name.
[in]nameThe translated option name.
Returns
A const pointer to the matching ApplicationOptionBase, or nullptr if not found.

Definition at line 100 of file ApplicationOptions.h.

References m_options, and name.

Referenced by getOption().

◆ getOption() [2/2]

const ApplicationOptionBase * ApplicationOptions::getOption ( const TranslatedString & name) const
inline

Retrieves an option from the default group by name.

Parameters
[in]nameThe translated option name.
Returns
A const pointer to the matching ApplicationOptionBase, or nullptr if not found.

Definition at line 110 of file ApplicationOptions.h.

References getOption(), and name.

◆ logOptions()

void ApplicationOptions::logOptions ( LogPtr & log,
bool log_only_non_defaults )

Writes option names and values to the given log.

Parameters
[in]logThe log to write to.
[in]log_only_non_defaultsIf true, only logs options that differ from their defaults.

◆ optionGroup()

Dictionary< TranslatedString, ApplicationOptionBase * > ApplicationOptions::optionGroup ( TranslatedString )

Returns all options belonging to a specific group.

Parameters
[in]groupThe translated group name to look up.
Returns
A dictionary mapping option names to their ApplicationOptionBase pointers.

◆ setToDefaults()

void ApplicationOptions::setToDefaults ( const TranslatedString & group_name)

Resets all options in a specific group to their default values.

Parameters
[in]group_nameThe translated group name whose options should be reset.

◆ UserOptions()

ApplicationOptions & ApplicationOptions::UserOptions ( )
static

Returns the global user options container singleton.

Returns
A reference to the shared ApplicationOptions instance for user settings.

References ApplicationOptions().

Referenced by ApplicationOption< t_type >::ApplicationOption(), ApplicationOption< t_type >::ApplicationOption(), and ApplicationOption< t_type >::ApplicationOption().


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