class Settings

Contains a serializable set of generic key-value pairs.

Public

Constructors

Settings

Settings() = default

Methods

~Settings

virtual ~Settings() noexcept = default

SetFloat

void SetFloat(const String &name, float value)

Adds or updates a property key/value pair with a floating point value.

SetInt

void SetInt(const String &name, i32 value)

Adds or updates a property key/value pair with a signed integer value.

SetBool

void SetBool(const String &name, bool value)

Adds or updates a property key/value pair with a boolean value.

SetString

void SetString(const String &name, const String &value)

Adds or updates a property key/value pair with a string value.

SetObject

void SetObject(const String &name, const SPtr<IReflectable> &value)

Adds or updates a property key/value pair with a serializable object.

GetFloat

float GetFloat(const String &name, float defaultValue = 0.F)

Returns the floating point value of the specified key, or the default value if such key cannot be found.

GetInt

i32 GetInt(const String &name, i32 defaultValue = 0)

Returns the integer point value of the specified key, or the default value if such key cannot be found.

GetBool

bool GetBool(const String &name, bool defaultValue = false)

Returns the boolean point value of the specified key, or the default value if such key cannot be found.

GetString

String GetString(const String &name, const String &defaultValue = StringUtility::kBlank)

Returns the string point value of the specified key, or the default value if such key cannot be found.

GetObject

SPtr<IReflectable> GetObject(const String &name)

Returns the object value of the specified key, or null if such key cannot be found.

HasKey

bool HasKey(const String &name)

Returns true if the key with the specified name exists.

DeleteKey

void DeleteKey(const String &name)

Deletes a key with the specified name.

DeleteAllKeys

void DeleteAllKeys()

Deletes all key/value pairs.

GetHash

u32 GetHash() const

Returns a hash value that may be used for checking if any internal settings were modified.

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const override

Returns an interface you can use to access class' Run Time Type Information.

Protected

Methods

MarkAsDirty

void MarkAsDirty() const

Marks the object as dirty so that outside objects know when to update.

Fields

mKeyLookup

UnorderedMap<String, SettingsKeyInfo> mKeyLookup

mPrimitives

mStrings

Vector<TSettingsValue<String>> mStrings

mObjects

Vector<SettingsObjectValue> mObjects

mHash

u32 mHash