aboutsummaryrefslogtreecommitdiff
path: root/build/target.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-06-30 15:07:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-06-30 15:07:03 +0200
commit70af0087d8efb3f2f7dc9ffdf2568419913f16da (patch)
treedceeab7a3c600add8bf3f3375a2d83ca11213624 /build/target.ixx
parent18568ff0ff3dce89d694b494c5dfc9a32e63c9e6 (diff)
Group "see through" iteration, take 1
Diffstat (limited to 'build/target.ixx')
-rw-r--r--build/target.ixx61
1 files changed, 61 insertions, 0 deletions
diff --git a/build/target.ixx b/build/target.ixx
index 837769e..b6bf509 100644
--- a/build/target.ixx
+++ b/build/target.ixx
@@ -2,12 +2,73 @@
// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
+#include <build/scope>
+
namespace build
{
+ // prerequisite_ref
+ //
inline bool prerequisite_ref::
belongs (const target& t) const
{
const auto& p (t.prerequisites);
return !(p.empty () || this < &p.front () || this > &p.back ());
}
+
+ // prerequisite_member
+ //
+ inline prerequisite& prerequisite_member::
+ as_prerequisite (tracer& trace) const
+ {
+ if (target == nullptr)
+ return prerequisite;
+
+ // The use of the group's prerequisite scope is debatable.
+ //
+ scope& s (prerequisite.get ().scope);
+ return s.prerequisites.insert (key ().tk, s, trace).first;
+ }
+
+ // prerequisite_members
+ //
+ group_view
+ resolve_group_members (action, target_group&); // <build/algorithm>
+
+ template <typename T>
+ inline auto prerequisite_members_range<T>::iterator::
+ operator++ () -> iterator&
+ {
+ if (g_.count != 0)
+ {
+ // Member iteration.
+ //
+ if (++j_ == g_.count)
+ {
+ // Switch back to prerequisite iteration.
+ //
+ g_.count = 0;
+ ++i_;
+ }
+ }
+ else
+ {
+ // Prerequisite iteration.
+ //
+ if (i_->get ().template is_a<target_group> ())
+ {
+ // Switch to member iteration.
+ //
+ target_group& g (static_cast<target_group&> (search (*i_)));
+ j_ = 0;
+ g_ = resolve_group_members (a_, g);
+
+ if (g_.count == 0)
+ ++i_; // Empty group.
+ }
+ else
+ ++i_;
+ }
+
+ return *this;
+ }
}