Files

80 lines
2.6 KiB
C++

// Copyright 2018-2021 Antony Polukhin.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
/// \file ActivBoost/dll/config.hpp
/// \brief Imports filesystem, error_code, errc, system_error, make_error_code from Boost or C++17 into `Boost::dll::fs` namespace.
#ifndef ACTIV_BOOST_DLL_DETAIL_CONFIG_HPP
#define ACTIV_BOOST_DLL_DETAIL_CONFIG_HPP
#include <ActivBoost/config.hpp>
#ifdef ACTIV_BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#ifdef ACTIV_BOOST_DLL_DOXYGEN
/// Define this macro to make Boost.DLL use C++17's std::filesystem::path, std::system_error and std::error_code.
#define ACTIV_BOOST_DLL_USE_STD_FS ACTIV_BOOST_DLL_USE_STD_FS
/// This namespace contains aliases to the Boost or C++17 classes. Aliases are configured using ACTIV_BOOST_DLL_USE_STD_FS macro.
namespace Boost { namespace dll { namespace fs {
/// Alias to `std::filesystem::path` if \forcedmacrolink{ACTIV_BOOST_DLL_USE_STD_FS} is defined by user.
/// Alias to `Boost::filesystem::path` otherwise.
using path = std::conditional_t<ACTIV_BOOST_DLL_USE_STD_FS, std::filesystem::path, Boost::filesystem::path>;
/// Alias to `std::error_code` if \forcedmacrolink{ACTIV_BOOST_DLL_USE_STD_FS} is defined by user.
/// Boost::system::error_code otherwise.
using error_code = std::conditional_t<ACTIV_BOOST_DLL_USE_STD_FS, std::error_code, Boost::system::error_code>;
/// Alias to `std::system_error` if \forcedmacrolink{ACTIV_BOOST_DLL_USE_STD_FS} is defined by user.
/// Alias to `Boost::system::system_error` otherwise.
using system_error = std::conditional_t<ACTIV_BOOST_DLL_USE_STD_FS, std::system_error, Boost::system::system_error>;
}}}
#endif
#ifdef ACTIV_BOOST_DLL_USE_STD_FS
#include <filesystem>
#include <system_error>
namespace Boost { namespace dll { namespace fs {
using namespace std::filesystem;
using std::error_code;
using std::system_error;
using std::make_error_code;
using std::errc;
using std::system_category;
}}}
#else // ACTIV_BOOST_DLL_USE_STD_FS
#include <ActivBoost/filesystem/path.hpp>
#include <ActivBoost/filesystem/operations.hpp>
#include <ActivBoost/system/error_code.hpp>
#include <ActivBoost/system/system_error.hpp>
namespace Boost { namespace dll { namespace fs {
using namespace Boost::filesystem;
using Boost::system::error_code;
using Boost::system::system_error;
using Boost::system::errc::make_error_code;
namespace errc = Boost::system::errc;
using Boost::system::system_category;
}}}
#endif // ACTIV_BOOST_DLL_USE_STD_FS
#endif // ACTIV_BOOST_DLL_DETAIL_PUSH_OPTIONS_HPP