Class SettingBaseValueV3<T, V>

#include <Geode/loader/SettingV3.hpp>
template<class T,class V = T>classSettingBaseValueV3:publicgeode::SettingV3{ ... }

A helper class for creating a basic setting with a simple value. Override the virtual function isValid to

Template parameters

T

The type of the setting's value. This type must be JSON- serializable and deserializable!

V

The type used for the `setValue` function, if it differs from T
Examples0
Public static methods0
Public member functions8
TgetDefaultValue()const

Get the default value for this setting

TgetValue()const

Get the current value of this setting

voidsetValue(
Vvalue
)

Set the value of this setting. This will broadcast a new SettingChangedEventV3, letting any listeners now the value has changed

Parameters

value

The new value for the setting. If the value is not a valid value for this setting (as determined by `isValue`), then the setting's value is reset to the default value
virtualgeode::Result<>isValid(
Vvalue
)
const

Check if a given value is valid for this setting. If not, an error describing why the value isn’t valid is returned

virtualboolisDefaultValue()const
No description provided
virtualvoidreset()
No description provided
virtualboolload()
No description provided
virtualboolsave()const
No description provided
Fields0
Protected member functions4
voidparseDefaultValue()

Parses the "default" key from the setting’s definition in mod.json. The key may also be defined per-platform, i.e. "default": { "win": ..., "android": ... }

Parameters

json

The current JSON checking instance being used. This should be the JSON object that defines the setting

⚠️ In most cases, you should be using `parseBaseProperties` instead to do all of this in one go! If you do need the fine-grained control however, make sure to call `init` before calling these parsing functions!

voidparseBaseProperties(,,)

Parse shared value, including the default value for this setting

Parameters

key

The key of the setting

modID

The ID of the mod this setting is being parsed for

json

The current JSON checking instance being used. If you aren't using Geode's JSON checking utilities, use the other overload of this function
geode::Result<>parseBaseProperties(,,)

Parse shared value, including the default value for this setting

Parameters

key

The key of the setting

modID

The ID of the mod this setting is being parsed for

json

The JSON value. If you are using Geode's JSON checking utilities (`checkJson` / `JsonExpectedValue`), you should use the other overload directly!
voidsetDefaultValue(
Vvalue
)

Set the default value. This does not check that the value is actually valid!

Protected fields0