From 4372f041bb7401c3adc2d5710566b13f64722102 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 27 Feb 2015 16:57:34 +0200 Subject: Variable assignment, appending support --- build/name.cxx | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 build/name.cxx (limited to 'build/name.cxx') diff --git a/build/name.cxx b/build/name.cxx new file mode 100644 index 0000000..9de1695 --- /dev/null +++ b/build/name.cxx @@ -0,0 +1,51 @@ +// file : build/name.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include + +#include + +#include + +using namespace std; + +namespace build +{ + ostream& + operator<< (ostream& os, const name& n) + { + if (!n.type.empty ()) + os << n.type << '{'; + + if (!n.dir.empty ()) + { + string s (diag_relative_work (n.dir)); + + if (s != ".") + { + os << s; + + if (!n.value.empty () && + s.back () != path::traits::directory_separator) + os << path::traits::directory_separator; + } + } + + os << n.value; + + if (!n.type.empty ()) + os << '}'; + + return os; + } + + ostream& + operator<< (ostream& os, const names& ns) + { + for (auto b (ns.begin ()), i (b), e (ns.end ()); i != e; ++i) + os << (i != b ? " " : "") << *i; + + return os; + } +} -- cgit v1.1