3#include <NDEVR/String.h>
4#include <NDEVR/GenericOption.h>
5#include <NDEVR/INIFactory.h>
6#include <NDEVR/Dictionary.h>
11 class ResourceListener;
51 lib_assert(!m_options[group_name].hasKey(name),
"Duplicate entry");
52 m_options[group_name][name] = value;
56 return m_options[group][name];
81 template<
class t_type>
110 void set(
const t_type& value,
bool make_default =
false)
122 m_value.addListener(listener, silent_add);
#define lib_assert(expression, message)
Definition LibAssert.h:61
The core of the default object to store data of any type that should persist through sessions of the ...
Definition ApplicationOptions.h:23
virtual bool isDefault() const =0
virtual void setToDefaultValue()=0
virtual INIOption * iniOption()=0
virtual String toString() const =0
virtual void fromString(const String &)=0
virtual ~ApplicationOptionBase()
Definition ApplicationOptions.h:25
The default object to store data of any type that should persist through sessions of the application.
Definition Button.h:57
Resource< t_type > & getResource()
Definition ApplicationOptions.h:106
ApplicationOptions & m_options
Definition ApplicationOptions.h:156
virtual void fromString(const String &value) override
Definition ApplicationOptions.h:128
void set(const t_type &value, bool make_default=false)
Definition ApplicationOptions.h:110
virtual void setToDefaultValue() override
Definition ApplicationOptions.h:136
virtual INIOption * iniOption() override
Definition ApplicationOptions.h:140
const TranslatedString m_group
Definition ApplicationOptions.h:153
ApplicationOption(const TranslatedString &group, const TranslatedString &label, const t_type &value, ApplicationOptions &options=ApplicationOptions::UserOptions())
Definition ApplicationOptions.h:85
virtual String toString() const override
Definition ApplicationOptions.h:124
const TranslatedString m_label
Definition ApplicationOptions.h:154
t_type m_default_value
Definition ApplicationOptions.h:157
ApplicationOption(const TranslatedString &label, const t_type &value, ApplicationOptions &options=ApplicationOptions::UserOptions())
Definition ApplicationOptions.h:94
const TranslatedString & label() const
Definition ApplicationOptions.h:144
void addListener(ResourceListener *listener, bool silent_add=false)
Definition ApplicationOptions.h:120
const TranslatedString & group() const
Definition ApplicationOptions.h:148
t_type get() const
Definition ApplicationOptions.h:102
virtual bool isDefault() const override
Definition ApplicationOptions.h:132
Resource< t_type > m_value
Definition ApplicationOptions.h:155
void setDefaultValue(const t_type &value)
Definition ApplicationOptions.h:116
The container for storing N-number of ApplicationOption for the program. Almost all options are typic...
Definition ApplicationOptions.h:42
void setToDefaults(const TranslatedString &group_name)
void addToINI(const TranslatedString &group_name, INIFactory &factory)
void logOptions(ProgressInfo *log, bool log_only_non_defaults)
void addToINI(INIFactory &factory)
const ApplicationOptionBase * getOption(const TranslatedString &group, const TranslatedString &name) const
Definition ApplicationOptions.h:54
const ApplicationOptionBase * getOption(const TranslatedString &name) const
Definition ApplicationOptions.h:58
void addOption(const TranslatedString &group_name, const TranslatedString &name, ApplicationOptionBase *value)
Definition ApplicationOptions.h:49
void addOption(const TranslatedString &name, ApplicationOptionBase *value)
Definition ApplicationOptions.h:45
Dictionary< TranslatedString, Dictionary< TranslatedString, ApplicationOptionBase * > > m_options
Definition ApplicationOptions.h:69
static ApplicationOptions & UserOptions()
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Contains methods for easily reading and writing to an INI file including efficient casting,...
Definition INIReader.h:68
static INIOption * ToOption(t_type &mem_loc)
Definition INIReader.h:129
A class used with INIFactory to store a reference to an object in the program that can be inherited t...
Definition INIReader.h:49
A light-weight base class for Log that allows processes to update, without the need for additional in...
Definition ProgressInfo.hpp:48
A core part of the engine, stores variables that can be listened to with ResourceListener which will ...
Definition Toggle.h:41
A class that can subscribe to any number of Resources which will get updates when the Resource(s) hav...
Definition ResourceListener.h:62
The core String class for the NDEVR API.
Definition String.h:69
t_type getAs() const
Converts a string into an object. To use this function an object must have overwritten StringStream<t...
Definition String.h:143
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13