From bbd0f3bb21442a2833916110cbe8e9a07e9f4c1f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 31 Jul 2015 12:52:20 +0200 Subject: Essential install module functionality --- build/variable | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'build/variable') diff --git a/build/variable b/build/variable index 998a853..ed8d65c 100644 --- a/build/variable +++ b/build/variable @@ -73,10 +73,11 @@ namespace build using names::names; list_value () = default; - list_value (names d): names (std::move (d)) {} - list_value (name n) {emplace_back (std::move (n));} - list_value (dir_path d) {emplace_back (std::move (d));} - list_value (std::string d) {emplace_back (std::move (d));} + explicit list_value (names d): names (std::move (d)) {} + explicit list_value (name n) {emplace_back (std::move (n));} + explicit list_value (dir_path d) {emplace_back (std::move (d));} + explicit list_value (std::string s) {emplace_back (std::move (s));} + explicit list_value (const char* s) {emplace_back (s);} virtual value_ptr clone () const {return value_ptr (new list_value (*this));} @@ -165,6 +166,7 @@ namespace build operator+= (std::string) const; // Append simple name to list_value. // Return true if this value belongs to the specified scope or target. + // Note that it can also be a target type/pattern-specific value. // template bool @@ -218,6 +220,15 @@ namespace build } template <> + inline const name& value_proxy:: + as () const + { + const auto& lv (as ()); + assert (lv.size () == 1); + return lv.front (); + } + + template <> std::string& value_proxy:: as () const; @@ -348,6 +359,12 @@ namespace build using variable_pattern_map = std::map; using variable_type_map = std::map, variable_pattern_map>; + + //@@ In quite a few places we assume that we can store a reference + // to the returned value (e.g., install::lookup_install()). If + // we "instantiate" the value on the fly, then we will need to + // consider its lifetime. + } #include -- cgit v1.1