9
3

config.hpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. /// \file boost/dll/config.hpp
  7. /// \brief Imports filesystem, error_code, errc, system_error, make_error_code from Boost or C++17 into `boost::dll::fs` namespace.
  8. #ifndef BOOST_DLL_DETAIL_CONFIG_HPP
  9. #define BOOST_DLL_DETAIL_CONFIG_HPP
  10. #include <boost/config.hpp>
  11. #ifdef BOOST_HAS_PRAGMA_ONCE
  12. # pragma once
  13. #endif
  14. #ifdef BOOST_DLL_DOXYGEN
  15. /// Define this macro to make Boost.DLL use C++17's std::filesystem::path, std::system_error and std::error_code.
  16. #define BOOST_DLL_USE_STD_FS BOOST_DLL_USE_STD_FS
  17. /// This namespace contains aliases to the Boost or C++17 classes. Aliases are configured using BOOST_DLL_USE_STD_FS macro.
  18. namespace boost { namespace dll { namespace fs {
  19. /// Alias to `std::filesystem::path` if \forcedmacrolink{BOOST_DLL_USE_STD_FS} is defined by user.
  20. /// Alias to `boost::filesystem::path` otherwise.
  21. using path = std::conditional_t<BOOST_DLL_USE_STD_FS, std::filesystem::path, boost::filesystem::path>;
  22. /// Alias to `std::error_code` if \forcedmacrolink{BOOST_DLL_USE_STD_FS} is defined by user.
  23. /// boost::system::error_code otherwise.
  24. using error_code = std::conditional_t<BOOST_DLL_USE_STD_FS, std::error_code, boost::system::error_code>;
  25. /// Alias to `std::system_error` if \forcedmacrolink{BOOST_DLL_USE_STD_FS} is defined by user.
  26. /// Alias to `boost::system::system_error` otherwise.
  27. using system_error = std::conditional_t<BOOST_DLL_USE_STD_FS, std::system_error, boost::system::system_error>;
  28. }}}
  29. #endif
  30. #ifdef BOOST_DLL_USE_STD_FS
  31. #include <filesystem>
  32. #include <system_error>
  33. namespace boost { namespace dll { namespace fs {
  34. using namespace std::filesystem;
  35. using std::error_code;
  36. using std::system_error;
  37. using std::make_error_code;
  38. using std::errc;
  39. using std::system_category;
  40. }}}
  41. #else // BOOST_DLL_USE_STD_FS
  42. #include <boost/filesystem/path.hpp>
  43. #include <boost/filesystem/operations.hpp>
  44. #include <boost/system/error_code.hpp>
  45. namespace boost { namespace dll { namespace fs {
  46. using namespace boost::filesystem;
  47. using boost::system::error_code;
  48. using boost::system::system_error;
  49. using boost::system::errc::make_error_code;
  50. namespace errc = boost::system::errc;
  51. using boost::system::system_category;
  52. }}}
  53. #endif // BOOST_DLL_USE_STD_FS
  54. #endif // BOOST_DLL_DETAIL_PUSH_OPTIONS_HPP