DPrefHandler

Collection of preferences, addressed by names, each containing actual value, initial value and default value.

Constructors

this
this(string pName)

Constructs instance of DPrefHandler. pName is later used as directory name in OS user preferences directory.

Members

Functions

addPref
DPrefHandler addPref(string name, T defaultValue)

Create new preference or overwrite an existing one.

configDirectoryPath
string configDirectoryPath()

Get path of the config directory

getActualValue
T getActualValue(string propertyName)

Get actual value of preference specified by provided name. Throws DPrefException if preference with provided name does not exist.

getDefaultValue
T getDefaultValue(string propertyName)

Get default value of preference specified by provided name. Throws DPrefException if preference with provided name does not exist.

getInitialValue
T getInitialValue(string propertyName)

Get iniital value of preference specified by provided name. Throws DPrefException if preference with provided name does not exist.

loadFromFile
string loadFromFile()

Fill actual and initial values of all existing preferences, as well as create new preferences with initial == existing == default values, from config file, that is stored in OS user preferences directory.

name
string name()

Get name of the preference handler (used as name of the config directory)

name
void name(string name)

Set name of the preference handler (used as name of the config directory)

revertActualToDefault
void revertActualToDefault(string propertyName)

Revert actual value to default one for the preference specified by provided name. Throws DPrefException if preference with provided name does not exist.

revertActualToInitial
void revertActualToInitial(string propertyName)

Revert actual value to initial one for the preference specified by provided name. Throws DPrefException if preference with provided name does not exist.

revertAllActualToDefault
void revertAllActualToDefault()

Revert actual values of all preferences to default values.

revertAllActualToInitial
void revertAllActualToInitial()

Revert actual values of all preferences to initial values.

saveToFile
string saveToFile()

Save actual values of all preferences to config file, that is stored in OS user preferences directory.

setActualValue
void setActualValue(string propertyName, T actualValue)

Set provided value as actual value of preference specified by provided name. Throws DPrefException if preference with provided name does not exist.

Meta