forked from boostorg/fusion
Fusion: BOOST_FUSION_ADAPT_xxxCLASSxxx -> BOOST_FUSION_ADAPT_xxxADTxxx
[SVN r65439]
This commit is contained in:
135
include/boost/fusion/adapted/adt/detail/adapt_base.hpp
Normal file
135
include/boost/fusion/adapted/adt/detail/adapt_base.hpp
Normal file
@@ -0,0 +1,135 @@
|
||||
/*=============================================================================
|
||||
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_ADT_DETAIL_ADAPT_BASE_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ADT_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>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ADT_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_ADT_GET_IDENTITY_NON_TEMPLATE_IMPL( \
|
||||
TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
lvalue
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ADT_C_BASE( \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE) \
|
||||
\
|
||||
template< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
|
||||
> \
|
||||
struct access::adt_attribute_proxy< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
|
||||
, I \
|
||||
, true \
|
||||
> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) type; \
|
||||
\
|
||||
explicit \
|
||||
adt_attribute_proxy( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& o) \
|
||||
: obj(o) \
|
||||
{} \
|
||||
\
|
||||
operator type() const \
|
||||
{ \
|
||||
return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& obj; \
|
||||
\
|
||||
private: \
|
||||
adt_attribute_proxy& operator= (adt_attribute_proxy const&); \
|
||||
}; \
|
||||
\
|
||||
template< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
|
||||
> \
|
||||
struct access::adt_attribute_proxy< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
|
||||
, I \
|
||||
, false \
|
||||
> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) type; \
|
||||
\
|
||||
explicit \
|
||||
adt_attribute_proxy(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& o) \
|
||||
: obj(o) \
|
||||
{} \
|
||||
\
|
||||
template<class Arg> \
|
||||
adt_attribute_proxy& \
|
||||
operator=(Arg const& val) \
|
||||
{ \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 3, ATTRIBUTE); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
operator type() const \
|
||||
{ \
|
||||
return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj; \
|
||||
\
|
||||
private: \
|
||||
adt_attribute_proxy& operator= (adt_attribute_proxy const&); \
|
||||
}; \
|
||||
\
|
||||
template< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
|
||||
> \
|
||||
struct access::struct_member< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
|
||||
, I \
|
||||
> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) lvalue; \
|
||||
BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS( \
|
||||
TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
typedef \
|
||||
BOOST_PP_IF( \
|
||||
BOOST_PP_SEQ_HEAD(TEMPLATE_PARAMS_SEQ), \
|
||||
BOOST_FUSION_ADAPT_ADT_GET_IDENTITY_TEMPLATE_IMPL, \
|
||||
BOOST_FUSION_ADAPT_ADT_GET_IDENTITY_NON_TEMPLATE_IMPL)( \
|
||||
TEMPLATE_PARAMS_SEQ) \
|
||||
type; \
|
||||
\
|
||||
template<typename Seq> \
|
||||
struct apply \
|
||||
{ \
|
||||
typedef \
|
||||
access::adt_attribute_proxy< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
|
||||
, I \
|
||||
, is_const<Seq>::value \
|
||||
> \
|
||||
type; \
|
||||
\
|
||||
static type \
|
||||
call(Seq& obj) \
|
||||
{ \
|
||||
return type(obj); \
|
||||
} \
|
||||
}; \
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user