aboutsummaryrefslogtreecommitdiff
path: root/build/name.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-02-27 16:57:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-02-27 16:57:34 +0200
commit4372f041bb7401c3adc2d5710566b13f64722102 (patch)
tree5f37f6e69e5529d3628b7611bb642dba15d885c0 /build/name.cxx
parente1d2e3b63934c1e193429f1d6c4e04abc0e85d56 (diff)
Variable assignment, appending support
Diffstat (limited to 'build/name.cxx')
-rw-r--r--build/name.cxx51
1 files changed, 51 insertions, 0 deletions
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 <build/name>
+
+#include <ostream>
+
+#include <build/diagnostics>
+
+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;
+ }
+}