Files
panopainter/src/settings.h

36 lines
877 B
C++

#pragma once
#include "serializer.h"
class Settings : public Serializer::Descriptor
{
public:
Settings() { class_id = "pref"; }
static Settings I;
static bool load();
static bool save();
static bool has(const std::string& key)
{
return I.Descriptor::has(key);
}
template <typename T>
static void set(const std::string& key, const T value)
{
I.Descriptor::set(key, value);
}
template <typename T>
static std::shared_ptr<T> get(const std::string& key)
{
return I.Descriptor::get<T>(key);
}
template <typename T, typename D = decltype(T::value)>
static void value(const std::string& key, D& dest)
{
I.Descriptor::value<T, D>(key, dest);
}
template <typename T>
static auto value(const std::string& key)
{
return I.Descriptor::value<T>(key);
}
};