-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfeature.hpp
More file actions
41 lines (34 loc) · 1.04 KB
/
Copy pathfeature.hpp
File metadata and controls
41 lines (34 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#ifndef __CPPM_CORE_FEATURES_HPP__
#define __CPPM_CORE_FEATURES_HPP__
#include <serdepp/utility.hpp>
#include <serdepp/attributes.hpp>
namespace cppm::core {
enum class FeatureType {
CMAKE_FLAG,
REMOTE,
};
struct Feature {
template<class Context>
constexpr static void serde(Context& context, Feature& value) {
using namespace serde::attribute;
using Self = Feature;
serde::serde_struct(context, value)
(&Self::key, "key", value_or_struct)
(&Self::value, "value", skip)
(&Self::type, "type", skip);
if constexpr(Context::is_serialize) {
if(value.key[0] == '$') {
value.type = FeatureType::CMAKE_FLAG;
value.value = "OFF";
}
}
}
Feature() = default;
Feature(const std::string& key_) : key(key_){}
std::string value;
std::string key;
FeatureType type;
};
}
#endif