12#include <yaml-cpp/emittermanip.h>
17 template<
typename Class,
typename T>
24 std::optional<YAML::EMITTER_MANIP>
fFormat;
33 constexpr Property(T Class::*member, std::string_view key, std::string_view description =
"",
34 std::optional<YAML::EMITTER_MANIP> fmt = {}, std::optional<YAML::EMITTER_MANIP> fmtEntries = {})
49 std::string_view
Key()
const {
return fKey; }
55 const T&
Get(
const Class&
object)
const {
return object.*
fMember; }
57 void Set(Class&
object,
const T& value)
const {
object.*
fMember = value; }
60 template<
typename Class,
typename T>
65#define CBM_YAML_PROPERTIES(...) \
67 static constexpr auto Properties = std::make_tuple(__VA_ARGS__)
72#define CBM_YAML_FORMAT(tag) \
74 static constexpr std::optional<YAML::EMITTER_MANIP> FormatAs = tag
82#define CBM_YAML_MERGE_PROPERTY() \
84 static constexpr bool MergeProperty = true
Property & operator=(Property &&)=default
std::optional< YAML::EMITTER_MANIP > FormatEntries() const
Property(Property &&)=default
std::string_view Key() const
std::string_view Description() const
const T & Get(const Class &object) const
std::optional< YAML::EMITTER_MANIP > fFormatEntries
std::optional< YAML::EMITTER_MANIP > fFormat
Property & operator=(const Property &)=delete
void Set(Class &object, const T &value) const
Property(const Property &)=delete
constexpr Property(T Class::*member, std::string_view key, std::string_view description="", std::optional< YAML::EMITTER_MANIP > fmt={}, std::optional< YAML::EMITTER_MANIP > fmtEntries={})
T & Get(Class &object) const
std::optional< YAML::EMITTER_MANIP > Format() const
std::string_view fDescription
Property(T Class::*member, std::string_view key, std::string_view description) -> Property< Class, T >