author | William Roberts <williamr@symbian.org> |
Tue, 16 Mar 2010 16:12:26 +0000 | |
branch | Symbian2 |
changeset 2 | 2fe1408b6811 |
permissions | -rw-r--r-- |
williamr@2 | 1 |
#ifndef BOOST_SERIALIZATION_TRAITS_HPP |
williamr@2 | 2 |
#define BOOST_SERIALIZATION_TRAITS_HPP |
williamr@2 | 3 |
|
williamr@2 | 4 |
// MS compatible compilers support #pragma once |
williamr@2 | 5 |
#if defined(_MSC_VER) && (_MSC_VER >= 1020) |
williamr@2 | 6 |
# pragma once |
williamr@2 | 7 |
#endif |
williamr@2 | 8 |
|
williamr@2 | 9 |
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
williamr@2 | 10 |
// traits.hpp: |
williamr@2 | 11 |
|
williamr@2 | 12 |
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . |
williamr@2 | 13 |
// Use, modification and distribution is subject to the Boost Software |
williamr@2 | 14 |
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
williamr@2 | 15 |
// http://www.boost.org/LICENSE_1_0.txt) |
williamr@2 | 16 |
|
williamr@2 | 17 |
// See http://www.boost.org for updates, documentation, and revision history. |
williamr@2 | 18 |
|
williamr@2 | 19 |
// This header is used to apply serialization traits to templates. The |
williamr@2 | 20 |
// standard system can't be used for platforms which don't support |
williamr@2 | 21 |
// Partial Templlate Specialization. |
williamr@2 | 22 |
|
williamr@2 | 23 |
// The motivation for this is the Name-Value Pair (NVP) template. |
williamr@2 | 24 |
// it has to work the same on all platforms in order for archives |
williamr@2 | 25 |
// to be portable accross platforms. |
williamr@2 | 26 |
|
williamr@2 | 27 |
#include <boost/config.hpp> |
williamr@2 | 28 |
#include <boost/static_assert.hpp> |
williamr@2 | 29 |
|
williamr@2 | 30 |
#include <boost/mpl/int.hpp> |
williamr@2 | 31 |
#include <boost/serialization/level_enum.hpp> |
williamr@2 | 32 |
#include <boost/serialization/tracking_enum.hpp> |
williamr@2 | 33 |
|
williamr@2 | 34 |
namespace boost { |
williamr@2 | 35 |
namespace serialization { |
williamr@2 | 36 |
|
williamr@2 | 37 |
// common base class used to detect appended traits class |
williamr@2 | 38 |
struct basic_traits {}; |
williamr@2 | 39 |
|
williamr@2 | 40 |
template <class T> |
williamr@2 | 41 |
struct extended_type_info_impl; |
williamr@2 | 42 |
|
williamr@2 | 43 |
template< |
williamr@2 | 44 |
class T, |
williamr@2 | 45 |
int Level, |
williamr@2 | 46 |
int Tracking, |
williamr@2 | 47 |
unsigned int Version = 0, |
williamr@2 | 48 |
class ETII = extended_type_info_impl< T > |
williamr@2 | 49 |
> |
williamr@2 | 50 |
struct traits : public basic_traits { |
williamr@2 | 51 |
BOOST_STATIC_ASSERT(Version == 0 || Level >= object_class_info); |
williamr@2 | 52 |
BOOST_STATIC_ASSERT(Tracking == track_never || Level >= object_serializable); |
williamr@2 | 53 |
typedef BOOST_DEDUCED_TYPENAME mpl::int_<Level> level; |
williamr@2 | 54 |
typedef BOOST_DEDUCED_TYPENAME mpl::int_<Tracking> tracking; |
williamr@2 | 55 |
typedef BOOST_DEDUCED_TYPENAME mpl::int_<Version> version; |
williamr@2 | 56 |
typedef ETII type_info_implementation; |
williamr@2 | 57 |
}; |
williamr@2 | 58 |
|
williamr@2 | 59 |
} // namespace serialization |
williamr@2 | 60 |
} // namespace boost |
williamr@2 | 61 |
|
williamr@2 | 62 |
#endif // BOOST_SERIALIZATION_TRAITS_HPP |