aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-11-11 15:04:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-11-11 15:04:27 +0200
commit011adfe1efe3ff20dc019e242d56c95b2b35ac13 (patch)
tree1449476328b74fb98884a9dc22766836ac8dedd3 /libbuild2
parent1b80ce6765eb555f6e9dfcfa995415811640d4be (diff)
Expose low-level function registration support
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/forward.hxx1
-rw-r--r--libbuild2/function.hxx27
2 files changed, 24 insertions, 4 deletions
diff --git a/libbuild2/forward.hxx b/libbuild2/forward.hxx
index cd0f3c3..5fffaaf 100644
--- a/libbuild2/forward.hxx
+++ b/libbuild2/forward.hxx
@@ -34,6 +34,7 @@ namespace build2
// <libbuild2/function.hxx>
//
class function_map;
+ class function_family;
// <libbuild2/scope.hxx>
//
diff --git a/libbuild2/function.hxx b/libbuild2/function.hxx
index 47eee5b..43b8024 100644
--- a/libbuild2/function.hxx
+++ b/libbuild2/function.hxx
@@ -249,10 +249,9 @@ namespace build2
default_thunk (const scope*, vector_view<value>, const function_overload&);
// A function family uses a common qualification (though you can pass
- // empty string to supress it). For an unqualified name (doesn't not
- // contain a dot) the qualified version is added automatically. A name
- // containing a leading dot is a shortcut notation for a qualified-only
- // name.
+ // empty string to supress it). For an unqualified name (doesn't contain
+ // dot) the qualified version is added automatically. A name containing a
+ // leading dot is a shortcut notation for a qualified-only name.
//
function_family (function_map& map,
string qual,
@@ -910,6 +909,26 @@ namespace build2
typename cast::data {&cast::thunk, dm}));
}
+ // Low-level interface that can be used to register additional data.
+ //
+ // Note that the call to this function sidesteps the thunk.
+ //
+ template <typename D, typename... A>
+ void
+ insert (function_impl* i, D d) &&
+ {
+ using args = function_args<A...>;
+
+ insert (move (name),
+ function_overload (
+ nullptr,
+ args::min,
+ args::max,
+ function_overload::types (args::types, args::max),
+ i,
+ move (d)));
+ }
+
private:
void
insert (string, function_overload) const;