epoc32/include/stdapis/boost/serialization/split_member.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/serialization/split_member.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,86 @@
     1.4 +#ifndef BOOST_SERIALIZATION_SPLIT_MEMBER_HPP
     1.5 +#define BOOST_SERIALIZATION_SPLIT_MEMBER_HPP
     1.6 +
     1.7 +// MS compatible compilers support #pragma once
     1.8 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
     1.9 +# pragma once
    1.10 +#endif
    1.11 +
    1.12 +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
    1.13 +// split_member.hpp:
    1.14 +
    1.15 +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 
    1.16 +// Use, modification and distribution is subject to the Boost Software
    1.17 +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.18 +// http://www.boost.org/LICENSE_1_0.txt)
    1.19 +
    1.20 +//  See http://www.boost.org for updates, documentation, and revision history.
    1.21 +
    1.22 +#include <boost/config.hpp>
    1.23 +#include <boost/mpl/eval_if.hpp>
    1.24 +#include <boost/mpl/identity.hpp>
    1.25 +
    1.26 +#include <boost/serialization/access.hpp>
    1.27 +
    1.28 +namespace boost {
    1.29 +namespace archive {
    1.30 +    namespace detail {
    1.31 +        template<class Archive> class interface_oarchive;
    1.32 +        template<class Archive> class interface_iarchive;
    1.33 +    } // namespace detail
    1.34 +} // namespace archive
    1.35 +
    1.36 +namespace serialization {
    1.37 +namespace detail {
    1.38 +
    1.39 +    template<class Archive, class T>
    1.40 +    struct member_saver {
    1.41 +        static void invoke(
    1.42 +            Archive & ar, 
    1.43 +            const T & t,
    1.44 +            const unsigned int file_version
    1.45 +        ){
    1.46 +            access::member_save(ar, t, file_version);
    1.47 +        }
    1.48 +    };
    1.49 +
    1.50 +    template<class Archive, class T>
    1.51 +    struct member_loader {
    1.52 +        static void invoke(
    1.53 +            Archive & ar, 
    1.54 +            T & t,
    1.55 +            const unsigned int file_version
    1.56 +        ){
    1.57 +            access::member_load(ar, t, file_version);
    1.58 +        }
    1.59 +    };
    1.60 +
    1.61 +} // detail
    1.62 +
    1.63 +template<class Archive, class T>
    1.64 +inline void split_member(
    1.65 +    Archive & ar, T & t, const unsigned int file_version
    1.66 +){
    1.67 +    typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
    1.68 +        BOOST_DEDUCED_TYPENAME Archive::is_saving,
    1.69 +        mpl::identity<detail::member_saver<Archive, T> >, 
    1.70 +        mpl::identity<detail::member_loader<Archive, T> >
    1.71 +    >::type typex;
    1.72 +    typex::invoke(ar, t, file_version);
    1.73 +}
    1.74 +
    1.75 +} // namespace serialization
    1.76 +} // namespace boost
    1.77 +
    1.78 +// split member function serialize funcition into save/load
    1.79 +#define BOOST_SERIALIZATION_SPLIT_MEMBER()                       \
    1.80 +template<class Archive>                                          \
    1.81 +void serialize(                                                  \
    1.82 +    Archive &ar,                                                 \
    1.83 +    const unsigned int file_version                              \
    1.84 +){                                                               \
    1.85 +    boost::serialization::split_member(ar, *this, file_version); \
    1.86 +}                                                                \
    1.87 +/**/
    1.88 +
    1.89 +#endif // BOOST_SERIALIZATION_SPLIT_MEMBER_HPP