// file : build/variable.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC // license : MIT; see accompanying LICENSE file #include #include using namespace std; namespace build { variable_set variable_pool; // value_proxy // template <> list_value& value_proxy:: as () const { list_value* lv (dynamic_cast (p->get ())); assert (lv != nullptr); return *lv; } template <> const string& value_proxy:: as () const { const list_value& lv (as ()); assert (lv.data.size () < 2); if (lv.data.empty ()) return empty_string; const name& n (lv.data.front ()); assert (n.type.empty () && n.dir.empty ()); return n.value; } // Note: get the name's directory. // template <> const path& value_proxy:: as () const { const list_value& lv (as ()); assert (lv.data.size () < 2); if (lv.data.empty ()) return empty_path; const name& n (lv.data.front ()); assert (n.type.empty () && n.value.empty ()); return n.dir; } }