• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
15 #ifndef BOOST_LOG_STANDARD_TYPES_HPP_INCLUDED_
16 #define BOOST_LOG_STANDARD_TYPES_HPP_INCLUDED_
17 
18 #include <string>
19 #include <boost/mpl/vector.hpp>
20 #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
21 #include <boost/preprocessor/cat.hpp>
22 #include <boost/preprocessor/seq/enum.hpp>
23 #include <boost/preprocessor/seq/size.hpp>
24 #include <boost/log/detail/config.hpp>
25 #include <boost/log/utility/string_literal_fwd.hpp>
26 #include <boost/log/detail/header.hpp>
27 
28 #ifdef BOOST_HAS_PRAGMA_ONCE
29 #pragma once
30 #endif
31 
32 namespace boost {
33 
34 BOOST_LOG_OPEN_NAMESPACE
35 
36 #if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
37 #define BOOST_LOG_AUX_STANDARD_TYPE_WCHAR_T() (wchar_t)
38 #else
39 #define BOOST_LOG_AUX_STANDARD_TYPE_WCHAR_T()
40 #endif
41 
42 #if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_LOG_NO_CXX11_CODECVT_FACETS)
43 #define BOOST_LOG_AUX_STANDARD_TYPE_CHAR16_T() (char16_t)
44 #else
45 #define BOOST_LOG_AUX_STANDARD_TYPE_CHAR16_T()
46 #endif
47 
48 #if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_LOG_NO_CXX11_CODECVT_FACETS)
49 #define BOOST_LOG_AUX_STANDARD_TYPE_CHAR32_T() (char32_t)
50 #else
51 #define BOOST_LOG_AUX_STANDARD_TYPE_CHAR32_T()
52 #endif
53 
54 //! Boost.Preprocessor sequence of character types
55 #define BOOST_LOG_STANDARD_CHAR_TYPES()\
56     (char)BOOST_LOG_AUX_STANDARD_TYPE_WCHAR_T()BOOST_LOG_AUX_STANDARD_TYPE_CHAR16_T()BOOST_LOG_AUX_STANDARD_TYPE_CHAR32_T()
57 
58 #if defined(BOOST_HAS_LONG_LONG)
59 #define BOOST_LOG_AUX_STANDARD_LONG_LONG_TYPES() (long long)(unsigned long long)
60 #else
61 #define BOOST_LOG_AUX_STANDARD_LONG_LONG_TYPES()
62 #endif
63 
64 //! Boost.Preprocessor sequence of integral types
65 #define BOOST_LOG_STANDARD_INTEGRAL_TYPES()\
66     (bool)(signed char)(unsigned char)(short)(unsigned short)(int)(unsigned int)(long)(unsigned long)BOOST_LOG_AUX_STANDARD_LONG_LONG_TYPES()\
67     BOOST_LOG_STANDARD_CHAR_TYPES()
68 
69 //! Boost.Preprocessor sequence of floating point types
70 #define BOOST_LOG_STANDARD_FLOATING_POINT_TYPES()\
71     (float)(double)(long double)
72 
73 //! Boost.Preprocessor sequence of arithmetic types
74 #define BOOST_LOG_STANDARD_ARITHMETIC_TYPES()\
75     BOOST_LOG_STANDARD_INTEGRAL_TYPES()BOOST_LOG_STANDARD_FLOATING_POINT_TYPES()
76 
77 #if defined(BOOST_LOG_USE_CHAR)
78 #define BOOST_LOG_AUX_STANDARD_STRING_TYPES() (std::string)(boost::log::string_literal)
79 #else
80 #define BOOST_LOG_AUX_STANDARD_STRING_TYPES()
81 #endif
82 
83 #if defined(BOOST_LOG_USE_WCHAR_T)
84 #define BOOST_LOG_AUX_STANDARD_WSTRING_TYPES() (std::wstring)(boost::log::wstring_literal)
85 #else
86 #define BOOST_LOG_AUX_STANDARD_WSTRING_TYPES()
87 #endif
88 
89 //! Boost.Preprocessor sequence of string types
90 #define BOOST_LOG_STANDARD_STRING_TYPES()\
91     BOOST_LOG_AUX_STANDARD_STRING_TYPES()BOOST_LOG_AUX_STANDARD_WSTRING_TYPES()
92 
93 //! Boost.Preprocessor sequence of the default attribute value types supported by the library
94 #define BOOST_LOG_DEFAULT_ATTRIBUTE_VALUE_TYPES()\
95     BOOST_LOG_STANDARD_ARITHMETIC_TYPES()BOOST_LOG_STANDARD_STRING_TYPES()
96 
97 
98 /*!
99  * An MPL-sequence of integral types of attributes, supported by default
100  */
101 typedef mpl::vector<
102     BOOST_PP_SEQ_ENUM(BOOST_LOG_STANDARD_INTEGRAL_TYPES())
103 > integral_types;
104 
105 /*!
106  * An MPL-sequence of FP types of attributes, supported by default
107  */
108 typedef mpl::vector<
109     BOOST_PP_SEQ_ENUM(BOOST_LOG_STANDARD_FLOATING_POINT_TYPES())
110 > floating_point_types;
111 
112 /*!
113  * An MPL-sequence of all numeric types of attributes, supported by default
114  */
115 typedef mpl::vector<
116     BOOST_PP_SEQ_ENUM(BOOST_LOG_STANDARD_ARITHMETIC_TYPES())
117 > arithmetic_types;
118 
119 //! Deprecated alias
120 typedef arithmetic_types numeric_types;
121 
122 /*!
123  * An MPL-sequence of string types of attributes, supported by default
124  */
125 typedef mpl::vector<
126     BOOST_PP_SEQ_ENUM(BOOST_LOG_STANDARD_STRING_TYPES())
127 > string_types;
128 
129 /*!
130  * An MPL-sequence of all attribute value types that are supported by the library by default.
131  */
132 typedef BOOST_PP_CAT(mpl::vector, BOOST_PP_SEQ_SIZE(BOOST_LOG_DEFAULT_ATTRIBUTE_VALUE_TYPES()))<
133     BOOST_PP_SEQ_ENUM(BOOST_LOG_DEFAULT_ATTRIBUTE_VALUE_TYPES())
134 > default_attribute_value_types;
135 
136 //! Deprecated alias
137 typedef default_attribute_value_types default_attribute_types;
138 
139 BOOST_LOG_CLOSE_NAMESPACE // namespace log
140 
141 } // namespace boost
142 
143 #include <boost/log/detail/footer.hpp>
144 
145 #endif // BOOST_LOG_STANDARD_TYPES_HPP_INCLUDED_
146