aboutsummaryrefslogtreecommitdiff
path: root/libbutl/fdstream.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/fdstream.cxx
parent2a00871f07067f8f9e2de08bb9c8f50e1bf6a650 (diff)
Initial modularization with both Clang and VC hacks
Note: gave up on VC about half way though.
Diffstat (limited to 'libbutl/fdstream.cxx')
-rw-r--r--libbutl/fdstream.cxx35
1 files changed, 31 insertions, 4 deletions
diff --git a/libbutl/fdstream.cxx b/libbutl/fdstream.cxx
index ab78e6a..905c36f 100644
--- a/libbutl/fdstream.cxx
+++ b/libbutl/fdstream.cxx
@@ -2,7 +2,11 @@
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <libbutl/fdstream.hxx>
+#ifndef __cpp_modules
+#include <libbutl/fdstream.mxx>
+#endif
+
+#include <errno.h> // errno, E*
#ifndef _WIN32
# include <fcntl.h> // open(), O_*, fcntl()
@@ -21,23 +25,46 @@
# include <fcntl.h> // _O_*
# include <sys/stat.h> // S_I*
-# include <cwchar> // wcsncmp(), wcsstr()
+# include <wchar.h> // wcsncmp(), wcsstr()
#endif
-#include <errno.h> // errno, E*
+#include <cassert>
+
+#ifndef __cpp_lib_modules
+#include <vector>
+#include <string>
+#include <istream>
+#include <ostream>
+#include <utility>
+#include <cstdint>
#include <ios> // ios_base::openmode, ios_base::failure
#include <new> // bad_alloc
#include <limits> // numeric_limits
-#include <cassert>
#include <cstring> // memcpy(), memmove()
#include <exception> // uncaught_exception()
#include <stdexcept> // invalid_argument
#include <type_traits>
#include <system_error>
+#endif
#include <libbutl/process-details.hxx>
+#ifdef __cpp_modules
+module butl.fdstream;
+
+// Only imports additional to interface.
+#ifdef __clang__
+#ifdef __cpp_lib_modules
+import std.core;
+import std.io;
+#endif
+import butl.path;
+import butl.filesystem;
+#endif
+
+#endif
+
using namespace std;
#ifdef _WIN32