1 // Copyright 2018-2019 Antony Polukhin. 2 // 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt 5 // or copy at http://www.boost.org/LICENSE_1_0.txt) 6 7 /// \file boost/dll/config.hpp 8 /// \brief Imports filesystem, error_code, errc, system_error, make_error_code from Boost or C++17 into `boost::dll::fs` namespace. 9 10 #ifndef BOOST_DLL_DETAIL_CONFIG_HPP 11 #define BOOST_DLL_DETAIL_CONFIG_HPP 12 13 #include <boost/config.hpp> 14 #ifdef BOOST_HAS_PRAGMA_ONCE 15 # pragma once 16 #endif 17 18 #ifdef BOOST_DLL_DOXYGEN 19 /// Define this macro to make Boost.DLL use C++17's std::filesystem::path, std::system_error and std::error_code. 20 #define BOOST_DLL_USE_STD_FS BOOST_DLL_USE_STD_FS 21 22 /// This namespace contains aliases to the Boost or C++17 classes. Aliases are configured using BOOST_DLL_USE_STD_FS macro. 23 namespace boost { namespace dll { namespace fs { 24 25 /// Alias to `std::filesystem::path` if \forcedmacrolink{BOOST_DLL_USE_STD_FS} is defined by user. 26 /// Alias to `boost::filesystem::path` otherwise. 27 using path = std::conditional_t<BOOST_DLL_USE_STD_FS, std::filesystem::path, boost::filesystem::path>; 28 29 /// Alias to `std::error_code` if \forcedmacrolink{BOOST_DLL_USE_STD_FS} is defined by user. 30 /// boost::system::error_code otherwise. 31 using error_code = std::conditional_t<BOOST_DLL_USE_STD_FS, std::error_code, boost::system::error_code>; 32 33 /// Alias to `std::system_error` if \forcedmacrolink{BOOST_DLL_USE_STD_FS} is defined by user. 34 /// Alias to `boost::system::system_error` otherwise. 35 using system_error = std::conditional_t<BOOST_DLL_USE_STD_FS, std::system_error, boost::system::system_error>; 36 37 }}} 38 39 #endif 40 41 #ifdef BOOST_DLL_USE_STD_FS 42 #include <filesystem> 43 #include <system_error> 44 45 namespace boost { namespace dll { namespace fs { 46 47 using namespace std::filesystem; 48 49 using std::error_code; 50 using std::system_error; 51 using std::make_error_code; 52 using std::errc; 53 using std::system_category; 54 55 }}} 56 57 #else // BOOST_DLL_USE_STD_FS 58 59 #include <boost/filesystem/path.hpp> 60 #include <boost/filesystem/operations.hpp> 61 #include <boost/system/error_code.hpp> 62 63 namespace boost { namespace dll { namespace fs { 64 65 using namespace boost::filesystem; 66 67 using boost::system::error_code; 68 using boost::system::system_error; 69 using boost::system::errc::make_error_code; 70 namespace errc = boost::system::errc; 71 using boost::system::system_category; 72 73 }}} 74 75 #endif // BOOST_DLL_USE_STD_FS 76 77 #endif // BOOST_DLL_DETAIL_PUSH_OPTIONS_HPP 78 79