File tree 1 file changed +16
-0
lines changed
include/chaiscript/utility
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 8
8
#define CHAISCRIPT_UTILITY_UTILITY_HPP_
9
9
10
10
#include < string>
11
+ #include < type_traits>
11
12
#include < utility>
12
13
#include < vector>
13
14
@@ -62,6 +63,21 @@ namespace chaiscript
62
63
t_module.add (fun.first , fun.second );
63
64
}
64
65
}
66
+
67
+ template <typename Enum, typename ModuleType>
68
+ typename std::enable_if<std::is_enum<Enum>::value, void >::type
69
+ add_class (ModuleType &t_module,
70
+ const std::string &t_class_name,
71
+ const std::vector<chaiscript::Proxy_Function> &t_constructors,
72
+ const std::vector<std::pair<chaiscript::Boxed_Value, std::string>> &t_constants)
73
+ {
74
+ t_module.add (chaiscript::user_type<Enum>(), t_class_name);
75
+
76
+ for (const auto &constant : t_constants)
77
+ {
78
+ t_module.add_global_const (constant.first , constant.second );
79
+ }
80
+ }
65
81
}
66
82
}
67
83
You can’t perform that action at this time.
0 commit comments