aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/file.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/file.ixx')
-rw-r--r--libbuild2/file.ixx56
1 files changed, 37 insertions, 19 deletions
diff --git a/libbuild2/file.ixx b/libbuild2/file.ixx
index bd138a0..dc39bcb 100644
--- a/libbuild2/file.ixx
+++ b/libbuild2/file.ixx
@@ -22,15 +22,16 @@ namespace build2
}
LIBBUILD2_SYMEXPORT const target*
- import (context&,
- const prerequisite_key&,
- bool optional_,
- const optional<string>& metadata, // False or metadata key.
- bool existing,
- const location&);
+ import2 (context&,
+ const prerequisite_key&,
+ const string& hint,
+ bool optional_,
+ const optional<string>& metadata, // False or metadata key.
+ bool existing,
+ const location&);
inline const target&
- import (context& ctx, const prerequisite_key& pk)
+ import2 (context& ctx, const prerequisite_key& pk)
{
assert (ctx.phase == run_phase::match);
@@ -39,13 +40,13 @@ namespace build2
// Looks like the only way to do this is to keep location in name and
// then in prerequisite. Perhaps one day...
//
- return *import (ctx, pk, false, nullopt, false, location ());
+ return *import2 (ctx, pk, string (), false, nullopt, false, location ());
}
- inline pair<const target*, import_kind>
+ inline import_result<target>
import_direct (scope& base,
name tgt,
- bool ph2, bool opt, bool md,
+ const optional<string>& ph2, bool opt, bool md,
const location& loc, const char* w)
{
bool dummy (false);
@@ -53,33 +54,50 @@ namespace build2
}
template <typename T>
- inline pair<const T*, import_kind>
+ inline import_result<T>
import_direct (scope& base,
name tgt,
bool ph2, bool opt, bool md,
const location& loc, const char* w)
{
- auto r (import_direct (base, move (tgt), ph2, opt, md, loc, w));
- return make_pair (r.first != nullptr ? &r.first->as<const T> () : nullptr,
- r.second);
+ auto r (import_direct (base,
+ move (tgt),
+ ph2 ? optional<string> (string ()) : nullopt,
+ opt,
+ md,
+ loc,
+ w));
+ return import_result<T> {
+ r.target != nullptr ? &r.target->as<const T> () : nullptr,
+ move (r.name),
+ r.kind};
}
template <typename T>
- inline pair<const T*, import_kind>
+ inline import_result<T>
import_direct (bool& nv,
scope& base,
name tgt,
bool ph2, bool opt, bool md,
const location& loc, const char* w)
{
- auto r (import_direct (nv, base, move (tgt), ph2, opt, md, loc, w));
- return make_pair (r.first != nullptr ? &r.first->as<const T> () : nullptr,
- r.second);
+ auto r (import_direct (nv,
+ base,
+ move (tgt),
+ ph2 ? optional<string> (string ()) : nullopt,
+ opt,
+ md,
+ loc,
+ w));
+ return import_result<T> {
+ r.target != nullptr ? &r.target->as<const T> () : nullptr,
+ move (r.name),
+ r.kind};
}
inline const target*
import_existing (context& ctx, const prerequisite_key& pk)
{
- return import (ctx, pk, false, nullopt, true, location ());
+ return import2 (ctx, pk, string (), false, nullopt, true, location ());
}
}