aboutsummaryrefslogtreecommitdiff
path: root/libbutl/path.ixx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-11-13 23:44:41 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-11-14 13:05:22 +0300
commit31ccc33713e3ebd0fc0479d906f114ea33c5d616 (patch)
tree7e98082c70e412c0171413b64c391cf20087c132 /libbutl/path.ixx
parent161a8e6a768679bde7054fef96dcbb936c866151 (diff)
Add to_stream(ostream, path, bool)
Diffstat (limited to 'libbutl/path.ixx')
-rw-r--r--libbutl/path.ixx24
1 files changed, 24 insertions, 0 deletions
diff --git a/libbutl/path.ixx b/libbutl/path.ixx
index b91102a..165f06a 100644
--- a/libbutl/path.ixx
+++ b/libbutl/path.ixx
@@ -743,4 +743,28 @@ LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason.
return *this;
}
+
+ template <typename C, typename K>
+ inline std::basic_ostream<C>&
+ to_stream (std::basic_ostream<C>& os,
+ const basic_path<C, K>& p,
+ bool representation)
+ {
+ os << p.string ();
+
+ if (representation)
+ {
+ C sep (p.separator ());
+
+#ifndef _WIN32
+ if (sep != 0 && !p.root ())
+ os << sep;
+#else
+ if (sep != 0)
+ os << sep;
+#endif
+ }
+
+ return os;
+ }
}