|
| 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 | + |
| 12 | +/// @file |
| 13 | + |
| 14 | +#include <boost/config.hpp> |
| 15 | +#include <boost/nowide/replacement.hpp> |
| 16 | +#include <boost/version.hpp> |
| 17 | + |
| 18 | +//! @cond Doxygen_Suppress |
| 19 | + |
| 20 | +// MinGW32 requires a __MSVCRT_VERSION__ defined to make some functions available, e.g. _stat64 |
| 21 | +// Hence define this here to target MSVC 7.0 which has the required functions and do it as early as possible |
| 22 | +// as including a system header might default this to 0x0600 which is to low |
| 23 | +#if defined(__MINGW32__) && !defined(__MSVCRT_VERSION__) |
| 24 | +#define __MSVCRT_VERSION__ 0x0700 |
| 25 | +#endif |
| 26 | + |
| 27 | +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK) |
| 28 | +#ifdef BOOST_NOWIDE_SOURCE |
| 29 | +#define BOOST_NOWIDE_DECL BOOST_SYMBOL_EXPORT |
| 30 | +#else |
| 31 | +#define BOOST_NOWIDE_DECL BOOST_SYMBOL_IMPORT |
| 32 | +#endif // BOOST_NOWIDE_SOURCE |
| 33 | +#else |
| 34 | +#define BOOST_NOWIDE_DECL |
| 35 | +#endif // BOOST_NOWIDE_DYN_LINK |
| 36 | + |
| 37 | +// |
| 38 | +// Automatically link to the correct build variant where possible. |
| 39 | +// |
| 40 | +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_NOWIDE_NO_LIB) && !defined(BOOST_NOWIDE_SOURCE) |
| 41 | +// |
| 42 | +// Set the name of our library, this will get undef'ed by auto_link.hpp |
| 43 | +// once it's done with it: |
| 44 | +// |
| 45 | +#define BOOST_LIB_NAME boost_nowide |
| 46 | +// |
| 47 | +// If we're importing code from a dll, then tell auto_link.hpp about it: |
| 48 | +// |
| 49 | +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK) |
| 50 | +#define BOOST_DYN_LINK |
| 51 | +#endif |
| 52 | +// |
| 53 | +// And include the header that does the work: |
| 54 | +// |
| 55 | +#include <boost/config/auto_link.hpp> |
| 56 | +#endif // auto-linking disabled |
| 57 | + |
| 58 | +//! @endcond |
| 59 | + |
| 60 | +/// @def BOOST_NOWIDE_USE_WCHAR_OVERLOADS |
| 61 | +/// @brief Whether to use the wchar_t* overloads in fstream/filebuf |
| 62 | +/// Enabled on Windows and Cygwin as the latter may use wchar_t in filesystem::path |
| 63 | +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) |
| 64 | +#define BOOST_NOWIDE_USE_WCHAR_OVERLOADS 1 |
| 65 | +#else |
| 66 | +#define BOOST_NOWIDE_USE_WCHAR_OVERLOADS 0 |
| 67 | +#endif |
| 68 | + |
| 69 | +/// @def BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT |
| 70 | +/// @brief Define to 1 to use internal class from filebuf.hpp |
| 71 | +/// |
| 72 | +/// - On Non-Windows platforms: Define to 1 to use the same class from header <filebuf.hpp> |
| 73 | +/// that is used on Windows. |
| 74 | +/// - On Windows: No effect, always overwritten to 1 |
| 75 | +/// |
| 76 | +/// Affects boost::nowide::basic_filebuf, |
| 77 | +/// boost::nowide::basic_ofstream, boost::nowide::basic_ifstream, boost::nowide::basic_fstream |
| 78 | +#if defined(BOOST_WINDOWS) || BOOST_NOWIDE_USE_WCHAR_OVERLOADS |
| 79 | +#ifdef BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT |
| 80 | +#undef BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT |
| 81 | +#endif |
| 82 | +#define BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT 1 |
| 83 | +#elif !defined(BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT) |
| 84 | +#define BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT 0 |
| 85 | +#endif |
| 86 | + |
| 87 | +//! @cond Doxygen_Suppress |
| 88 | + |
| 89 | +#if BOOST_VERSION < 106500 && defined(BOOST_GCC) && __GNUC__ >= 7 |
| 90 | +#define BOOST_NOWIDE_FALLTHROUGH __attribute__((fallthrough)) |
| 91 | +#else |
| 92 | +#define BOOST_NOWIDE_FALLTHROUGH BOOST_FALLTHROUGH |
| 93 | +#endif |
| 94 | + |
| 95 | +//! @endcond |
| 96 | + |
| 97 | +namespace boost { |
| 98 | +/// |
| 99 | +/// \brief This namespace includes implementations of the standard library functions and |
| 100 | +/// classes such that they accept UTF-8 strings on Windows. |
| 101 | +/// On other platforms (i.e. not on Windows) those functions and classes are just aliases |
| 102 | +/// of the corresponding ones from the std namespace or behave like them. |
| 103 | +/// |
| 104 | +namespace nowide {} |
| 105 | +} // namespace boost |
| 106 | + |
| 107 | +#endif // boost/nowide/config.hpp |
0 commit comments