aboutsummaryrefslogtreecommitdiff
path: root/libbutl/filesystem.cxx
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/filesystem.cxx
parent2a00871f07067f8f9e2de08bb9c8f50e1bf6a650 (diff)
Initial modularization with both Clang and VC hacks
Note: gave up on VC about half way though.
Diffstat (limited to 'libbutl/filesystem.cxx')
-rw-r--r--libbutl/filesystem.cxx47
1 files changed, 36 insertions, 11 deletions
diff --git a/libbutl/filesystem.cxx b/libbutl/filesystem.cxx
index 7ba5275..8c3abc4 100644
--- a/libbutl/filesystem.cxx
+++ b/libbutl/filesystem.cxx
@@ -2,7 +2,11 @@
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <libbutl/filesystem.hxx>
+#ifndef __cpp_modules
+#include <libbutl/filesystem.mxx>
+#endif
+
+#include <errno.h> // errno, E*
#ifndef _WIN32
# include <stdio.h> // rename()
@@ -25,25 +29,46 @@
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
# endif
-
-# include <libbutl/utility.hxx> // lcase()
#endif
-#include <errno.h> // errno, E*
+#include <cassert>
+
+#ifndef __cpp_lib_modules
+#include <cstddef>
+#include <cstdint>
+#include <utility>
+#include <iterator>
+#include <functional>
#include <string>
#include <vector>
#include <memory> // unique_ptr
-#include <cstddef> // size_t
-#include <utility> // pair
-#include <iterator> // reverse_iterator
#include <system_error>
+#endif
+// Other includes.
-#include <libbutl/path.hxx>
-#include <libbutl/utility.hxx> // throw_generic_error()
-#include <libbutl/fdstream.hxx>
-#include <libbutl/small-vector.hxx>
+#ifdef __cpp_modules
+module butl.filesystem;
+
+// Only imports additional to interface.
+#ifdef __clang__
+#ifdef __cpp_lib_modules
+import std.core;
+#endif
+import butl.path;
+import butl.timestamp;
+#endif
+
+import butl.utility; // throw_generic_error(), lcase()[_WIN32]
+import butl.fdstream;
+import butl.small_vector;
+#else
+#include <libbutl/path.mxx>
+#include <libbutl/utility.mxx>
+#include <libbutl/fdstream.mxx>
+#include <libbutl/small-vector.mxx>
+#endif
using namespace std;