cmJSONHelpers: Add new Bind() function

This commit is contained in:
Kyle Edwards
2020-09-23 08:50:52 -04:00
parent 8682d1b7b2
commit 3059e6aed7
2 changed files with 35 additions and 13 deletions

View File

@@ -29,6 +29,9 @@ public:
template <typename M, typename F>
cmJSONObjectHelper& Bind(const cm::string_view& name, std::nullptr_t, F func,
bool required = true);
template <typename F>
cmJSONObjectHelper& Bind(const cm::string_view& name, F func,
bool required = true);
E operator()(T& out, const Json::Value* value) const;
@@ -86,6 +89,14 @@ cmJSONObjectHelper<T, E>& cmJSONObjectHelper<T, E>::Bind(
required);
}
template <typename T, typename E>
template <typename F>
cmJSONObjectHelper<T, E>& cmJSONObjectHelper<T, E>::Bind(
const cm::string_view& name, F func, bool required)
{
return this->BindPrivate(name, MemberFunction(func), required);
}
template <typename T, typename E>
cmJSONObjectHelper<T, E>& cmJSONObjectHelper<T, E>::BindPrivate(
const cm::string_view& name, MemberFunction&& func, bool required)