// file : build/config/utility.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2015 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #include using namespace std; namespace build { namespace config { // The same as the template except it is a bit more efficient // when it comes to not creating the default value string // unnecessarily. // pair required (scope& root, const char* name, const char* def_value) { string r; const variable& var (variable_pool.find (name)); if (auto v = root[var]) { const string& s (v.as ()); if (!v.belongs (*global_scope)) // A value from (some) config.build. return pair (s, false); r = s; } else r = def_value; auto v (root.assign (var)); v = move (r); return pair (v.as (), true); } } }