aboutsummaryrefslogtreecommitdiff
path: root/butl/path-io
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-06-18 14:41:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-06-18 14:41:44 +0200
commit08903414e3546bc2c76bef73b2337ccf79886530 (patch)
tree17d76af2771ad209b781b13156da5160ba0f07ae /butl/path-io
parent5a79b446475c9643346024a83bb14c2ba9c55dbd (diff)
Move path and filesystem from build2 to libbutl
Diffstat (limited to 'butl/path-io')
-rw-r--r--butl/path-io29
1 files changed, 29 insertions, 0 deletions
diff --git a/butl/path-io b/butl/path-io
new file mode 100644
index 0000000..2f2072f
--- /dev/null
+++ b/butl/path-io
@@ -0,0 +1,29 @@
+// file : butl/path-io -*- C++ -*-
+// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef BUTL_PATH_IO
+#define BUTL_PATH_IO
+
+#include <ostream>
+
+#include <butl/path>
+
+namespace butl
+{
+ // This is the default path IO implementation. The reason it is
+ // separate is because one often wants a custom implementation.
+ // For example, we may want to print paths as relative to the
+ // working directory. Or we may want to print '~' for the home
+ // directory prefix. Or we may want to print dir_path with a
+ // trailing '/'.
+ //
+ template <typename C, typename K>
+ inline std::basic_ostream<C>&
+ operator<< (std::basic_ostream<C>& os, basic_path<C, K> const& p)
+ {
+ return os << p.string ();
+ }
+}
+
+#endif // BUTL_PATH_IO