diff options
Diffstat (limited to 'boost/date_time/gregorian/greg_serialize.hpp')
-rw-r--r-- | boost/date_time/gregorian/greg_serialize.hpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/boost/date_time/gregorian/greg_serialize.hpp b/boost/date_time/gregorian/greg_serialize.hpp index e427a48a20..a94bd73620 100644 --- a/boost/date_time/gregorian/greg_serialize.hpp +++ b/boost/date_time/gregorian/greg_serialize.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-11-11 15:19:38 -0500 (Thu, 11 Nov 2010) $ + * $Date: 2012-07-27 11:15:55 -0700 (Fri, 27 Jul 2012) $ */ #include "boost/date_time/gregorian/gregorian_types.hpp" @@ -22,6 +22,7 @@ BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration) BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration::duration_rep) BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_period) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_year) BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_month) BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_day) BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_weekday) @@ -186,6 +187,32 @@ inline void load_construct_data(Archive & ar, gregorian::date_period* dp, ::new(dp) gregorian::date_period(d,dd); } +/**** greg_year ****/ + +//! Function to save gregorian::greg_year objects using serialization lib +template<class Archive> +void save(Archive & ar, const gregorian::greg_year& gy, + unsigned int /*version*/) +{ + unsigned short us = gy; + ar & make_nvp("greg_year", us); +} +//! Function to load gregorian::greg_year objects using serialization lib +template<class Archive> +void load(Archive & ar, gregorian::greg_year& gy, unsigned int /*version*/) +{ + unsigned short us; + ar & make_nvp("greg_year", us); + gy = gregorian::greg_year(us); +} +//!override needed b/c no default constructor +template<class Archive> +inline void load_construct_data(Archive & ar, gregorian::greg_year* gy, + const unsigned int /*file_version*/) +{ + ::new(gy) gregorian::greg_year(1900); +} + /**** greg_month ****/ //! Function to save gregorian::greg_month objects using serialization lib |