1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-19 02:22:39 +00:00

Starts moving towards a Deflectable-based system of runtime options.

This commit is contained in:
Thomas Harte
2020-03-15 23:48:53 -04:00
parent 2031a33edf
commit 8e3bf0dbca
33 changed files with 524 additions and 548 deletions
+22
View File
@@ -8,6 +8,8 @@
#include "Struct.h"
// MARK: - Setters
template <> bool Reflection::set(Struct &target, const std::string &name, int value) {
const auto target_type = target.type_of(name);
if(!target_type) return false;
@@ -52,6 +54,26 @@ template <> bool Reflection::set(Struct &target, const std::string &name, const
return set<const std::string &>(target, name, string);
}
// MARK: - Fuzzy setter
bool Reflection::fuzzy_set(Struct &target, const std::string &name, const std::string &value) {
return false;
}
// MARK: - Getters
template <typename Type> bool Reflection::get(Struct &target, const std::string &name, Type &value) {
return false;
}
template <> bool Reflection::get(Struct &target, const std::string &name, bool &value) {
const auto target_type = target.type_of(name);
if(!target_type) return false;
if(*target_type == typeid(bool)) {
value = *reinterpret_cast<const bool *>(target.get(name));
return true;
}
return false;
}