forked from boostorg/fusion
merge from trunk
[SVN r61043]
This commit is contained in:
76
include/boost/fusion/adapted/class/adapt_assoc_class.hpp
Normal file
76
include/boost/fusion/adapted/class/adapt_assoc_class.hpp
Normal file
@ -0,0 +1,76 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2007 Dan Marsden
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_HPP
|
||||
#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_HPP
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#include <boost/fusion/adapted/struct/detail/extension.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_base.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/at_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/category_of_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/size_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/end_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/value_of_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/deref_data_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/key_of_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/value_of_data_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/extension.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/adapt_base.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0(A, B, C, D, E)\
|
||||
((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1(A, B, C, D, E)\
|
||||
((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0_END
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1_END
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_C( \
|
||||
TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_CLASS_C_BASE(TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,5) \
|
||||
\
|
||||
template< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
|
||||
> \
|
||||
struct struct_assoc_key<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ), I> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(5, 4, ATTRIBUTE) type; \
|
||||
};
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_TPL_CLASS( \
|
||||
TEMPLATE_PARAMS_SEQ, NAME_SEQ, ATTRIBUTES) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
(1)TEMPLATE_PARAMS_SEQ, \
|
||||
(1)NAME_SEQ, \
|
||||
assoc_struct_tag, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 ATTRIBUTES,_END), \
|
||||
BOOST_FUSION_ADAPT_ASSOC_CLASS_C)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS(NAME, ATTRIBUTES) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
(0), \
|
||||
(0)(NAME), \
|
||||
assoc_struct_tag, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 ATTRIBUTES,_END), \
|
||||
BOOST_FUSION_ADAPT_ASSOC_CLASS_C)
|
||||
|
||||
#endif
|
@ -0,0 +1,28 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_NAMED_HPP
|
||||
#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_NAMED_HPP
|
||||
|
||||
#include <boost/fusion/adapted/class/adapt_assoc_class.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/proxy_type.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED_NS( \
|
||||
WRAPPED_TYPE, NAMESPACE_SEQ, NAME, ATTRIBUTES) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE( \
|
||||
WRAPPED_TYPE,(0)NAMESPACE_SEQ,NAME) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_ASSOC_CLASS( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ)NAME, \
|
||||
ATTRIBUTES)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED_NS( \
|
||||
WRAPPED_TYPE,(boost)(fusion)(adapted),NAME,ATTRIBUTES)
|
||||
|
||||
#endif
|
63
include/boost/fusion/adapted/class/adapt_class.hpp
Normal file
63
include/boost/fusion/adapted/class/adapt_class.hpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2009-2010 Hartmut Kaiser
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_HPP
|
||||
#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_HPP
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#include <boost/fusion/adapted/struct/detail/extension.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_base.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/at_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/category_of_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/size_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/end_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/value_of_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/extension.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/adapt_base.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS_FILLER_0(A, B, C, D)\
|
||||
((A, B, C, D)) BOOST_FUSION_ADAPT_CLASS_FILLER_1
|
||||
#define BOOST_FUSION_ADAPT_CLASS_FILLER_1(A, B, C, D)\
|
||||
((A, B, C, D)) BOOST_FUSION_ADAPT_CLASS_FILLER_0
|
||||
#define BOOST_FUSION_ADAPT_CLASS_FILLER_0_END
|
||||
#define BOOST_FUSION_ADAPT_CLASS_FILLER_1_END
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS_C(TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE) \
|
||||
BOOST_FUSION_ADAPT_CLASS_C_BASE( \
|
||||
TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE, 4)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_TPL_CLASS(TEMPLATE_PARAMS_SEQ, NAME_SEQ , ATTRIBUTES)\
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
(1)TEMPLATE_PARAMS_SEQ, \
|
||||
(1)NAME_SEQ, \
|
||||
struct_tag, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 ATTRIBUTES,_END), \
|
||||
BOOST_FUSION_ADAPT_CLASS_C)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS(NAME, ATTRIBUTES) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
(0), \
|
||||
(0)(NAME), \
|
||||
struct_tag, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 ATTRIBUTES,_END), \
|
||||
BOOST_FUSION_ADAPT_CLASS_C)
|
||||
|
||||
|
||||
#endif
|
30
include/boost/fusion/adapted/class/adapt_class_named.hpp
Normal file
30
include/boost/fusion/adapted/class/adapt_class_named.hpp
Normal file
@ -0,0 +1,30 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2009-2010 Hartmut Kaiser
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_NAMED_HPP
|
||||
#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_NAMED_HPP
|
||||
|
||||
#include <boost/fusion/adapted/class/adapt_class.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/proxy_type.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS_NAMED_NS( \
|
||||
WRAPPED_TYPE, NAMESPACE_SEQ, NAME, ATTRIBUTES) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE( \
|
||||
WRAPPED_TYPE,(0)NAMESPACE_SEQ,NAME) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_CLASS( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ)NAME, \
|
||||
ATTRIBUTES)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \
|
||||
BOOST_FUSION_ADAPT_CLASS_NAMED_NS( \
|
||||
WRAPPED_TYPE,(boost)(fusion)(adapted),NAME,ATTRIBUTES)
|
||||
|
||||
#endif
|
105
include/boost/fusion/adapted/class/class_iterator.hpp
Normal file
105
include/boost/fusion/adapted/class/class_iterator.hpp
Normal file
@ -0,0 +1,105 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CLASS_ITERATOR_OCTOBER_4_2009_839M)
|
||||
#define FUSION_CLASS_ITERATOR_OCTOBER_4_2009_839M
|
||||
|
||||
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||
#include <boost/fusion/adapted/class/extension.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/config/no_tr1/utility.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
template <typename Class, int N_>
|
||||
struct class_iterator
|
||||
: iterator_facade<class_iterator<Class, N_>, random_access_traversal_tag>
|
||||
{
|
||||
BOOST_MPL_ASSERT_RELATION(N_, >=, 0);
|
||||
BOOST_MPL_ASSERT_RELATION(N_, <=, extension::class_size<Class>::value);
|
||||
|
||||
typedef mpl::int_<N_> index;
|
||||
typedef Class class_type;
|
||||
|
||||
class_iterator(Class& class_)
|
||||
: class_(class_) {}
|
||||
Class& class_;
|
||||
|
||||
template <typename Iterator>
|
||||
struct value_of
|
||||
: extension::class_member<Class, N_>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
struct deref
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_const<Class>
|
||||
, typename extension::class_member<Class, N_>::get_type
|
||||
, typename extension::class_member<Class, N_>::proxy
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator const& iter)
|
||||
{
|
||||
return extension::class_member<Class, N_>::
|
||||
call(iter.class_);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Iterator, typename N>
|
||||
struct advance
|
||||
{
|
||||
typedef typename Iterator::index index;
|
||||
typedef typename Iterator::class_type class_type;
|
||||
typedef class_iterator<class_type, index::value + N::value> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& iter)
|
||||
{
|
||||
return type(iter.class_);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
struct next : advance<Iterator, mpl::int_<1> > {};
|
||||
|
||||
template <typename Iterator>
|
||||
struct prior : advance<Iterator, mpl::int_<-1> > {};
|
||||
|
||||
template <typename I1, typename I2>
|
||||
struct distance : mpl::minus<typename I2::index, typename I1::index>
|
||||
{
|
||||
typedef typename
|
||||
mpl::minus<
|
||||
typename I2::index, typename I1::index
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(I1 const&, I2 const&)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
115
include/boost/fusion/adapted/class/detail/adapt_base.hpp
Normal file
115
include/boost/fusion/adapted/class/detail/adapt_base.hpp
Normal file
@ -0,0 +1,115 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_CLASS_DETAIL_ADAPT_BASE_HPP
|
||||
#define BOOST_FUSION_ADAPTED_CLASS_DETAIL_ADAPT_BASE_HPP
|
||||
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/seq/seq.hpp>
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
//cschmidt: Spirit relies on Fusion defining class_member_proxy in the
|
||||
//boost::fusion::extension namespace, with two nested types named lvalue and
|
||||
//rvalue.
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_TEMPLATE_IMPL(TEMPLATE_PARAMS_SEQ)\
|
||||
typename detail::get_identity< \
|
||||
lvalue \
|
||||
, BOOST_PP_SEQ_ELEM(1,TEMPLATE_PARAMS_SEQ) \
|
||||
>::type
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_NON_TEMPLATE_IMPL( \
|
||||
TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
lvalue
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS_C_BASE(\
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE) \
|
||||
\
|
||||
template< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
|
||||
> \
|
||||
struct class_member_proxy< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
|
||||
, I \
|
||||
> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) lvalue; \
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) rvalue; \
|
||||
\
|
||||
class_member_proxy(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj)\
|
||||
: obj(obj) \
|
||||
{} \
|
||||
\
|
||||
template<class Arg> \
|
||||
class_member_proxy& \
|
||||
operator=(Arg const& val) \
|
||||
{ \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 3, ATTRIBUTE); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
operator lvalue() \
|
||||
{ \
|
||||
return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj; \
|
||||
}; \
|
||||
\
|
||||
template< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
|
||||
> \
|
||||
struct struct_member<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ), I> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) lvalue; \
|
||||
\
|
||||
typedef \
|
||||
BOOST_PP_IF( \
|
||||
BOOST_PP_SEQ_HEAD(TEMPLATE_PARAMS_SEQ), \
|
||||
BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_TEMPLATE_IMPL, \
|
||||
BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_NON_TEMPLATE_IMPL)( \
|
||||
TEMPLATE_PARAMS_SEQ) \
|
||||
type; \
|
||||
\
|
||||
template<typename Seq> \
|
||||
struct apply \
|
||||
{ \
|
||||
typedef \
|
||||
class_member_proxy< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
|
||||
, I \
|
||||
> \
|
||||
proxy; \
|
||||
\
|
||||
typedef typename \
|
||||
mpl::if_< \
|
||||
is_const<Seq> \
|
||||
, BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) \
|
||||
, proxy \
|
||||
>::type \
|
||||
type; \
|
||||
\
|
||||
static proxy \
|
||||
call(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj) \
|
||||
{ \
|
||||
return proxy(obj); \
|
||||
} \
|
||||
\
|
||||
static BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) \
|
||||
call(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& obj) \
|
||||
{ \
|
||||
return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \
|
||||
} \
|
||||
}; \
|
||||
};
|
||||
|
||||
#endif
|
70
include/boost/fusion/adapted/class/detail/at_impl.hpp
Normal file
70
include/boost/fusion/adapted/class/detail/at_impl.hpp
Normal file
@ -0,0 +1,70 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_AT_IMPL_OCTOBER_4_2009_920PM)
|
||||
#define BOOST_FUSION_AT_IMPL_OCTOBER_4_2009_920PM
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct at_impl;
|
||||
|
||||
template <typename Class, int N>
|
||||
struct class_member;
|
||||
|
||||
template <typename Class>
|
||||
struct class_size;
|
||||
|
||||
template <>
|
||||
struct at_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct apply
|
||||
{
|
||||
static int const n_value = N::value;
|
||||
BOOST_MPL_ASSERT_RELATION(
|
||||
n_value, <=, extension::class_size<Sequence>::value);
|
||||
|
||||
typedef typename
|
||||
extension::class_member<Sequence, N::value>
|
||||
element;
|
||||
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_const<Sequence>
|
||||
, typename class_member<Sequence, N::value>::get_type
|
||||
, typename class_member<Sequence, N::value>::proxy
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return extension::
|
||||
class_member<Sequence, N::value>::call(seq);
|
||||
}
|
||||
|
||||
//~ static typename class_member<Sequence, N::value>::get_type
|
||||
//~ call(Sequence const& seq)
|
||||
//~ {
|
||||
//~ return extension::
|
||||
//~ class_member<Sequence, N::value>::call(seq);
|
||||
//~ }
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
54
include/boost/fusion/adapted/class/detail/at_key_impl.hpp
Normal file
54
include/boost/fusion/adapted/class/detail/at_key_impl.hpp
Normal file
@ -0,0 +1,54 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_AT_KEY_IMPL_OCTOBER_4_2009_920PM)
|
||||
#define BOOST_FUSION_AT_KEY_IMPL_OCTOBER_4_2009_920PM
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct at_key_impl;
|
||||
|
||||
template <typename Class, typename Key>
|
||||
struct class_assoc_member;
|
||||
|
||||
template <>
|
||||
struct at_key_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence, typename Key>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
extension::class_assoc_member<Sequence, Key>
|
||||
element;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_const<Sequence>
|
||||
, detail::cref_result<element>
|
||||
, detail::ref_result<element>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return extension::
|
||||
class_assoc_member<Sequence, Key>::call(seq);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
40
include/boost/fusion/adapted/class/detail/begin_impl.hpp
Normal file
40
include/boost/fusion/adapted/class/detail/begin_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_BEGIN_IMPL_OCTOBER_4_2009_920PM)
|
||||
#define BOOST_FUSION_BEGIN_IMPL_OCTOBER_4_2009_920PM
|
||||
|
||||
#include <boost/fusion/adapted/class/class_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef class_iterator<Sequence, 0> type;
|
||||
|
||||
static type
|
||||
call(Sequence& v)
|
||||
{
|
||||
return type(v);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,35 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_CATEGORY_OF_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/config/no_tr1/utility.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct category_of_impl;
|
||||
|
||||
template<>
|
||||
struct category_of_impl<class_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply
|
||||
{
|
||||
typedef random_access_traversal_tag type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
48
include/boost/fusion/adapted/class/detail/end_impl.hpp
Normal file
48
include/boost/fusion/adapted/class/detail/end_impl.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_END_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_END_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/fusion/adapted/class/class_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template <typename Class>
|
||||
struct class_size;
|
||||
|
||||
template <>
|
||||
struct end_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
class_iterator<
|
||||
Sequence
|
||||
, class_size<Sequence>::value
|
||||
>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Sequence& v)
|
||||
{
|
||||
return type(v);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
33
include/boost/fusion/adapted/class/detail/extension.hpp
Normal file
33
include/boost/fusion/adapted/class/detail/extension.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_CLASS_DETAIL_EXTENSION_HPP
|
||||
#define BOOST_FUSION_ADAPTED_CLASS_DETAIL_EXTENSION_HPP
|
||||
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, typename Dummy>
|
||||
struct get_identity
|
||||
: remove_const<typename remove_reference<T>::type>
|
||||
{};
|
||||
}
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename T, int N>
|
||||
struct class_member_proxy;
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
40
include/boost/fusion/adapted/class/detail/has_key_impl.hpp
Normal file
40
include/boost/fusion/adapted/class/detail/has_key_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_HAS_KEY_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_HAS_KEY_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
struct no_such_member;
|
||||
|
||||
template<typename T>
|
||||
struct has_key_impl;
|
||||
|
||||
template<typename Class, typename Key>
|
||||
struct class_assoc_member;
|
||||
|
||||
template<>
|
||||
struct has_key_impl<class_tag>
|
||||
{
|
||||
template<typename Sequence, typename Key>
|
||||
struct apply
|
||||
: mpl::not_<is_same<no_such_member, typename class_assoc_member<Sequence, Key>::type> >
|
||||
{
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,31 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_IS_SEQUENCE_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_IS_SEQUENCE_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_sequence_impl;
|
||||
|
||||
template<>
|
||||
struct is_sequence_impl<class_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply : mpl::true_ {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
32
include/boost/fusion/adapted/class/detail/is_view_impl.hpp
Normal file
32
include/boost/fusion/adapted/class/detail/is_view_impl.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_IS_VIEW_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_IS_VIEW_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_view_impl;
|
||||
|
||||
template<>
|
||||
struct is_view_impl<class_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply : mpl::false_
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
37
include/boost/fusion/adapted/class/detail/size_impl.hpp
Normal file
37
include/boost/fusion/adapted/class/detail/size_impl.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_SIZE_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_SIZE_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template <typename Class>
|
||||
struct class_size;
|
||||
}
|
||||
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct size_impl;
|
||||
|
||||
template <>
|
||||
struct size_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply : extension::class_size<Sequence> {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
47
include/boost/fusion/adapted/class/detail/value_at_impl.hpp
Normal file
47
include/boost/fusion/adapted/class/detail/value_at_impl.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_VALUE_AT_IMPL_OCTOBER_4_2009_918PM)
|
||||
#define BOOST_FUSION_VALUE_AT_IMPL_OCTOBER_4_2009_918PM
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct value_at_impl;
|
||||
|
||||
template <typename Class, int N>
|
||||
struct class_member;
|
||||
|
||||
template <typename Class>
|
||||
struct class_size;
|
||||
|
||||
template <>
|
||||
struct value_at_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct apply
|
||||
{
|
||||
static int const n_value = N::value;
|
||||
BOOST_MPL_ASSERT_RELATION(
|
||||
n_value, <=, extension::class_size<Sequence>::value);
|
||||
|
||||
typedef typename
|
||||
extension::class_member<Sequence, N::value>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,39 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_VALUE_AT_KEY_IMPL_OCTOBER_4_2009_918PM)
|
||||
#define BOOST_FUSION_VALUE_AT_KEY_IMPL_OCTOBER_4_2009_918PM
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct value_at_key_impl;
|
||||
|
||||
template <typename Class, typename Key>
|
||||
struct class_assoc_member;
|
||||
|
||||
template <>
|
||||
struct value_at_key_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence, typename Key>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
extension::class_assoc_member<Sequence, Key>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
68
include/boost/fusion/adapted/class/extension.hpp
Normal file
68
include/boost/fusion/adapted/class/extension.hpp
Normal file
@ -0,0 +1,68 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CLASS_EXTENSION_OCTOBER_4_2009_839PM)
|
||||
#define FUSION_CLASS_EXTENSION_OCTOBER_4_2009_839PM
|
||||
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename Class, int N>
|
||||
struct class_member;
|
||||
|
||||
template <typename Class>
|
||||
struct class_size;
|
||||
|
||||
template <typename Class, int N>
|
||||
struct class_member<Class const, N> : class_member<Class, N> {};
|
||||
//~ {
|
||||
//~ typedef typename class_member<Class, N>::type type;
|
||||
//~ typedef typename class_member<Class, N>::get_type get_type;
|
||||
//~ typedef typename class_member<Class, N>::proxy proxy;
|
||||
|
||||
//~ static get_type&
|
||||
//~ call(Class const& class_)
|
||||
//~ {
|
||||
//~ return class_member<Class, N>::call(
|
||||
//~ const_cast<Class&>(class_));
|
||||
//~ }
|
||||
//~ };
|
||||
|
||||
template <typename Class>
|
||||
struct class_size<Class const>
|
||||
: class_size<Class>
|
||||
{};
|
||||
|
||||
struct no_such_member;
|
||||
|
||||
template<typename Class, typename Key>
|
||||
struct class_assoc_member
|
||||
{
|
||||
typedef no_such_member type;
|
||||
};
|
||||
|
||||
template<typename Class, typename Key>
|
||||
struct class_assoc_member<Class const, Key>
|
||||
{
|
||||
typedef typename
|
||||
add_const<typename class_assoc_member<Class, Key>::type>::type
|
||||
type;
|
||||
|
||||
static type&
|
||||
call(Class const& class_)
|
||||
{
|
||||
return class_assoc_member<Class, Key>::call(
|
||||
const_cast<Class&>(class_));
|
||||
}
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user