| 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 date_time_types.hpp |
| 9 | * \author Andrey Semashev |
| 10 | * \date 13.03.2008 |
| 11 | * |
| 12 | * The header contains definition of date and time-related types supported by the library by default. |
| 13 | */ |
| 14 | |
| 15 | #ifndef BOOST_LOG_DATE_TIME_TYPES_HPP_INCLUDED_ |
| 16 | #define BOOST_LOG_DATE_TIME_TYPES_HPP_INCLUDED_ |
| 17 | |
| 18 | #include <ctime> |
| 19 | #include <boost/mpl/vector.hpp> |
| 20 | #include <boost/preprocessor/seq/enum.hpp> |
| 21 | #include <boost/date_time/gregorian/gregorian_types.hpp> |
| 22 | #include <boost/date_time/local_time/local_time_types.hpp> |
| 23 | #include <boost/date_time/posix_time/posix_time_types.hpp> |
| 24 | #include <boost/log/detail/config.hpp> |
| 25 | #include <boost/log/detail/header.hpp> |
| 26 | |
| 27 | #ifdef BOOST_HAS_PRAGMA_ONCE |
| 28 | #pragma once |
| 29 | #endif |
| 30 | |
| 31 | namespace boost { |
| 32 | |
| 33 | BOOST_LOG_OPEN_NAMESPACE |
| 34 | |
| 35 | //! Boost.Preprocessor sequence of the standard C date/time types |
| 36 | #define BOOST_LOG_NATIVE_DATE_TIME_TYPES()\ |
| 37 | (std::time_t)(std::tm) |
| 38 | |
| 39 | //! Boost.Preprocessor sequence of the standard C date types |
| 40 | #define BOOST_LOG_NATIVE_DATE_TYPES()\ |
| 41 | BOOST_LOG_NATIVE_DATE_TIME_TYPES() |
| 42 | |
| 43 | //! Boost.Preprocessor sequence of the Boost date/time types |
| 44 | #define BOOST_LOG_BOOST_DATE_TIME_TYPES()\ |
| 45 | (boost::posix_time::ptime)(boost::local_time::local_date_time) |
| 46 | |
| 47 | //! Boost.Preprocessor sequence of date/time types |
| 48 | #define BOOST_LOG_DATE_TIME_TYPES()\ |
| 49 | BOOST_LOG_NATIVE_DATE_TIME_TYPES()BOOST_LOG_BOOST_DATE_TIME_TYPES()\ |
| 50 | |
| 51 | //! Boost.Preprocessor sequence of the Boost date types |
| 52 | #define BOOST_LOG_BOOST_DATE_TYPES()\ |
| 53 | BOOST_LOG_BOOST_DATE_TIME_TYPES()(boost::gregorian::date) |
| 54 | |
| 55 | //! Boost.Preprocessor sequence of date types |
| 56 | #define BOOST_LOG_DATE_TYPES()\ |
| 57 | BOOST_LOG_NATIVE_DATE_TYPES()BOOST_LOG_BOOST_DATE_TYPES() |
| 58 | |
| 59 | |
| 60 | //! Boost.Preprocessor sequence of the standard time duration types |
| 61 | #define BOOST_LOG_NATIVE_TIME_DURATION_TYPES()\ |
| 62 | (double) /* result of difftime() */ |
| 63 | |
| 64 | //! Boost.Preprocessor sequence of the Boost time duration types |
| 65 | #define BOOST_LOG_BOOST_TIME_DURATION_TYPES()\ |
| 66 | (boost::posix_time::time_duration)(boost::gregorian::date_duration) |
| 67 | |
| 68 | //! Boost.Preprocessor sequence of time duration types |
| 69 | #define BOOST_LOG_TIME_DURATION_TYPES()\ |
| 70 | BOOST_LOG_NATIVE_TIME_DURATION_TYPES()BOOST_LOG_BOOST_TIME_DURATION_TYPES() |
| 71 | |
| 72 | |
| 73 | //! Boost.Preprocessor sequence of the Boost time period types |
| 74 | #define BOOST_LOG_BOOST_TIME_PERIOD_TYPES()\ |
| 75 | (boost::posix_time::time_period)(boost::local_time::local_time_period)(boost::gregorian::date_period) |
| 76 | |
| 77 | //! Boost.Preprocessor sequence of time period types |
| 78 | #define BOOST_LOG_TIME_PERIOD_TYPES()\ |
| 79 | BOOST_LOG_BOOST_TIME_PERIOD_TYPES() |
| 80 | |
| 81 | |
| 82 | /*! |
| 83 | * An MPL-sequence of natively supported date and time types of attributes |
| 84 | */ |
| 85 | typedef mpl::vector< |
| 86 | BOOST_PP_SEQ_ENUM(BOOST_LOG_NATIVE_DATE_TIME_TYPES()) |
| 87 | > native_date_time_types; |
| 88 | |
| 89 | /*! |
| 90 | * An MPL-sequence of Boost date and time types of attributes |
| 91 | */ |
| 92 | typedef mpl::vector< |
| 93 | BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_DATE_TIME_TYPES()) |
| 94 | > boost_date_time_types; |
| 95 | |
| 96 | /*! |
| 97 | * An MPL-sequence with the complete list of the supported date and time types |
| 98 | */ |
| 99 | typedef mpl::vector< |
| 100 | BOOST_PP_SEQ_ENUM(BOOST_LOG_DATE_TIME_TYPES()) |
| 101 | > date_time_types; |
| 102 | |
| 103 | /*! |
| 104 | * An MPL-sequence of natively supported date types of attributes |
| 105 | */ |
| 106 | typedef native_date_time_types native_date_types; |
| 107 | |
| 108 | /*! |
| 109 | * An MPL-sequence of Boost date types of attributes |
| 110 | */ |
| 111 | typedef mpl::vector< |
| 112 | BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_DATE_TYPES()) |
| 113 | > boost_date_types; |
| 114 | |
| 115 | /*! |
| 116 | * An MPL-sequence with the complete list of the supported date types |
| 117 | */ |
| 118 | typedef mpl::vector< |
| 119 | BOOST_PP_SEQ_ENUM(BOOST_LOG_DATE_TYPES()) |
| 120 | > date_types; |
| 121 | |
| 122 | /*! |
| 123 | * An MPL-sequence of natively supported time types |
| 124 | */ |
| 125 | typedef native_date_time_types native_time_types; |
| 126 | |
| 127 | //! An MPL-sequence of Boost time types |
| 128 | typedef boost_date_time_types boost_time_types; |
| 129 | |
| 130 | /*! |
| 131 | * An MPL-sequence with the complete list of the supported time types |
| 132 | */ |
| 133 | typedef date_time_types time_types; |
| 134 | |
| 135 | /*! |
| 136 | * An MPL-sequence of natively supported time duration types of attributes |
| 137 | */ |
| 138 | typedef mpl::vector< |
| 139 | BOOST_PP_SEQ_ENUM(BOOST_LOG_NATIVE_TIME_DURATION_TYPES()) |
| 140 | > native_time_duration_types; |
| 141 | |
| 142 | /*! |
| 143 | * An MPL-sequence of Boost time duration types of attributes |
| 144 | */ |
| 145 | typedef mpl::vector< |
| 146 | BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_TIME_DURATION_TYPES()) |
| 147 | > boost_time_duration_types; |
| 148 | |
| 149 | /*! |
| 150 | * An MPL-sequence with the complete list of the supported time duration types |
| 151 | */ |
| 152 | typedef mpl::vector< |
| 153 | BOOST_PP_SEQ_ENUM(BOOST_LOG_TIME_DURATION_TYPES()) |
| 154 | > time_duration_types; |
| 155 | |
| 156 | /*! |
| 157 | * An MPL-sequence of Boost time duration types of attributes |
| 158 | */ |
| 159 | typedef mpl::vector< |
| 160 | BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_TIME_PERIOD_TYPES()) |
| 161 | > boost_time_period_types; |
| 162 | |
| 163 | /*! |
| 164 | * An MPL-sequence with the complete list of the supported time period types |
| 165 | */ |
| 166 | typedef boost_time_period_types time_period_types; |
| 167 | |
| 168 | BOOST_LOG_CLOSE_NAMESPACE // namespace log |
| 169 | |
| 170 | } // namespace boost |
| 171 | |
| 172 | #include <boost/log/detail/footer.hpp> |
| 173 | |
| 174 | #endif // BOOST_LOG_DATE_TIME_TYPES_HPP_INCLUDED_ |
| 175 | |