From 91734f1772aeca9795040d2db03b4f29051fa922 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 21 Aug 2019 15:38:28 +0200 Subject: Cleanup context.hxx and its usage --- libbuild2/scope.ixx | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'libbuild2/scope.ixx') 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 (l) : empty_project_name; + } } -- cgit v1.1