config.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //
  2. // Copyright (c) 2012 Artyom Beilis (Tonkikh)
  3. // Copyright (c) 2019 - 2020 Alexander Grund
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See
  6. // accompanying file LICENSE or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. #ifndef BOOST_NOWIDE_CONFIG_HPP_INCLUDED
  10. #define BOOST_NOWIDE_CONFIG_HPP_INCLUDED
  11. /// @file
  12. #include <boost/config.hpp>
  13. #include <boost/nowide/replacement.hpp>
  14. #include <boost/version.hpp>
  15. //! @cond Doxygen_Suppress
  16. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK)
  17. #ifdef BOOST_NOWIDE_SOURCE
  18. #define BOOST_NOWIDE_DECL BOOST_SYMBOL_EXPORT
  19. #else
  20. #define BOOST_NOWIDE_DECL BOOST_SYMBOL_IMPORT
  21. #endif // BOOST_NOWIDE_SOURCE
  22. #else
  23. #define BOOST_NOWIDE_DECL
  24. #endif // BOOST_NOWIDE_DYN_LINK
  25. //
  26. // Automatically link to the correct build variant where possible.
  27. //
  28. #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_NOWIDE_NO_LIB) && !defined(BOOST_NOWIDE_SOURCE)
  29. //
  30. // Set the name of our library, this will get undef'ed by auto_link.hpp
  31. // once it's done with it:
  32. //
  33. #define BOOST_LIB_NAME boost_nowide
  34. //
  35. // If we're importing code from a dll, then tell auto_link.hpp about it:
  36. //
  37. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK)
  38. #define BOOST_DYN_LINK
  39. #endif
  40. //
  41. // And include the header that does the work:
  42. //
  43. #include <boost/config/auto_link.hpp>
  44. #endif // auto-linking disabled
  45. //! @endcond
  46. /// @def BOOST_NOWIDE_USE_WCHAR_OVERLOADS
  47. /// @brief Whether to use the wchar_t* overloads in fstream/filebuf
  48. /// Enabled on Windows and Cygwin as the latter may use wchar_t in filesystem::path
  49. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  50. #define BOOST_NOWIDE_USE_WCHAR_OVERLOADS 1
  51. #else
  52. #define BOOST_NOWIDE_USE_WCHAR_OVERLOADS 0
  53. #endif
  54. /// @def BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT
  55. /// @brief Define to 1 to use internal class from filebuf.hpp
  56. ///
  57. /// - On Non-Windows platforms: Define to 1 to use the same class from header <filebuf.hpp>
  58. /// that is used on Windows.
  59. /// - On Windows: No effect, always overwritten to 1
  60. ///
  61. /// Affects boost::nowide::basic_filebuf,
  62. /// boost::nowide::basic_ofstream, boost::nowide::basic_ifstream, boost::nowide::basic_fstream
  63. #if defined(BOOST_WINDOWS) || BOOST_NOWIDE_USE_WCHAR_OVERLOADS
  64. #ifdef BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT
  65. #undef BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT
  66. #endif
  67. #define BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT 1
  68. #elif !defined(BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT)
  69. #define BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT 0
  70. #endif
  71. //! @cond Doxygen_Suppress
  72. #if BOOST_VERSION < 106500 && defined(BOOST_GCC) && __GNUC__ >= 7
  73. #define BOOST_NOWIDE_FALLTHROUGH __attribute__((fallthrough))
  74. #else
  75. #define BOOST_NOWIDE_FALLTHROUGH BOOST_FALLTHROUGH
  76. #endif
  77. //! @endcond
  78. namespace boost {
  79. ///
  80. /// \brief This namespace includes implementations of the standard library functions and
  81. /// classes such that they accept UTF-8 strings on Windows.
  82. /// On other platforms (i.e. not on Windows) those functions and classes are just aliases
  83. /// of the corresponding ones from the std namespace or behave like them.
  84. ///
  85. namespace nowide {}
  86. } // namespace boost
  87. #endif // boost/nowide/config.hpp