date_time_types.hpp 5.0 KB

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