1// Copyright Antony Polukhin, 2018-2024.
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.
23namespace 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.
27using 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.
31using 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.
35using 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
45namespace boost { namespace dll { namespace fs {
46
47using namespace std::filesystem;
48
49using std::error_code;
50using std::system_error;
51using std::make_error_code;
52using std::errc;
53using 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#include <boost/system/system_error.hpp>
63
64namespace boost { namespace dll { namespace fs {
65
66using namespace boost::filesystem;
67
68using boost::system::error_code;
69using boost::system::system_error;
70using boost::system::errc::make_error_code;
71namespace errc = boost::system::errc;
72using boost::system::system_category;
73
74}}}
75
76#endif // BOOST_DLL_USE_STD_FS
77
78#endif // BOOST_DLL_DETAIL_PUSH_OPTIONS_HPP
79
80

source code of boost/libs/dll/include/boost/dll/config.hpp