aboutsummaryrefslogtreecommitdiff
path: root/build2/algorithm.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-07-31 18:42:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-07-31 18:44:07 +0200
commita84ff43b183181e0a12c6d5e31c1f366d39ce2fe (patch)
tree3dce54b64fd8e9917ed034a3e2c9e20f057eece4 /build2/algorithm.hxx
parent89f5bc3b423a1269a60ccca05174226c8de40357 (diff)
Experimental (and probably broken) pkg-config generation support
Diffstat (limited to 'build2/algorithm.hxx')
-rw-r--r--build2/algorithm.hxx27
1 files changed, 25 insertions, 2 deletions
diff --git a/build2/algorithm.hxx b/build2/algorithm.hxx
index 2006e2a..931b396 100644
--- a/build2/algorithm.hxx
+++ b/build2/algorithm.hxx
@@ -136,14 +136,37 @@ namespace build2
target_lock
lock (action, const target&);
- // Add an ad hoc member. If the suffix is specified, it is added (as an
- // extension) to the member's target name. Return the locked member target.
+ // Add an ad hoc member to the end of the chain assuming that an already
+ // existing member of this target type is the same.
+ //
+ // If the suffix is specified, it is added (as an extension) to the member's
+ // target name. Return the locked member target.
//
target_lock
add_adhoc_member (action, target&,
const target_type&,
const char* suffix = nullptr);
+ template <typename T>
+ inline target_lock
+ add_adhoc_member (action a, target& t, const char* s = nullptr)
+ {
+ return add_adhoc_member (a, t, T::static_type, s);
+ }
+
+ // Find an ad hoc member of the specified target type returning NULL if not
+ // found.
+ //
+ const target*
+ find_adhoc_member (const target&, const target_type&);
+
+ template <typename T>
+ inline const T*
+ find_adhoc_member (const target& t)
+ {
+ return static_cast<const T*> (find_adhoc_member (t, T::static_type));
+ }
+
// Match and apply a rule to the action/target with ambiguity detection.
// Increment the target's dependents count, which means that you should call
// this function with the intent to also call execute(). Return the target