Initial Commit

This commit is contained in:
Rebekah 2020-08-04 13:37:07 -04:00
parent aa94ad2d29
commit d87977e608

View File

@ -1,16 +1,21 @@
#include <variant>
#include "ui/command.hpp" #include "ui/command.hpp"
#pragma once #pragma once
namespace nekohook::setting { namespace nekohook::setting {
template<typename T>
class Var;
using StrEnum = std::initializer_list<std::string_view>; using StrEnum = std::initializer_list<std::string_view>;
using TreeMap = StrEnum; using TreeMap = StrEnum;
class Var { class BaseVar {
public: public:
Var(TreeMap _tree_map, std::string_view gui_name); BaseVar(TreeMap _tree_map, std::string_view gui_name);
enum class Type { enum class Type {
kBool, kBool,
kInt, kInt,
@ -30,10 +35,16 @@ public:
virtual std::string GetString() = 0; // Used by cfg mgr and gui virtual std::string GetString() = 0; // Used by cfg mgr and gui
virtual void SetString(std::string_view) = 0; virtual void SetString(std::string_view) = 0;
private: private:
static inline std::vector<Var*> list; static inline std::vector<std::variant<Var<bool>*, Var<int>*, Var<float>*, >> list;
public: public:
static inline const auto& GetList() { return list; } static inline const auto& GetList() { return list; }
}; };
template<typename T>
class Var {
public:
Var(TreeMap, std::string_view _gui_name, T _defaults);
};
} }