libnick 2025.9.1
A cross-platform base for native Nickvision applications.
|
The purpose of Nickvision::Helpers::JsonFileBase
is to act as a base when defining your own json data objects that you would like to be saved and retrieved from disk.
Here are some key points when defining your own configuration objects:
const std::filesystem::path& path
parameter and pass it to JsonFileBase
's constructor.JsonFileBase
exposes protected templated T get(const std::string& key, const T& defaultValue)
and void set(const std::string& key, const T& value)
methods which you must use in your implementation to get and store data from the json object.save
method on your object when you want to save the configuration json file to disk. Calling get
and set
are not enough to trigger saving the file on disk.Here is an example of a custom configuration object using JsonFileBase
: