epoc32/include/stdapis/boost/serialization/level.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/level.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,120 @@
     1.4 +#ifndef BOOST_SERIALIZATION_LEVEL_HPP
     1.5 +#define BOOST_SERIALIZATION_LEVEL_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 +// level.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/detail/workaround.hpp>
    1.24 +
    1.25 +#include <boost/type_traits/is_fundamental.hpp>
    1.26 +#include <boost/type_traits/is_enum.hpp>
    1.27 +#include <boost/type_traits/is_array.hpp>
    1.28 +#include <boost/type_traits/is_class.hpp>
    1.29 +#include <boost/type_traits/is_base_and_derived.hpp>
    1.30 +
    1.31 +#include <boost/mpl/eval_if.hpp>
    1.32 +#include <boost/mpl/int.hpp>
    1.33 +#include <boost/mpl/integral_c.hpp>
    1.34 +#include <boost/mpl/integral_c_tag.hpp>
    1.35 +#include <boost/mpl/aux_/nttp_decl.hpp>
    1.36 +
    1.37 +#include <boost/serialization/level_enum.hpp>
    1.38 +
    1.39 +namespace boost {
    1.40 +namespace serialization {
    1.41 +
    1.42 +struct basic_traits;
    1.43 +
    1.44 +// default serialization implementation level
    1.45 +template<class T>
    1.46 +struct implementation_level {
    1.47 +    template<class U>
    1.48 +    struct traits_class_level {
    1.49 +        typedef  BOOST_DEDUCED_TYPENAME U::level type;
    1.50 +    };
    1.51 +
    1.52 +    typedef mpl::integral_c_tag tag;
    1.53 +    // note: at least one compiler complained w/o the full qualification
    1.54 +    // on basic traits below
    1.55 +    typedef
    1.56 +        BOOST_DEDUCED_TYPENAME mpl::eval_if<
    1.57 +            is_base_and_derived<boost::serialization::basic_traits, T>,
    1.58 +            traits_class_level<T>,
    1.59 +        //else
    1.60 +        BOOST_DEDUCED_TYPENAME mpl::eval_if<
    1.61 +            is_fundamental<T>,
    1.62 +            mpl::int_<primitive_type>,
    1.63 +        //else
    1.64 +        BOOST_DEDUCED_TYPENAME mpl::eval_if<
    1.65 +            is_class<T>,
    1.66 +            mpl::int_<object_class_info>,
    1.67 +        //else
    1.68 +        BOOST_DEDUCED_TYPENAME mpl::eval_if<
    1.69 +            is_array<T>,
    1.70 +            #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
    1.71 +                mpl::int_<not_serializable>,
    1.72 +            #else
    1.73 +                mpl::int_<object_serializable>,
    1.74 +            #endif
    1.75 +        //else
    1.76 +        BOOST_DEDUCED_TYPENAME mpl::eval_if<
    1.77 +            is_enum<T>,
    1.78 +            //#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
    1.79 +            //    mpl::int_<not_serializable>,
    1.80 +            //#else
    1.81 +                mpl::int_<primitive_type>,
    1.82 +            //#endif
    1.83 +        //else
    1.84 +            mpl::int_<not_serializable>
    1.85 +        >
    1.86 +        >
    1.87 +        >
    1.88 +        >
    1.89 +        >::type type;
    1.90 +        // vc 7.1 doesn't like enums here
    1.91 +    BOOST_STATIC_CONSTANT(int, value = implementation_level::type::value);
    1.92 +};
    1.93 +
    1.94 +
    1.95 +template<class T, BOOST_MPL_AUX_NTTP_DECL(int, L) >
    1.96 +inline bool operator>=(implementation_level<T> t, enum level_type l)
    1.97 +{
    1.98 +    return t.value >= (int)l;
    1.99 +}
   1.100 +
   1.101 +} // namespace serialization
   1.102 +} // namespace boost
   1.103 +
   1.104 +// specify the level of serialization implementation for the class
   1.105 +// require that class info saved when versioning is used
   1.106 +#define BOOST_CLASS_IMPLEMENTATION(T, E)                 \
   1.107 +    namespace boost {                                    \
   1.108 +    namespace serialization {                            \
   1.109 +    template <>                                          \
   1.110 +    struct implementation_level< T >                     \
   1.111 +    {                                                    \
   1.112 +        typedef mpl::integral_c_tag tag;                 \
   1.113 +        typedef mpl::int_< E > type;                     \
   1.114 +        BOOST_STATIC_CONSTANT(                           \
   1.115 +            int,                                         \
   1.116 +            value = implementation_level::type::value    \
   1.117 +        );                                               \
   1.118 +    };                                                   \
   1.119 +    }                                                    \
   1.120 +    }
   1.121 +    /**/
   1.122 +
   1.123 +#endif // BOOST_SERIALIZATION_LEVEL_HPP