aboutsummaryrefslogtreecommitdiff
path: root/libbutl/path-io.mxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-09-22 23:32:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-09-22 23:32:28 +0200
commitc09cd7512491cee1e82c1ad8128ce9fd4bc3f79b (patch)
treea659ed768d849130ab5780a11b7f791a463a1a91 /libbutl/path-io.mxx
parent2a00871f07067f8f9e2de08bb9c8f50e1bf6a650 (diff)
Initial modularization with both Clang and VC hacks
Note: gave up on VC about half way though.
Diffstat (limited to 'libbutl/path-io.mxx')
-rw-r--r--libbutl/path-io.mxx45
1 files changed, 45 insertions, 0 deletions
diff --git a/libbutl/path-io.mxx b/libbutl/path-io.mxx
new file mode 100644
index 0000000..ae1ee84
--- /dev/null
+++ b/libbutl/path-io.mxx
@@ -0,0 +1,45 @@
+// file : libbutl/path-io.mxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef __cpp_modules
+#pragma once
+#endif
+
+// C includes.
+
+#ifndef __cpp_lib_modules
+#include <ostream>
+#endif
+
+// Other includes.
+
+#ifdef __cpp_modules
+export module butl.path_io;
+#ifdef __cpp_lib_modules
+import std.core; //@@ MOD TMP (should not be needed).
+import std.io;
+#endif
+import butl.path;
+#else
+#include <libbutl/path.mxx>
+#endif
+
+#include <libbutl/export.hxx>
+
+LIBBUTL_MODEXPORT 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 ();
+ }
+}