diff options
Diffstat (limited to 'boost/log/utility/type_dispatch/date_time_types.hpp')
-rw-r--r-- | boost/log/utility/type_dispatch/date_time_types.hpp | 94 |
1 files changed, 65 insertions, 29 deletions
diff --git a/boost/log/utility/type_dispatch/date_time_types.hpp b/boost/log/utility/type_dispatch/date_time_types.hpp index 36c9265213..38e6a461f8 100644 --- a/boost/log/utility/type_dispatch/date_time_types.hpp +++ b/boost/log/utility/type_dispatch/date_time_types.hpp @@ -17,9 +17,7 @@ #include <ctime> #include <boost/mpl/vector.hpp> -#include <boost/mpl/copy.hpp> -#include <boost/mpl/back_inserter.hpp> -#include <boost/mpl/push_back.hpp> +#include <boost/preprocessor/seq/enum.hpp> #include <boost/date_time/gregorian/gregorian_types.hpp> #include <boost/date_time/local_time/local_time_types.hpp> #include <boost/date_time/posix_time/posix_time_types.hpp> @@ -34,29 +32,73 @@ namespace boost { BOOST_LOG_OPEN_NAMESPACE +//! Boost.Preprocessor sequence of the standard C date/time types +#define BOOST_LOG_NATIVE_DATE_TIME_TYPES()\ + (std::time_t)(std::tm) + +//! Boost.Preprocessor sequence of the standard C date types +#define BOOST_LOG_NATIVE_DATE_TYPES()\ + BOOST_LOG_NATIVE_DATE_TIME_TYPES() + +//! Boost.Preprocessor sequence of the Boost date/time types +#define BOOST_LOG_BOOST_DATE_TIME_TYPES()\ + (boost::posix_time::ptime)(boost::local_time::local_date_time) + +//! Boost.Preprocessor sequence of date/time types +#define BOOST_LOG_DATE_TIME_TYPES()\ + BOOST_LOG_NATIVE_DATE_TIME_TYPES()BOOST_LOG_BOOST_DATE_TIME_TYPES()\ + +//! Boost.Preprocessor sequence of the Boost date types +#define BOOST_LOG_BOOST_DATE_TYPES()\ + BOOST_LOG_BOOST_DATE_TIME_TYPES()(boost::gregorian::date) + +//! Boost.Preprocessor sequence of date types +#define BOOST_LOG_DATE_TYPES()\ + BOOST_LOG_NATIVE_DATE_TYPES()BOOST_LOG_BOOST_DATE_TYPES() + + +//! Boost.Preprocessor sequence of the standard time duration types +#define BOOST_LOG_NATIVE_TIME_DURATION_TYPES()\ + (double) /* result of difftime() */ + +//! Boost.Preprocessor sequence of the Boost time duration types +#define BOOST_LOG_BOOST_TIME_DURATION_TYPES()\ + (boost::posix_time::time_duration)(boost::gregorian::date_duration) + +//! Boost.Preprocessor sequence of time duration types +#define BOOST_LOG_TIME_DURATION_TYPES()\ + BOOST_LOG_NATIVE_TIME_DURATION_TYPES()BOOST_LOG_BOOST_TIME_DURATION_TYPES() + + +//! Boost.Preprocessor sequence of the Boost time period types +#define BOOST_LOG_BOOST_TIME_PERIOD_TYPES()\ + (boost::posix_time::time_period)(boost::local_time::local_time_period)(boost::gregorian::date_period) + +//! Boost.Preprocessor sequence of time period types +#define BOOST_LOG_TIME_PERIOD_TYPES()\ + BOOST_LOG_BOOST_TIME_PERIOD_TYPES() + + /*! * An MPL-sequence of natively supported date and time types of attributes */ typedef mpl::vector< - std::time_t, - std::tm + BOOST_PP_SEQ_ENUM(BOOST_LOG_NATIVE_DATE_TIME_TYPES()) > native_date_time_types; /*! * An MPL-sequence of Boost date and time types of attributes */ typedef mpl::vector< - posix_time::ptime, - local_time::local_date_time + BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_DATE_TIME_TYPES()) > boost_date_time_types; /*! * An MPL-sequence with the complete list of the supported date and time types */ -typedef mpl::copy< - boost_date_time_types, - mpl::back_inserter< native_date_time_types > ->::type date_time_types; +typedef mpl::vector< + BOOST_PP_SEQ_ENUM(BOOST_LOG_DATE_TIME_TYPES()) +> date_time_types; /*! * An MPL-sequence of natively supported date types of attributes @@ -66,18 +108,16 @@ typedef native_date_time_types native_date_types; /*! * An MPL-sequence of Boost date types of attributes */ -typedef mpl::push_back< - boost_date_time_types, - gregorian::date ->::type boost_date_types; +typedef mpl::vector< + BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_DATE_TYPES()) +> boost_date_types; /*! * An MPL-sequence with the complete list of the supported date types */ -typedef mpl::copy< - boost_date_types, - mpl::back_inserter< native_date_types > ->::type date_types; +typedef mpl::vector< + BOOST_PP_SEQ_ENUM(BOOST_LOG_DATE_TYPES()) +> date_types; /*! * An MPL-sequence of natively supported time types @@ -96,32 +136,28 @@ typedef date_time_types time_types; * An MPL-sequence of natively supported time duration types of attributes */ typedef mpl::vector< - double // result of difftime + BOOST_PP_SEQ_ENUM(BOOST_LOG_NATIVE_TIME_DURATION_TYPES()) > native_time_duration_types; /*! * An MPL-sequence of Boost time duration types of attributes */ typedef mpl::vector< - posix_time::time_duration, - gregorian::date_duration + BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_TIME_DURATION_TYPES()) > boost_time_duration_types; /*! * An MPL-sequence with the complete list of the supported time duration types */ -typedef mpl::copy< - boost_time_duration_types, - mpl::back_inserter< native_time_duration_types > ->::type time_duration_types; +typedef mpl::vector< + BOOST_PP_SEQ_ENUM(BOOST_LOG_TIME_DURATION_TYPES()) +> time_duration_types; /*! * An MPL-sequence of Boost time duration types of attributes */ typedef mpl::vector< - posix_time::time_period, - local_time::local_time_period, - gregorian::date_period + BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_TIME_PERIOD_TYPES()) > boost_time_period_types; /*! |