standard_types.hpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * Copyright Andrey Semashev 2007 - 2015.
  3. * Distributed under the Boost Software License, Version 1.0.
  4. * (See accompanying file LICENSE_1_0.txt or copy at
  5. * http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. /*!
  8. * \file standard_types.hpp
  9. * \author Andrey Semashev
  10. * \date 19.05.2007
  11. *
  12. * The header contains definition of standard types supported by the library by default.
  13. */
  14. #ifndef BOOST_LOG_STANDARD_TYPES_HPP_INCLUDED_
  15. #define BOOST_LOG_STANDARD_TYPES_HPP_INCLUDED_
  16. #include <string>
  17. #include <boost/mpl/vector.hpp>
  18. #include <boost/mpl/vector/vector30.hpp> // needed to use mpl::vector sizes greater than 20 even when the default BOOST_MPL_LIMIT_VECTOR_SIZE is not set
  19. #include <boost/preprocessor/cat.hpp>
  20. #include <boost/preprocessor/seq/enum.hpp>
  21. #include <boost/preprocessor/seq/size.hpp>
  22. #include <boost/log/detail/config.hpp>
  23. #include <boost/log/utility/string_literal_fwd.hpp>
  24. #include <boost/log/detail/header.hpp>
  25. #ifdef BOOST_HAS_PRAGMA_ONCE
  26. #pragma once
  27. #endif
  28. namespace boost {
  29. BOOST_LOG_OPEN_NAMESPACE
  30. #if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
  31. #define BOOST_LOG_AUX_STANDARD_TYPE_WCHAR_T() (wchar_t)
  32. #else
  33. #define BOOST_LOG_AUX_STANDARD_TYPE_WCHAR_T()
  34. #endif
  35. #if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_LOG_NO_CXX11_CODECVT_FACETS)
  36. #define BOOST_LOG_AUX_STANDARD_TYPE_CHAR16_T() (char16_t)
  37. #else
  38. #define BOOST_LOG_AUX_STANDARD_TYPE_CHAR16_T()
  39. #endif
  40. #if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_LOG_NO_CXX11_CODECVT_FACETS)
  41. #define BOOST_LOG_AUX_STANDARD_TYPE_CHAR32_T() (char32_t)
  42. #else
  43. #define BOOST_LOG_AUX_STANDARD_TYPE_CHAR32_T()
  44. #endif
  45. //! Boost.Preprocessor sequence of character types
  46. #define BOOST_LOG_STANDARD_CHAR_TYPES()\
  47. (char)BOOST_LOG_AUX_STANDARD_TYPE_WCHAR_T()BOOST_LOG_AUX_STANDARD_TYPE_CHAR16_T()BOOST_LOG_AUX_STANDARD_TYPE_CHAR32_T()
  48. #if defined(BOOST_HAS_LONG_LONG)
  49. #define BOOST_LOG_AUX_STANDARD_LONG_LONG_TYPES() (long long)(unsigned long long)
  50. #else
  51. #define BOOST_LOG_AUX_STANDARD_LONG_LONG_TYPES()
  52. #endif
  53. //! Boost.Preprocessor sequence of integral types
  54. #define BOOST_LOG_STANDARD_INTEGRAL_TYPES()\
  55. (bool)(signed char)(unsigned char)(short)(unsigned short)(int)(unsigned int)(long)(unsigned long)BOOST_LOG_AUX_STANDARD_LONG_LONG_TYPES()\
  56. BOOST_LOG_STANDARD_CHAR_TYPES()
  57. //! Boost.Preprocessor sequence of floating point types
  58. #define BOOST_LOG_STANDARD_FLOATING_POINT_TYPES()\
  59. (float)(double)(long double)
  60. //! Boost.Preprocessor sequence of arithmetic types
  61. #define BOOST_LOG_STANDARD_ARITHMETIC_TYPES()\
  62. BOOST_LOG_STANDARD_INTEGRAL_TYPES()BOOST_LOG_STANDARD_FLOATING_POINT_TYPES()
  63. #if defined(BOOST_LOG_USE_CHAR)
  64. #define BOOST_LOG_AUX_STANDARD_STRING_TYPES() (std::string)(boost::log::string_literal)
  65. #else
  66. #define BOOST_LOG_AUX_STANDARD_STRING_TYPES()
  67. #endif
  68. #if defined(BOOST_LOG_USE_WCHAR_T)
  69. #define BOOST_LOG_AUX_STANDARD_WSTRING_TYPES() (std::wstring)(boost::log::wstring_literal)
  70. #else
  71. #define BOOST_LOG_AUX_STANDARD_WSTRING_TYPES()
  72. #endif
  73. //! Boost.Preprocessor sequence of string types
  74. #define BOOST_LOG_STANDARD_STRING_TYPES()\
  75. BOOST_LOG_AUX_STANDARD_STRING_TYPES()BOOST_LOG_AUX_STANDARD_WSTRING_TYPES()
  76. //! Boost.Preprocessor sequence of the default attribute value types supported by the library
  77. #define BOOST_LOG_DEFAULT_ATTRIBUTE_VALUE_TYPES()\
  78. BOOST_LOG_STANDARD_ARITHMETIC_TYPES()BOOST_LOG_STANDARD_STRING_TYPES()
  79. /*!
  80. * An MPL-sequence of integral types of attributes, supported by default
  81. */
  82. typedef mpl::vector<
  83. BOOST_PP_SEQ_ENUM(BOOST_LOG_STANDARD_INTEGRAL_TYPES())
  84. > integral_types;
  85. /*!
  86. * An MPL-sequence of FP types of attributes, supported by default
  87. */
  88. typedef mpl::vector<
  89. BOOST_PP_SEQ_ENUM(BOOST_LOG_STANDARD_FLOATING_POINT_TYPES())
  90. > floating_point_types;
  91. /*!
  92. * An MPL-sequence of all numeric types of attributes, supported by default
  93. */
  94. typedef mpl::vector<
  95. BOOST_PP_SEQ_ENUM(BOOST_LOG_STANDARD_ARITHMETIC_TYPES())
  96. > arithmetic_types;
  97. //! Deprecated alias
  98. typedef arithmetic_types numeric_types;
  99. /*!
  100. * An MPL-sequence of string types of attributes, supported by default
  101. */
  102. typedef mpl::vector<
  103. BOOST_PP_SEQ_ENUM(BOOST_LOG_STANDARD_STRING_TYPES())
  104. > string_types;
  105. /*!
  106. * An MPL-sequence of all attribute value types that are supported by the library by default.
  107. */
  108. typedef BOOST_PP_CAT(mpl::vector, BOOST_PP_SEQ_SIZE(BOOST_LOG_DEFAULT_ATTRIBUTE_VALUE_TYPES()))<
  109. BOOST_PP_SEQ_ENUM(BOOST_LOG_DEFAULT_ATTRIBUTE_VALUE_TYPES())
  110. > default_attribute_value_types;
  111. //! Deprecated alias
  112. typedef default_attribute_value_types default_attribute_types;
  113. BOOST_LOG_CLOSE_NAMESPACE // namespace log
  114. } // namespace boost
  115. #include <boost/log/detail/footer.hpp>
  116. #endif // BOOST_LOG_STANDARD_TYPES_HPP_INCLUDED_