aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/scope.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-21 15:38:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-21 15:38:28 +0200
commit91734f1772aeca9795040d2db03b4f29051fa922 (patch)
tree410fcab8d47a58ea57ce3f27d91c9ea7ede44a9b /libbuild2/scope.ixx
parentd64ae97f6865bc25d496485622530e2a090c2eb4 (diff)
Cleanup context.hxx and its usage
Diffstat (limited to 'libbuild2/scope.ixx')
-rw-r--r--libbuild2/scope.ixx37
1 files changed, 37 insertions, 0 deletions
diff --git a/libbuild2/scope.ixx b/libbuild2/scope.ixx
index 3498ae0..aa1247f 100644
--- a/libbuild2/scope.ixx
+++ b/libbuild2/scope.ixx
@@ -51,4 +51,41 @@ namespace build2
return false;
}
+
+ inline dir_path
+ src_out (const dir_path& out, const scope& r)
+ {
+ assert (r.root ());
+ return src_out (out, r.out_path (), r.src_path ());
+ }
+
+ inline dir_path
+ out_src (const dir_path& src, const scope& r)
+ {
+ assert (r.root ());
+ return out_src (src, r.out_path (), r.src_path ());
+ }
+
+ inline dir_path
+ src_out (const dir_path& o,
+ const dir_path& out_root, const dir_path& src_root)
+ {
+ assert (o.sub (out_root));
+ return src_root / o.leaf (out_root);
+ }
+
+ inline dir_path
+ out_src (const dir_path& s,
+ const dir_path& out_root, const dir_path& src_root)
+ {
+ assert (s.sub (src_root));
+ return out_root / s.leaf (src_root);
+ }
+
+ inline const project_name&
+ project (const scope& root)
+ {
+ auto l (root[var_project]);
+ return l ? cast<project_name> (l) : empty_project_name;
+ }
}