epoc32/include/stdapis/boost/serialization/version.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
#ifndef BOOST_SERIALIZATION_VERSION_HPP
williamr@4
     2
#define BOOST_SERIALIZATION_VERSION_HPP
williamr@2
     3
williamr@4
     4
// MS compatible compilers support #pragma once
williamr@4
     5
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
williamr@4
     6
# pragma once
williamr@2
     7
#endif
williamr@2
     8
williamr@4
     9
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
williamr@4
    10
// version.hpp:
williamr@2
    11
williamr@4
    12
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 
williamr@4
    13
// Use, modification and distribution is subject to the Boost Software
williamr@4
    14
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
williamr@4
    15
// http://www.boost.org/LICENSE_1_0.txt)
williamr@2
    16
williamr@4
    17
//  See http://www.boost.org for updates, documentation, and revision history.
williamr@4
    18
williamr@4
    19
#include <boost/config.hpp>
williamr@4
    20
#include <boost/mpl/int.hpp>
williamr@4
    21
#include <boost/mpl/eval_if.hpp>
williamr@4
    22
#include <boost/mpl/identity.hpp>
williamr@4
    23
#include <boost/mpl/integral_c_tag.hpp>
williamr@4
    24
williamr@4
    25
#include <boost/type_traits/is_base_and_derived.hpp>
williamr@4
    26
//#include <boost/serialization/traits.hpp>
williamr@4
    27
williamr@4
    28
namespace boost { 
williamr@4
    29
namespace serialization {
williamr@4
    30
williamr@4
    31
struct basic_traits;
williamr@4
    32
williamr@4
    33
// default version number is 0. Override with higher version
williamr@4
    34
// when class definition changes.
williamr@4
    35
template<class T>
williamr@4
    36
struct version
williamr@4
    37
{
williamr@4
    38
    template<class U>
williamr@4
    39
    struct traits_class_version {
williamr@4
    40
        typedef BOOST_DEDUCED_TYPENAME U::version type;
williamr@4
    41
    };
williamr@4
    42
williamr@4
    43
    typedef mpl::integral_c_tag tag;
williamr@4
    44
    // note: at least one compiler complained w/o the full qualification
williamr@4
    45
    // on basic traits below
williamr@4
    46
    typedef
williamr@4
    47
        BOOST_DEDUCED_TYPENAME mpl::eval_if<
williamr@4
    48
            is_base_and_derived<boost::serialization::basic_traits,T>,
williamr@4
    49
            traits_class_version<T>,
williamr@4
    50
            mpl::int_<0>
williamr@4
    51
        >::type type;
williamr@4
    52
    BOOST_STATIC_CONSTANT(unsigned int, value = version::type::value);
williamr@4
    53
};
williamr@4
    54
williamr@4
    55
} // namespace serialization
williamr@4
    56
} // namespace boost
williamr@4
    57
williamr@4
    58
// specify the current version number for the class
williamr@4
    59
#define BOOST_CLASS_VERSION(T, N)                                      \
williamr@4
    60
namespace boost {                                                      \
williamr@4
    61
namespace serialization {                                              \
williamr@4
    62
template<>                                                             \
williamr@4
    63
struct version<T >                                                     \
williamr@4
    64
{                                                                      \
williamr@4
    65
    typedef mpl::int_<N> type;                                         \
williamr@4
    66
    typedef mpl::integral_c_tag tag;                                   \
williamr@4
    67
    BOOST_STATIC_CONSTANT(unsigned int, value = version::type::value); \
williamr@4
    68
    /* require that class info saved when versioning is used */        \
williamr@4
    69
    /*                                                                 \
williamr@4
    70
    BOOST_STATIC_ASSERT((                                              \
williamr@4
    71
        mpl::or_<                                                      \
williamr@4
    72
            mpl::equal_to<                                             \
williamr@4
    73
                mpl::int_<0>,                                          \
williamr@4
    74
                mpl::int_<N>                                           \
williamr@4
    75
            >,                                                         \
williamr@4
    76
            mpl::equal_to<                                             \
williamr@4
    77
                implementation_level<T>,                               \
williamr@4
    78
                mpl::int_<object_class_info>                           \
williamr@4
    79
            >                                                          \
williamr@4
    80
        >::value                                                       \
williamr@4
    81
    ));                                                                \
williamr@4
    82
    */                                                                 \
williamr@4
    83
};                                                                     \
williamr@4
    84
}                                                                      \
williamr@4
    85
}
williamr@4
    86
williamr@4
    87
#endif // BOOST_SERIALIZATION_VERSION_HPP