Appearance
DefaultsAPI
cpp
#include <VAmiga.h>cpp
class DefaultsAPIDefined in VAmiga.h:2096
The user's defaults storage
The defaults storage manages all configuration settings that persist across multiple application launches. It provides the following functionality:
Loading and saving the storage data You can persist the user's defaults storage in a file, a stream, or a string stream.
Reading and writing key-value pairs The return value is read from the user's defaults storage for registered keys. For unknown keys, an exception is thrown.
Registerung fallback values The fallback value is used for registered keys with no custom value set.
NOTE
Setting a fallback value for an unknown key is permitted. In this case, a new key is registered together with the provided default value. The GUI utilizes this feature to register additional keys, such as keys storing shader-relevant parameters that are irrelevant to the emulation core.
Public Methods
| Return | Name | Description |
|---|---|---|
void | load | Loads a storage file from disk. |
void | load | Loads a storage file from a stream. |
void | load | Loads a storage file from a string stream. |
void | save | Saves a storage file to disk. |
void | save | Saves a storage file to stream. |
void | save | Saves a storage file to a string stream. |
string | getRaw const | Queries a key-value pair. |
i64 | get const | Queries a key-value pair. |
i64 | get const | Queries a key-value pair. |
string | getFallbackRaw const | Queries a fallback key-value pair. |
i64 | getFallback const | Queries a fallback key-value pair. |
i64 | getFallback const | Queries a fallback key-value pair. |
void | set | Writes a key-value pair into the user storage. |
void | set | Writes a key-value pair into the user storage. |
void | set | Writes multiple key-value pairs into the user storage. |
void | set | Writes a key-value pair into the user storage. |
void | set | Writes multiple key-value pairs into the user storage. |
void | setFallback | Writes a key-value pair into the fallback storage. |
void | setFallback | Writes a key-value pair into the fallback storage. |
void | setFallback | Writes multiple key-value pairs into the fallback storage. |
void | setFallback | Writes a key-value pair into the fallback storage. |
void | setFallback | Writes multiple key-value pairs into the fallback storage. |
void | remove | Deletes all key-value pairs. |
void | remove | Deletes a key-value pair. |
void | remove | Deletes a key-value pair. |
void | remove | Deletes multiple key-value pairs. |
DefaultsAPI inline | Creates an API object that operates on the given defaults storage. |
load
cpp
void load(const std::filesystem::path & path)Defined in VAmiga.h:2115
Loads a storage file from disk.
Exceptions
| Exception | Description |
|---|---|
IOError | (IOError::FILE_NOT_FOUND) |
CoreError | (CoreError::SYNTAX) |
load
cpp
void load(std::ifstream & stream)Defined in VAmiga.h:2120
Loads a storage file from a stream.
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::SYNTAX) |
load
cpp
void load(std::stringstream & stream)Defined in VAmiga.h:2125
Loads a storage file from a string stream.
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::SYNTAX) |
save
cpp
void save(const std::filesystem::path & path)Defined in VAmiga.h:2130
Saves a storage file to disk.
Exceptions
| Exception | Description |
|---|---|
IOError | (IOError::FILE_CANT_WRITE) |
save
cpp
void save(std::ofstream & stream)Defined in VAmiga.h:2136
Saves a storage file to stream.
Exceptions
| Exception | Description |
|---|---|
Error | if the file cannot be written. |
save
cpp
void save(std::stringstream & stream)Defined in VAmiga.h:2142
Saves a storage file to a string stream.
Exceptions
| Exception | Description |
|---|---|
Error | if the file cannot be written. |
getRaw
const
cpp
string getRaw(const string & key) constDefined in VAmiga.h:2154
Queries a key-value pair.
Returns
The value as a string.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | const string & | The key. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
get
const
cpp
i64 get(const string & key) constDefined in VAmiga.h:2161
Queries a key-value pair.
Returns
The value as an integer. 0 if the value cannot not be parsed.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | const string & | The key. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
get
const
cpp
i64 get(Opt opt, isize nr = 0) constDefined in VAmiga.h:2169
Queries a key-value pair.
Returns
The value as an integer.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | A config option whose name is used as the prefix of the key. |
nr | isize | Optional number that is appened to the key as suffix. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
getFallbackRaw
const
cpp
string getFallbackRaw(const string & key) constDefined in VAmiga.h:2176
Queries a fallback key-value pair.
Returns
The value as a string.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | const string & | The key. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
getFallback
const
cpp
i64 getFallback(const string & key) constDefined in VAmiga.h:2183
Queries a fallback key-value pair.
Returns
The value as an integer. 0 if the value cannot not be parsed.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | const string & | The key. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
getFallback
const
cpp
i64 getFallback(Opt opt, isize nr = 0) constDefined in VAmiga.h:2191
Queries a fallback key-value pair.
Returns
The value as an integer.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | A config option whose name is used as the key. |
nr | isize | Optional number that is appened to the key as suffix. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
set
cpp
void set(const string & key, const string & value)Defined in VAmiga.h:2203
Writes a key-value pair into the user storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | const string & | The key, given as a string. |
value | const string & | The value, given as a string. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
set
cpp
void set(Opt opt, const string & value)Defined in VAmiga.h:2210
Writes a key-value pair into the user storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | The option's name forms the prefix of the keys. |
value | const string & | The value, given as a string. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
set
cpp
void set(Opt opt, const string & value, std::vector< isize > objids)Defined in VAmiga.h:2218
Writes multiple key-value pairs into the user storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | The option's name forms the prefix of the keys. |
value | const string & | The value for all pairs, given as a string. |
objids | std::vector< isize > | The keys are parameterized by adding the vector values as suffixes. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
set
cpp
void set(Opt opt, i64 value)Defined in VAmiga.h:2225
Writes a key-value pair into the user storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | The option's name forms the prefix of the keys. |
value | i64 | The value, given as an integer. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
set
cpp
void set(Opt opt, i64 value, std::vector< isize > objids)Defined in VAmiga.h:2233
Writes multiple key-value pairs into the user storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | The option's name forms the prefix of the keys. |
value | i64 | The value for all pairs, given as an integer. |
objids | std::vector< isize > | The keys are parameterized by adding the vector values as suffixes. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
setFallback
cpp
void setFallback(const string & key, const string & value)Defined in VAmiga.h:2239
Writes a key-value pair into the fallback storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | const string & | The key, given as a string. |
value | const string & | The value, given as a string. |
setFallback
cpp
void setFallback(Opt opt, const string & value)Defined in VAmiga.h:2246
Writes a key-value pair into the fallback storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | The option's name forms the prefix of the keys. |
value | const string & | The value, given as an integer. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
setFallback
cpp
void setFallback(Opt opt, const string & value, std::vector< isize > objids)Defined in VAmiga.h:2253
Writes multiple key-value pairs into the fallback storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | The option's name forms the prefix of the keys. |
value | const string & | The shared value for all pairs, given as a string. |
objids | std::vector< isize > | The keys are parameterized by adding the vector values as suffixes. |
setFallback
cpp
void setFallback(Opt opt, i64 value)Defined in VAmiga.h:2260
Writes a key-value pair into the fallback storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | The option's name forms the prefix of the keys. |
value | i64 | The value, given as an integer. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
setFallback
cpp
void setFallback(Opt opt, i64 value, std::vector< isize > objids)Defined in VAmiga.h:2267
Writes multiple key-value pairs into the fallback storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | The option's name forms the prefix of the keys. |
value | i64 | The shared value for all pairs, given as an integer. |
objids | std::vector< isize > | The keys are parameterized by adding the vector values as suffixes. |
remove
cpp
void remove()Defined in VAmiga.h:2276
Deletes all key-value pairs.
remove
cpp
void remove(const string & key)Defined in VAmiga.h:2282
Deletes a key-value pair.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | const string & | The key of the key-value pair. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
remove
cpp
void remove(Opt opt)Defined in VAmiga.h:2288
Deletes a key-value pair.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | The option's name forms the key. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
remove
cpp
void remove(Opt opt, std::vector< isize > objids)Defined in VAmiga.h:2295
Deletes multiple key-value pairs.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt | Opt | The option's name forms the prefix of the keys. |
objids | std::vector< isize > | The keys are parameterized by adding the vector values as suffixes. |
Exceptions
| Exception | Description |
|---|---|
CoreError | (CoreError::INVALID_KEY) |
DefaultsAPI
inline
cpp
inline DefaultsAPI(Defaults * defaults)Defined in VAmiga.h:2105
Creates an API object that operates on the given defaults storage.