|
Boost-Commit : |
From: chochlik_at_[hidden]
Date: 2008-05-01 04:12:51
Author: matus.chochlik
Date: 2008-05-01 04:12:50 EDT (Thu, 01 May 2008)
New Revision: 44967
URL: http://svn.boost.org/trac/boost/changeset/44967
Log:
Moved the all_attributes implementation out of the meta_class to a separate template (placed in mirror/meta_attribs.cpp)
Added:
sandbox/mirror/boost/mirror/algorithm/
sandbox/mirror/boost/mirror/detail/meta_attribs_base.hpp
- copied unchanged from r44923, /sandbox/mirror/boost/mirror/meta_attribs_base.hpp
sandbox/mirror/boost/mirror/detail/meta_attribs_getset.hpp
- copied unchanged from r44923, /sandbox/mirror/boost/mirror/meta_attribs_getset.hpp
Removed:
sandbox/mirror/boost/mirror/meta_attribs_base.hpp
sandbox/mirror/boost/mirror/meta_attribs_getset.hpp
Text files modified:
sandbox/mirror/boost/char_type_switch/string.hpp | 5
sandbox/mirror/boost/mirror/meta_attributes.hpp | 462 +++++++++++++++++++++++++++++++++++++++
sandbox/mirror/boost/mirror/meta_class.hpp | 462 ---------------------------------------
sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml | 5
4 files changed, 472 insertions(+), 462 deletions(-)
Modified: sandbox/mirror/boost/char_type_switch/string.hpp
==============================================================================
--- sandbox/mirror/boost/char_type_switch/string.hpp (original)
+++ sandbox/mirror/boost/char_type_switch/string.hpp 2008-05-01 04:12:50 EDT (Thu, 01 May 2008)
@@ -11,6 +11,7 @@
#define BOOST_CHAR_WIDTH_SWITCH_STRING
#include <boost/char_type_switch/choice.hpp>
+#include <boost/config.hpp>
// Needed for ::std::string / ::std::wstring
#include <string>
//
@@ -51,7 +52,7 @@
// disable the deprecated function warning on msvc
// this warning is issued when not using the "safe"
// versions of string functions like strcpy_s (vs. strcpy)
-#ifdef _MSC_VER
+#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4996)
#endif
@@ -103,7 +104,7 @@
}
// enable the deprecated function warnings on msvc
-#ifdef _MSC_VER
+#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
Deleted: sandbox/mirror/boost/mirror/meta_attribs_base.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_attribs_base.hpp 2008-05-01 04:12:50 EDT (Thu, 01 May 2008)
+++ (empty file)
@@ -1,294 +0,0 @@
-/**
- * \file boost/mirror/meta_attribs_simple.hpp
- * Registering and reflection of simple class attributes
- *
- * Copyright 2008 Matus Chochlik. 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_MIRROR_META_ATTRIBS_SIMPLE_HPP
-#define BOOST_MIRROR_META_ATTRIBS_SIMPLE_HPP
-
-// mirror common definitions
-#include <boost/mirror/common_defs.hpp>
-// forward declarations
-#include <boost/mirror/meta_data_fwd.hpp>
-//
-#include <boost/preprocessor/repetition/enum_params.hpp>
-//
-// necessary type traits
-#include <boost/call_traits.hpp>
-
-namespace boost {
-namespace mirror {
-
-/** Forward declaration of the meta_class_attributes<> template
- */
-template <class the_class, class variant_tag = detail::default_meta_class_variant>
-struct meta_class_attributes;
-
-namespace detail {
-
-/** Implementation of the for_each function on meta_attributes
- */
-template <class meta_class, class meta_attributes>
-struct meta_class_attrib_for_each
-{
-protected:
- template <class meta_attrib_op, int I>
- static void do_apply_to(meta_attrib_op op, mpl::int_<I> pos)
- {
- typedef typename meta_attributes::type_list type_list;
- typedef typename mpl::at<type_list, mpl::int_<I> >::type attrib_type;
- meta_class mc;
- meta_attributes ma;
- op(mc, ma, pos, (attrib_type*)0);
- }
-
- template <class meta_attrib_op>
- static void apply_to(meta_attrib_op op, mpl::int_< -1 > pos){ }
-
- template <class meta_attrib_op>
- static void apply_to(meta_attrib_op op, mpl::int_<0> pos)
- {
- do_apply_to(op, pos);
- }
-
- template <class meta_attrib_op, int I>
- static void apply_to(meta_attrib_op op, mpl::int_<I> pos)
- {
- apply_to(op, mpl::int_<I - 1>()),
- do_apply_to(op, pos);
- }
-public:
-
- /** Performs op((meta_class*)0, mpl::int_<I>, 'type-of-I-th'*0
- */
- template <class meta_attrib_op>
- static meta_attrib_op for_each(meta_attrib_op op)
- {
- typedef typename meta_attributes::type_list type_list;
- typedef mpl::int_<mpl::size<type_list>::value - 1> last;
- apply_to(op, last());
- return op;
- }
-};
-
-/** This template ties together several function implementations
- * for the specializations of the meta_class_attributes<>
- * template.
- */
-template <class meta_class, class meta_attribs>
-struct meta_class_attrib_utils
-: meta_class_attrib_for_each<meta_class, meta_attribs>
-{ };
-
-} // namespace detail
-
-/** Defaut (empty) list of base attributes of a meta class
- */
-template <class the_class, class variant_tag>
-struct meta_class_attributes
-: public detail::meta_class_attrib_utils<
- meta_class<the_class, variant_tag>,
- meta_class_attributes<the_class, variant_tag>
->
-{
- typedef mpl::vector<> type_list;
-};
-
-/** This macro starts the declaration of member attributes
- * of the given class
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(THE_CLASS) \
- template <> struct meta_class_attributes< THE_CLASS , detail::default_meta_class_variant> \
- : public detail::meta_class_attrib_utils<\
- meta_class<THE_CLASS, detail::default_meta_class_variant>, \
- meta_class_attributes<THE_CLASS, detail::default_meta_class_variant> \
- >\
- { \
- typedef THE_CLASS the_class; \
- typedef mpl::vector<>
-
-/** This macro starts the declaration of member attributes
- * of the given template
- */
-#define BOOST_MIRROR_REG_TEMPLATE_ATTRIBS_BEGIN(THE_TEMPLATE, TEMPL_ARG_COUNT) \
- template < BOOST_PP_ENUM_PARAMS(TEMPL_ARG_COUNT, typename T) > \
- struct meta_class_attributes< \
- THE_TEMPLATE < BOOST_PP_ENUM_PARAMS(TEMPL_ARG_COUNT, T) >, \
- detail::default_meta_class_variant \
- > \
- : public detail::meta_class_attrib_utils<\
- meta_class< \
- THE_TEMPLATE < BOOST_PP_ENUM_PARAMS(TEMPL_ARG_COUNT, T) >, \
- detail::default_meta_class_variant \
- >, \
- meta_class_attributes< \
- THE_TEMPLATE < BOOST_PP_ENUM_PARAMS(TEMPL_ARG_COUNT, T) >, \
- detail::default_meta_class_variant \
- > \
- >\
- { \
- typedef THE_TEMPLATE < BOOST_PP_ENUM_PARAMS(TEMPL_ARG_COUNT, T) > \
- the_class; \
- typedef typename mpl::vector<>
-
-
-/** This is a helper for the BOOST_MIRROR_CLASS_ATTRIB*
- * macros.
- * It declares all common things that need to be declared
- * before the specific stuff.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE, NAME) \
- _partial_list_##NUMBER;\
- static const bchar* base_name(mpl::int_<NUMBER>){return BOOST_STR_LIT(#NAME);}\
-
-/** This is a helper for the BOOST_MIRROR_CLASS_ATTRIB*
- * macros.
- * It declares all common things that need to be declared
- * after the specific stuff.
- */
-#define BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_EPILOGUE(NUMBER, TYPE, NAME, TYPENAME_KW) \
- typedef TYPENAME_KW mpl::push_back<_partial_list_##NUMBER, TYPE>::type
-
-
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_EPILOGUE(NUMBER, TYPE, NAME, BOOST_PP_EMPTY())
-
-#define BOOST_MIRROR_REG_TEMPLATE_ATTRIB_EPILOGUE(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_EPILOGUE(NUMBER, TYPE, NAME, typename)
-
-
-/** This is a helper for the BOOST_MIRROR_CLASS_ATTRIB*_TD
- * macros.
- * It declares all common things that need to be declared
- * after the specific stuff.
- */
-#define BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_EPILOGUE_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, NAME, TYPENAME_KW) \
- typedef TYPENAME_KW mpl::push_back<\
- _partial_list_##NUMBER, \
- BOOST_MIRROR_TYPEDEFD_SELECTOR(TYPE_NS_ALIAS##_##TYPE, TYPE_NAMESPACE::TYPE)\
- >::type
-
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_EPILOGUE_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, NAME, BOOST_PP_EMPTY())
-
-#define BOOST_MIRROR_REG_TEMPLATE_ATTRIB_EPILOGUE_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_EPILOGUE_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, NAME, typename)
-
-/** Helper macro for implementing simple attrib value getting
- * querying scheme
- */
-#define BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_DECL_SIMPLE_GET(NUMBER, TYPE, NAME, TYPENAME_KW) \
- static TYPENAME_KW call_traits<TYPE>::param_type get(const the_class& context, mpl::int_<NUMBER>)\
- {\
- return context.NAME;\
- }\
- template <typename dest_type>\
- static dest_type& query(const the_class& context, mpl::int_<NUMBER>, dest_type& dest)\
- {\
- dest = dest_type(context.NAME);\
- return dest;\
- }
-
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SIMPLE_GET(NUMBER, TYPE, NAME)\
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_DECL_SIMPLE_GET(NUMBER, TYPE, NAME, BOOST_PP_EMPTY())
-
-#define BOOST_MIRROR_REG_TEMPLATE_ATTRIB_DECL_SIMPLE_GET(NUMBER, TYPE, NAME)\
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_DECL_SIMPLE_GET(NUMBER, TYPE, NAME, typename)
-
-
-/** Helper macro for implementing no-op query meta-class function
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_NO_GETTER(NUMBER, TYPE) \
- static void get(const the_class& context, mpl::int_<NUMBER>){ }\
- template <typename dest_type>\
- static void query(const the_class& context, mpl::int_<NUMBER>, dest_type& dest){ }
-
-#define BOOST_MIRROR_REG_TEMPLATE_ATTRIB_DECL_NO_GETTER(NUMBER, TYPE) \
-
-
-/** Helper macros
- */
-#define BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_DECL_SIMPLE_SET(NUMBER, TYPE, NAME, TYPENAME_KW) \
- static void set(the_class& context, mpl::int_<NUMBER>, TYPENAME_KW call_traits<TYPE>::param_type val)\
- {\
- context.NAME = val;\
- } \
- static void set(const the_class& context, mpl::int_<NUMBER>, TYPENAME_KW call_traits<TYPE>::param_type val)\
- {\
- }
-
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SIMPLE_SET(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_DECL_SIMPLE_SET(NUMBER, TYPE, NAME, BOOST_PP_EMPTY())
-
-#define BOOST_MIRROR_REG_TEMPLATE_ATTRIB_DECL_SIMPLE_SET(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_DECL_SIMPLE_SET(NUMBER, TYPE, NAME, typename)
-
-
-/** Helper macro for implementing no-op set meta-class function
- */
-#define BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_DECL_NO_SETTER(NUMBER, TYPE, TYPENAME_KW) \
- static void set(the_class& context, mpl::int_<NUMBER>, call_traits<TYPE>::param_type val){ }\
- static void set(const the_class& context, mpl::int_<NUMBER>, call_traits<TYPE>::param_type val){ }
-
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_NO_SETTER(NUMBER, TYPE) \
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_DECL_NO_SETTER(NUMBER, TYPE, BOOST_PP_EMPTY())
-
-#define BOOST_MIRROR_REG_TEMPLATE_ATTRIB_DECL_NO_SETTER(NUMBER, TYPE) \
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_ATTRIB_DECL_NO_SETTER(NUMBER, TYPE, typename)
-
-/** This macro declares the meta-data for a single class' attribute
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SIMPLE_GET(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SIMPLE_SET(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE(NUMBER, TYPE, NAME)
-
-/** This macro declares the meta-data for a single templates attribute
- */
-#define BOOST_MIRROR_REG_TEMPLATE_ATTRIB(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_TEMPLATE_ATTRIB_DECL_SIMPLE_GET(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_TEMPLATE_ATTRIB_DECL_SIMPLE_SET(NUMBER, TYPE, NAME) \
- BOOST_MIRROR_REG_TEMPLATE_ATTRIB_EPILOGUE(NUMBER, TYPE, NAME)
-
-/** This macro declares the meta-data for a single class' typedefd attribute
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE_NAMESPACE::TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SIMPLE_GET(NUMBER, TYPE_NAMESPACE::TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SIMPLE_SET(NUMBER, TYPE_NAMESPACE::TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, NAME)
-
-/** This macro declares the meta-data for a single templates typedefd attribute
- */
-#define BOOST_MIRROR_REG_TEMPLATE_ATTRIB_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE_NAMESPACE::TYPE, NAME) \
- BOOST_MIRROR_REG_TEMPLATE_ATTRIB_DECL_SIMPLE_GET(NUMBER, TYPE_NAMESPACE::TYPE, NAME) \
- BOOST_MIRROR_REG_TEMPLATE_ATTRIB_DECL_SIMPLE_SET(NUMBER, TYPE_NAMESPACE::TYPE, NAME) \
- BOOST_MIRROR_REG_TEMPLATE_ATTRIB_EPILOGUE_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, NAME)
-
-/** This macro finishes the declaration of attributes
- * of the given class
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIBS_END \
- type_list; \
- struct size : public mpl::size<type_list>{ };\
- };
-
-/** This macro finishes the declaration of attributes
- * of the given template
- */
-#define BOOST_MIRROR_REG_TEMPLATE_ATTRIBS_END \
- BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-
Deleted: sandbox/mirror/boost/mirror/meta_attribs_getset.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_attribs_getset.hpp 2008-05-01 04:12:50 EDT (Thu, 01 May 2008)
+++ (empty file)
@@ -1,282 +0,0 @@
-/**
- * \file boost/mirror/meta_attributes.hpp
- * Mscros for declaring meta attributes accessed through getters/setters
- *
- * Copyright 2008 Matus Chochlik. 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_MIRROR_META_ATTRIBS_GETSET_HPP
-#define BOOST_MIRROR_META_ATTRIBS_GETSET_HPP
-
-// macros for declaration of simple meta attributes
-#include <boost/mirror/meta_attribs_base.hpp>
-//
-// necessary preprocessor macros
-#include <boost/preprocessor/tuple/to_list.hpp>
-#include <boost/preprocessor/list/enum.hpp>
-//
-// various other things from boost to get this going
-#include <boost/function_types/property_tags.hpp>
-#include <boost/function_types/is_member_function_pointer.hpp>
-#include <boost/typeof/typeof.hpp>
-
-
-
-namespace boost {
-namespace mirror {
-
-/** Helper macro for implementing getter based query meta-class function
- *
- * TODO: This is a rather unfortunate implementation ...
- * It would be great is we could get rid of the do_* helpers.
- * Anyway there should be two overloads of get and two for query
- * one having 'const the_class&' and the other 'the_class&' as the first param
- * if the provided getter IS const qualified.
- * Otherwise, if the getter IS NOT const qualified there should be only one
- * version of get and one version of query, both having a 'the_class&'
- * as the first argument.
- *
- * Now, both overloads get always compiled, but if the one with const the_class&
- * gets never used it is (hopefully) culled out of the final binary.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_GETTER_ARGS(NUMBER, TYPE, GETTER_NAME, GETTER_ARGS_TUPLE, ARG_COUNT) \
- static call_traits<TYPE>::param_type do_get(the_class& context, mpl::int_<NUMBER>, mpl::bool_<true>)\
- {\
- return context.GETTER_NAME(BOOST_PP_LIST_ENUM(BOOST_PP_TUPLE_TO_LIST(ARG_COUNT, GETTER_ARGS_TUPLE)));\
- } \
- static call_traits<TYPE>::param_type do_get(const the_class& context, mpl::int_<NUMBER>, mpl::bool_<function_types::is_member_function_pointer<BOOST_TYPEOF(&the_class::GETTER_NAME), function_types::const_qualified>::value>)\
- {\
- return const_cast<the_class&>(context).GETTER_NAME(BOOST_PP_LIST_ENUM(BOOST_PP_TUPLE_TO_LIST(ARG_COUNT, GETTER_ARGS_TUPLE)));\
- } \
- template <typename dest_type>\
- static dest_type& do_query(the_class& context, mpl::int_<NUMBER>, dest_type& dest, mpl::bool_<true>)\
- {\
- dest = dest_type(context.GETTER_NAME(BOOST_PP_LIST_ENUM(BOOST_PP_TUPLE_TO_LIST(ARG_COUNT, GETTER_ARGS_TUPLE))));\
- return dest;\
- } \
- template <typename dest_type>\
- static dest_type& do_query(const the_class& context, mpl::int_<NUMBER>, dest_type& dest, mpl::bool_<function_types::is_member_function_pointer<BOOST_TYPEOF(&the_class::GETTER_NAME), function_types::const_qualified>::value>)\
- {\
- dest = dest_type(const_cast<the_class&>(context).GETTER_NAME(BOOST_PP_LIST_ENUM(BOOST_PP_TUPLE_TO_LIST(ARG_COUNT, GETTER_ARGS_TUPLE))));\
- return dest;\
- } \
- template <class a_class> static call_traits<TYPE>::param_type get(a_class& context, mpl::int_<NUMBER>)\
- {\
- return do_get(context, mpl::int_<NUMBER>(), mpl::bool_<true>());\
- }\
- template <class a_class, typename dest_type> \
- static dest_type& query(a_class& context, mpl::int_<NUMBER>, dest_type& dest)\
- {\
- return do_query(context, mpl::int_<NUMBER>(), dest, mpl::bool_<true>());\
- }
-
-
-#define BOOST_MIRROR_SETTER_SRC val
-
-/** Helper macro for implementing setter based set meta-class function
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SETTER_ARGS(NUMBER, TYPE, SETTER_NAME, SETTER_ARGS_TUPLE, ARG_COUNT) \
- static void set(the_class& context, mpl::int_<NUMBER>, call_traits<TYPE>::param_type val)\
- {\
- context.SETTER_NAME(BOOST_PP_LIST_ENUM(BOOST_PP_TUPLE_TO_LIST(ARG_COUNT, SETTER_ARGS_TUPLE)));\
- }
-
-
-/** This macro declares a single class' query-only attribute with a getter
- * member function.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS_ONLY(NUMBER, TYPE, ATTRIB_NAME, GETTER_NAME, GETTER_ARGS_TUPLE, ARG_COUNT) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE, ATTRIB_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_GETTER_ARGS(NUMBER, TYPE, GETTER_NAME, GETTER_ARGS_TUPLE, ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_NO_SETTER(NUMBER, TYPE)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE(NUMBER, TYPE, ATTRIB_NAME)
-
-/** Simpler version of the BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS
- * for getter functions with no bound arguments
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_ONLY(NUMBER, TYPE, ATTRIB_NAME, GETTER_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS_ONLY(NUMBER, TYPE, ATTRIB_NAME, GETTER_NAME, (), 0)
-
-
-/** This macro declares a single class' query-only attribute with a getter
- * member function. Version for typedef'd types.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS_ONLY_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, GETTER_NAME, GETTER_ARGS_TUPLE, ARG_COUNT) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE_NAMESPACE::TYPE, ATTRIB_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_GETTER_ARGS(NUMBER, TYPE_NAMESPACE::TYPE, GETTER_NAME, GETTER_ARGS_TUPLE, ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_NO_SETTER(NUMBER, TYPE_NAMESPACE::TYPE)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME)
-
-/** Simpler version of the BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS
- * for getter functions with no bound arguments
- * Version for typedef'd types.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_ONLY_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, GETTER_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS_ONLY_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, GETTER_NAME, (), 0)
-
-
-
-/** This macro declares a single class' getter-query-simple-set attribute with a getter
- * member function and a simple value setting scheme.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS(NUMBER, TYPE, ATTRIB_NAME, GETTER_NAME, GETTER_ARGS_TUPLE, ARG_COUNT) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE, ATTRIB_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_GETTER_ARGS(NUMBER, TYPE, GETTER_NAME, GETTER_ARGS_TUPLE, ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SIMPLE_SET(NUMBER, TYPE, ATTRIB_NAME)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE(NUMBER, TYPE, ATTRIB_NAME)
-
-/** Simpler version of the BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS
- * for getter functions with no bound arguments
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER(NUMBER, TYPE, ATTRIB_NAME, GETTER_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS(NUMBER, TYPE, ATTRIB_NAME, GETTER_NAME, (), 0)
-
-
-/** This macro declares a single class' getter-query-simple-set attribute with a getter
- * member function and a simple value setting scheme.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, GETTER_NAME, GETTER_ARGS_TUPLE, ARG_COUNT) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE_NAMESPACE::TYPE, ATTRIB_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_GETTER_ARGS(NUMBER, TYPE_NAMESPACE::TYPE, GETTER_NAME, GETTER_ARGS_TUPLE, ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SIMPLE_SET(NUMBER, TYPE_NAMESPACE::TYPE, ATTRIB_NAME)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME)
-
-/** Simpler version of the BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS
- * for getter functions with no bound arguments.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_TD(NUMBER, TYPE, TYPE_NS_ALIAS, TYPE_NAMESPACE, ATTRIB_NAME, GETTER_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_W_ARGS_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, GETTER_NAME, (), 0)
-
-
-/** This macro declares a single class' set-only attribute with a setter
- * member function.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS_ONLY(NUMBER, TYPE, ATTRIB_NAME, SETTER_NAME, SETTER_ARGS_TUPLE, ARG_COUNT) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE, ATTRIB_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_NO_GETTER(NUMBER, TYPE)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SETTER_ARGS(NUMBER, TYPE, SETTER_NAME, SETTER_ARGS_TUPLE, ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE(NUMBER, TYPE, ATTRIB_NAME)
-
-/** Simpler version of the BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS
- * for getter functions with no bound arguments
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_ONLY(NUMBER, TYPE, ATTRIB_NAME, SETTER_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS_ONLY(NUMBER, TYPE, ATTRIB_NAME, SETTER_NAME, (BOOST_MIRROR_SETTER_SRC), 1)
-
-
-/** This macro declares a single class' set-only attribute with a setter
- * member function. Version for typedef'd types.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS_ONLY_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, SETTER_NAME, SETTER_ARGS_TUPLE, ARG_COUNT) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE_NAMESPACE::TYPE, ATTRIB_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_NO_GETTER(NUMBER, TYPE_NAMESPACE::TYPE)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SETTER_ARGS(NUMBER, TYPE_NAMESPACE::TYPE, SETTER_NAME, SETTER_ARGS_TUPLE, ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME)
-
-/** Simpler version of the BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS
- * for getter functions with no bound arguments.
- * Version for typedef'd types.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_ONLY_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, SETTER_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS_ONLY_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, SETTER_NAME, (BOOST_MIRROR_SETTER_SRC), 1)
-
-
-/** This macro declares a single class' simple-get-setter-set attribute with a setter
- * member function and simple value getting scheme.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS(NUMBER, TYPE, ATTRIB_NAME, SETTER_NAME, SETTER_ARGS_TUPLE, ARG_COUNT) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE, ATTRIB_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SIMPLE_GET(NUMBER, TYPE, ATTRIB_NAME)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SETTER_ARGS(NUMBER, TYPE, SETTER_NAME, SETTER_ARGS_TUPLE, ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE(NUMBER, TYPE, ATTRIB_NAME)
-
-/** Simpler version of the BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS
- * for setter functions with no bound arguments besides the value to be set
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER(NUMBER, TYPE, ATTRIB_NAME, SETTER_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS(NUMBER, TYPE, ATTRIB_NAME, SETTER_NAME, (BOOST_MIRROR_SETTER_SRC), 1)
-
-/** This macro declares a single class' simple-get-setter-set attribute with a setter
- * member function and simple value getting scheme.
- * Version for typedef'd types.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, SETTER_NAME, SETTER_ARGS_TUPLE, ARG_COUNT) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE_NAMESPACE::TYPE, ATTRIB_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SIMPLE_GET(NUMBER, TYPE_NAMESPACE::TYPE, ATTRIB_NAME)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SETTER_ARGS(NUMBER, TYPE_NAMESPACE::TYPE, SETTER_NAME, SETTER_ARGS_TUPLE, ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME)
-
-/** Simpler version of the BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS
- * for setter functions with no bound arguments besides the value to be set.
- * Version for typedef'd types.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, SETTER_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_W_ARGS_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, SETTER_NAME, (BOOST_MIRROR_SETTER_SRC), 1)
-
-
-/** This macro declares a single class' simple-get-setter-set attribute with a setter
- * member function and simple value getting scheme.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER_W_ARGS(\
- NUMBER, \
- TYPE, \
- ATTRIB_NAME, \
- GETTER_NAME, \
- GETTER_ARGS_TUPLE, \
- GETTER_ARG_COUNT, \
- SETTER_NAME, \
- SETTER_ARGS_TUPLE, \
- SETTER_ARG_COUNT\
-) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE, ATTRIB_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_GETTER_ARGS(NUMBER, TYPE, GETTER_NAME, GETTER_ARGS_TUPLE, GETTER_ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SETTER_ARGS(NUMBER, TYPE, SETTER_NAME, SETTER_ARGS_TUPLE, SETTER_ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE(NUMBER, TYPE, ATTRIB_NAME)
-
-/** Simpler version of the BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER_W_ARGS
- * for getter and setter functions with no bound arguments
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER(NUMBER, TYPE, ATTRIB_NAME, GETTER_NAME, SETTER_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER_W_ARGS(\
- NUMBER, TYPE, ATTRIB_NAME, \
- GETTER_NAME, (), 0, \
- SETTER_NAME, (BOOST_MIRROR_SETTER_SRC), 1\
- )
-
-/** This macro declares a single class' simple-get-setter-set attribute with a setter
- * member function and simple value getting scheme.
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER_W_ARGS_TD(\
- NUMBER, \
- TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, \
- ATTRIB_NAME, \
- GETTER_NAME, \
- GETTER_ARGS_TUPLE, \
- GETTER_ARG_COUNT, \
- SETTER_NAME, \
- SETTER_ARGS_TUPLE, \
- SETTER_ARG_COUNT\
-) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_PROLOGUE(NUMBER, TYPE_NAMESPACE::TYPE, ATTRIB_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_GETTER_ARGS(NUMBER, TYPE_NAMESPACE::TYPE, GETTER_NAME, GETTER_ARGS_TUPLE, GETTER_ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_DECL_SETTER_ARGS(NUMBER, TYPE_NAMESPACE::TYPE, SETTER_NAME, SETTER_ARGS_TUPLE, SETTER_ARG_COUNT)\
- BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME)
-
-/** Simpler version of the BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER_W_ARGS_TD
- * for getter and setter functions with no bound arguments
- */
-#define BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER_TD(NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, GETTER_NAME, SETTER_NAME) \
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER_W_ARGS(\
- NUMBER, TYPE_NS_ALIAS, TYPE_NAMESPACE, TYPE, ATTRIB_NAME, \
- GETTER_NAME, (), 0, \
- SETTER_NAME, (BOOST_MIRROR_SETTER_SRC), 1\
- )
-
-
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-
Modified: sandbox/mirror/boost/mirror/meta_attributes.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_attributes.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_attributes.hpp 2008-05-01 04:12:50 EDT (Thu, 01 May 2008)
@@ -11,13 +11,471 @@
#define BOOST_MIRROR_META_ATTRIBUTES_HPP
// macros for declaration of simple meta attributes
-#include <boost/mirror/meta_attribs_base.hpp>
+#include <boost/mirror/detail/meta_attribs_base.hpp>
// macros for declaration of meta attributes accessed through getters/setters
-#include <boost/mirror/meta_attribs_getset.hpp>
+#include <boost/mirror/detail/meta_attribs_getset.hpp>
namespace boost {
namespace mirror {
+ /** This is basically the same as the "attributes" structure
+ * but allows to work with all member attributes including
+ * the inherited ones.
+ */
+ template <class meta_class>
+ struct meta_class_all_attributes
+ : detail::meta_class_attrib_utils<meta_class, meta_class_all_attributes<meta_class> >
+ {
+ /** This struct "hides" the internal helpers
+ */
+ struct detail
+ {
+ /** The list of non-virtual base classes in the same
+ * order as they were registered.
+ */
+ typedef typename mpl::remove_if<
+ typename meta_class::base_classes::list,
+ mpl::lambda<
+ reflects_virtual_inheritance<mpl::_1>
+ >::type
+ >::type list_of_regular_base_classes;
+
+ /** The list of directly inhertied virtual base classes.
+ */
+ typedef typename mpl::remove_if<
+ typename meta_class::base_classes::list,
+ mpl::lambda<
+ mpl::not_<reflects_virtual_inheritance<mpl::_1> >
+ >::type
+ >::type list_of_virtual_base_classes;
+
+ /** This template gets the regular_base_class_layout
+ * of a base class when given a meta_inheritance
+ * specialization for this base class.
+ */
+ template <class meta_inheritance>
+ struct get_base_class_regular_layout
+ {
+ typedef typename
+ meta_inheritance::
+ meta_class::
+ all_attributes::
+ detail::
+ regular_base_class_layout type;
+ };
+
+ /** The layout of non-virtual base classes
+ * of this class, stored as a mpl::vector
+ * of meta_inheritances.
+ */
+ typedef typename mpl::accumulate<
+ list_of_regular_base_classes,
+ mpl::vector0<>,
+ mpl::push_back<
+ mpl::insert_range<
+ mpl::_1,
+ mpl::end<mpl::_1>,
+ get_base_class_regular_layout<
+ mpl::_2
+ >
+ >,
+ mpl::_2
+ >
+ >::type regular_base_class_layout;
+
+ /** This template gets the virtual_base_class_layout
+ * of a base class when given a meta_inheritance
+ * specialization for this base class.
+ */
+ template <class meta_inheritance>
+ struct get_base_class_virtual_layout
+ {
+ typedef typename
+ meta_inheritance::
+ meta_class::
+ all_attributes::
+ detail::
+ virtual_base_class_layout type;
+ };
+
+ /** This template gets the base_class_layout
+ * of a base class when given a meta_inheritance
+ * specialization for this base class.
+ */
+ template <class meta_inheritance>
+ struct get_base_class_layout
+ {
+ typedef typename
+ meta_inheritance::
+ meta_class::
+ all_attributes::
+ detail::
+ base_class_layout type;
+ };
+
+ /** The list of vitual base classes of this class.
+ * This list still contains dupplicates, that are
+ * removed to form virtual_base_class_layout
+ */
+ typedef typename mpl::accumulate<
+ typename meta_class::base_classes::list,
+ mpl::vector0<>,
+ mpl::if_<
+ reflects_virtual_inheritance<
+ mpl::_2
+ >,
+ mpl::push_back<
+ mpl::insert_range<
+ mpl::_1,
+ mpl::end<mpl::_1>,
+ get_base_class_layout<
+ mpl::_2
+ >
+ >,
+ mpl::_2
+ >,
+ mpl::insert_range<
+ mpl::_1,
+ mpl::end<mpl::_1>,
+ get_base_class_virtual_layout<
+ mpl::_2
+ >
+ >
+ >
+ >::type virtual_base_class_layout_w_dups;
+
+ /** The layout of virtual base classes
+ * of this class, stored as a mpl::vector
+ * of meta_inheritances.
+ */
+ typedef typename mpl::fold<
+ virtual_base_class_layout_w_dups,
+ mpl::vector0<>,
+ mpl::if_<
+ mpl::contains<
+ mpl::_1,
+ mpl::_2
+ >,
+ mpl::_1,
+ mpl::push_back<
+ mpl::_1,
+ mpl::_2
+ >
+ >
+ >::type virtual_base_class_layout;
+
+ /** This template gets the list of member
+ * attrbute types of a base class when
+ * given a meta_inheritance<> specialization
+ */
+ template <class meta_inheritance>
+ struct get_base_class_attrib_type_list
+ {
+ typedef typename meta_inheritance::
+ meta_class::
+ attributes::
+ type_list type;
+ };
+
+ typedef typename mpl::joint_view<
+ virtual_base_class_layout,
+ regular_base_class_layout
+ >::type base_class_layout;
+
+ /** The list of inherited member attributes
+ * of the reflected class.
+ * NOTE: this implementation puts the
+ * members of the virtual bases before
+ * the other members.
+ */
+ typedef typename mpl::accumulate<
+ base_class_layout,
+ mpl::vector0<>,
+ mpl::insert_range<
+ mpl::_1,
+ mpl::end<mpl::_1>,
+ get_base_class_attrib_type_list<
+ mpl::_2
+ >
+ >
+ >::type inherited_member_attrib_type_list;
+
+ /** The list of types of all attributes including
+ * the inherited ones.
+ */
+ typedef typename mpl::joint_view<
+ typename detail::inherited_member_attrib_type_list,
+ typename meta_class::attributes::type_list
+ >::type member_attrib_type_list;
+
+
+ /** This template gets the list of the owner classes
+ * for the inherited attributes.
+ */
+ template <class current_list, class meta_inheritance>
+ struct get_base_class_attrib_owner_and_offs
+ {
+ typedef typename meta_inheritance::
+ meta_class base_meta_class;
+
+ typedef typename base_meta_class::
+ attributes::
+ type_list type_list;
+
+ typedef typename mpl::size<
+ current_list
+ >::type offset;
+ typedef typename mpl::pair<
+ base_meta_class,
+ offset
+ > pair;
+
+ template<typename T>
+ struct get_pair
+ {
+ typedef pair type;
+ };
+
+ typedef typename mpl::accumulate<
+ type_list,
+ current_list,
+ mpl::push_back<
+ mpl::_1,
+ get_pair<mpl::_>
+ >
+ >::type type;
+ };
+
+ /** This is a list that contains a pair of owner meta_class
+ * and the index offset for every inherited attribute.
+ */
+ typedef typename mpl::accumulate<
+ base_class_layout,
+ mpl::vector0<>,
+ get_base_class_attrib_owner_and_offs<
+ mpl::_1,
+ mpl::_2
+ >
+ >::type inherited_attrib_owners_and_offsets;
+
+ /** This template is used to query the return value
+ * type of the getter for the I-th member attribute
+ */
+ template <int I>
+ struct result_of_get
+ {
+ typedef typename mpl::at<
+ member_attrib_type_list,
+ mpl::int_<I>
+ >::type type;
+ };
+
+ template <int I>
+ struct inherited_attrib_meta_class_and_pos
+ {
+ typedef typename mpl::at<
+ typename detail::inherited_attrib_owners_and_offsets,
+ mpl::int_<I>
+ >::type owner_and_offset;
+
+ typedef typename owner_and_offset::first meta_class;
+ typedef typename mpl::int_<mpl::minus<
+ mpl::int_<I>,
+ typename owner_and_offset::second
+ >::value> position;
+ };
+
+ template <int I>
+ struct own_attrib_meta_class_and_pos
+ {
+ typedef typename mpl::int_<mpl::minus<
+ mpl::int_<I>,
+ typename mpl::size<inherited_member_attrib_type_list>::type
+ >::value> position;
+ };
+
+ /** This function is used to get the names of the member
+ * attributes from the base classes.
+ */
+ template <int I>
+ static const bchar*
+ base_name(mpl::int_<I> pos, mpl::bool_<true>)
+ {
+ typedef typename inherited_attrib_meta_class_and_pos<I>
+ ::meta_class meta_class;
+ typedef typename inherited_attrib_meta_class_and_pos<I>
+ ::position new_pos_type;
+
+ return meta_class::attributes::base_name(new_pos_type());
+ }
+
+ template <int I>
+ static const bchar*
+ base_name(mpl::int_<I> pos, mpl::bool_<false>)
+ {
+ typedef typename own_attrib_meta_class_and_pos<I>
+ ::position new_pos_type;
+
+ return meta_class::attributes::base_name(new_pos_type());
+ }
+
+
+ /** This function is used to get the member attributes
+ * from the base classes.
+ */
+ template <class a_class, int I>
+ static typename result_of_get<I>::type
+ get(a_class context, mpl::int_<I> pos, mpl::bool_<true>)
+ {
+ typedef typename inherited_attrib_meta_class_and_pos<I>
+ ::meta_class meta_class;
+ typedef typename inherited_attrib_meta_class_and_pos<I>
+ ::position new_pos_type;
+
+ return meta_class::attributes::get(context, new_pos_type());
+
+ }
+ template <class a_class, int I>
+ static typename result_of_get<I>::type
+ get(a_class context, mpl::int_<I> pos, mpl::bool_<false>)
+ {
+ typedef typename own_attrib_meta_class_and_pos<I>
+ ::position new_pos_type;
+ return meta_class::attributes::get(context, new_pos_type());
+ }
+
+
+ /** This function is used to query the member attributes
+ * from the base classes.
+ */
+ template <class a_class, int I, typename dest_type>
+ static dest_type&
+ query(a_class context, mpl::int_<I> pos, dest_type& dest, mpl::bool_<true>)
+ {
+ typedef typename inherited_attrib_meta_class_and_pos<I>
+ ::meta_class meta_class;
+ typedef typename inherited_attrib_meta_class_and_pos<I>
+ ::position new_pos_type;
+
+ return meta_class::attributes::query(context, new_pos_type(), dest);
+
+ }
+
+ template <class a_class, int I, typename dest_type>
+ static dest_type&
+ query(a_class context, mpl::int_<I> pos, dest_type& dest, mpl::bool_<false>)
+ {
+ typedef typename own_attrib_meta_class_and_pos<I>
+ ::position new_pos_type;
+ return meta_class::attributes::query(context, new_pos_type(), dest);
+ }
+
+
+ /** This function is used to query the member attributes
+ * from the base classes.
+ */
+ template <class a_class, int I, typename value_type>
+ static void
+ set(a_class& context, mpl::int_<I> pos, value_type value, mpl::bool_<true>)
+ {
+ typedef typename inherited_attrib_meta_class_and_pos<I>
+ ::meta_class meta_class;
+ typedef typename inherited_attrib_meta_class_and_pos<I>
+ ::position new_pos_type;
+
+ meta_class::attributes::set(context, new_pos_type(), value);
+ }
+
+ template <class a_class, int I, typename value_type>
+ static void
+ set(a_class& context, mpl::int_<I> pos, value_type value, mpl::bool_<false>)
+ {
+ typedef typename own_attrib_meta_class_and_pos<I>
+ ::position new_pos_type;
+ meta_class::attributes::set(context, new_pos_type(), value);
+ }
+
+ }; // struct detail
+
+ /** The list of inherited attribute types
+ */
+ typedef typename detail::inherited_member_attrib_type_list inherited_type_list;
+
+ /** The size of the type_list, i.e. the count of inherited attributes
+ */
+ struct inherited_size : public mpl::size<inherited_type_list> { };
+
+ /** The list of types of all attributes including
+ * the inherited ones.
+ */
+ typedef typename detail::member_attrib_type_list type_list;
+
+ /** The size of the type_list, i.e. the count of all attributes
+ */
+ struct size : public mpl::size<type_list> { };
+
+ /** Gets the name of the I-th member (including
+ * the inherited ones)
+ */
+ template <int I>
+ static const bchar*
+ base_name(mpl::int_<I> pos)
+ {
+ typedef typename mpl::less<
+ mpl::int_<I>,
+ inherited_size
+ >::type is_inherited;
+
+ return detail::base_name(pos, is_inherited());
+ }
+
+ /** Gets the value of the I-th member (including
+ * the inherited ones)
+ */
+ template <class a_class, int I>
+ static typename detail::template result_of_get<I>::type
+ get(a_class context, mpl::int_<I> pos)
+ {
+ typedef typename mpl::less<
+ mpl::int_<I>,
+ inherited_size
+ >::type is_inherited;
+
+ return detail::get(context, pos, is_inherited());
+ }
+
+ /** Queries the value of the I-th member (including
+ * the inherited ones)
+ */
+ template <class a_class, int I, typename dest_type>
+ static dest_type&
+ query(a_class context, mpl::int_<I> pos, dest_type& dest)
+ {
+ typedef typename mpl::less<
+ mpl::int_<I>,
+ inherited_size
+ >::type is_inherited;
+
+ return detail::query(context, pos, dest, is_inherited());
+ }
+
+ /** Sets the value of the I-th member (including
+ * the inherited ones)
+ */
+ template <class a_class, int I, typename value_type>
+ static void
+ set(a_class& context, mpl::int_<I> pos, value_type value)
+ {
+ typedef typename mpl::less<
+ mpl::int_<I>,
+ inherited_size
+ >::type is_inherited;
+
+ detail::set(context, pos, value, is_inherited());
+ }
+ }; // all_attributes
+
+
} // namespace mirror
} // namespace boost
Modified: sandbox/mirror/boost/mirror/meta_class.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_class.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_class.hpp 2008-05-01 04:12:50 EDT (Thu, 01 May 2008)
@@ -35,6 +35,7 @@
namespace boost {
namespace mirror {
+
/** Meta class - specializes the meta_type for classes
*/
template <
@@ -64,464 +65,11 @@
* 0 <= I < N; N = $mpl::size<attributes::type_list>::value
*
*/
- typedef meta_class_attributes<reflected_class, variant_tag> attributes;
-
- /** This is basically the same as the "attributes" structure
- * but allows to work with all member attributes including
- * the inherited ones.
- */
- struct all_attributes
- : detail::meta_class_attrib_utils<meta_class, all_attributes>
- {
- /** This struct "hides" the internal helpers
- */
- struct detail
- {
- /** The list of non-virtual base classes in the same
- * order as they were registered.
- */
- typedef typename mpl::remove_if<
- typename base_classes::list,
- mpl::lambda<
- reflects_virtual_inheritance<mpl::_1>
- >::type
- >::type list_of_regular_base_classes;
-
- /** The list of directly inhertied virtual base classes.
- */
- typedef typename mpl::remove_if<
- typename base_classes::list,
- mpl::lambda<
- mpl::not_<reflects_virtual_inheritance<mpl::_1> >
- >::type
- >::type list_of_virtual_base_classes;
-
- /** This template gets the regular_base_class_layout
- * of a base class when given a meta_inheritance
- * specialization for this base class.
- */
- template <class meta_inheritance>
- struct get_base_class_regular_layout
- {
- typedef typename
- meta_inheritance::
- meta_class::
- all_attributes::
- detail::
- regular_base_class_layout type;
- };
-
- /** The layout of non-virtual base classes
- * of this class, stored as a mpl::vector
- * of meta_inheritances.
- */
- typedef typename mpl::accumulate<
- list_of_regular_base_classes,
- mpl::vector0<>,
- mpl::push_back<
- mpl::insert_range<
- mpl::_1,
- mpl::end<mpl::_1>,
- get_base_class_regular_layout<
- mpl::_2
- >
- >,
- mpl::_2
- >
- >::type regular_base_class_layout;
-
- /** This template gets the virtual_base_class_layout
- * of a base class when given a meta_inheritance
- * specialization for this base class.
- */
- template <class meta_inheritance>
- struct get_base_class_virtual_layout
- {
- typedef typename
- meta_inheritance::
- meta_class::
- all_attributes::
- detail::
- virtual_base_class_layout type;
- };
-
- /** This template gets the base_class_layout
- * of a base class when given a meta_inheritance
- * specialization for this base class.
- */
- template <class meta_inheritance>
- struct get_base_class_layout
- {
- typedef typename
- meta_inheritance::
- meta_class::
- all_attributes::
- detail::
- base_class_layout type;
- };
-
- /** The list of vitual base classes of this class.
- * This list still contains dupplicates, that are
- * removed to form virtual_base_class_layout
- */
- typedef typename mpl::accumulate<
- typename base_classes::list,
- mpl::vector0<>,
- mpl::if_<
- reflects_virtual_inheritance<
- mpl::_2
- >,
- mpl::push_back<
- mpl::insert_range<
- mpl::_1,
- mpl::end<mpl::_1>,
- get_base_class_layout<
- mpl::_2
- >
- >,
- mpl::_2
- >,
- mpl::insert_range<
- mpl::_1,
- mpl::end<mpl::_1>,
- get_base_class_virtual_layout<
- mpl::_2
- >
- >
- >
- >::type virtual_base_class_layout_w_dups;
-
- /** The layout of virtual base classes
- * of this class, stored as a mpl::vector
- * of meta_inheritances.
- */
- typedef typename mpl::fold<
- virtual_base_class_layout_w_dups,
- mpl::vector0<>,
- mpl::if_<
- mpl::contains<
- mpl::_1,
- mpl::_2
- >,
- mpl::_1,
- mpl::push_back<
- mpl::_1,
- mpl::_2
- >
- >
- >::type virtual_base_class_layout;
-
- /** This template gets the list of member
- * attrbute types of a base class when
- * given a meta_inheritance<> specialization
- */
- template <class meta_inheritance>
- struct get_base_class_attrib_type_list
- {
- typedef typename meta_inheritance::
- meta_class::
- attributes::
- type_list type;
- };
-
- typedef typename mpl::joint_view<
- virtual_base_class_layout,
- regular_base_class_layout
- >::type base_class_layout;
-
- /** The list of inherited member attributes
- * of the reflected class.
- * NOTE: this implementation puts the
- * members of the virtual bases before
- * the other members.
- */
- typedef typename mpl::accumulate<
- base_class_layout,
- mpl::vector0<>,
- mpl::insert_range<
- mpl::_1,
- mpl::end<mpl::_1>,
- get_base_class_attrib_type_list<
- mpl::_2
- >
- >
- >::type inherited_member_attrib_type_list;
-
- /** The list of types of all attributes including
- * the inherited ones.
- */
- typedef typename mpl::joint_view<
- typename detail::inherited_member_attrib_type_list,
- typename meta_class<reflected_class, variant_tag>::attributes::type_list
- >::type member_attrib_type_list;
-
-
- /** This template gets the list of the owner classes
- * for the inherited attributes.
- */
- template <class current_list, class meta_inheritance>
- struct get_base_class_attrib_owner_and_offs
- {
- typedef typename meta_inheritance::
- meta_class base_meta_class;
-
- typedef typename base_meta_class::
- attributes::
- type_list type_list;
-
- typedef typename mpl::size<
- current_list
- >::type offset;
- typedef typename mpl::pair<
- base_meta_class,
- offset
- > pair;
-
- template<typename T>
- struct get_pair
- {
- typedef pair type;
- };
-
- typedef typename mpl::accumulate<
- type_list,
- current_list,
- mpl::push_back<
- mpl::_1,
- get_pair<mpl::_>
- >
- >::type type;
- };
-
- /** This is a list that contains a pair of owner meta_class
- * and the index offset for every inherited attribute.
- */
- typedef typename mpl::accumulate<
- base_class_layout,
- mpl::vector0<>,
- get_base_class_attrib_owner_and_offs<
- mpl::_1,
- mpl::_2
- >
- >::type inherited_attrib_owners_and_offsets;
-
- /** This template is used to query the return value
- * type of the getter for the I-th member attribute
- */
- template <int I>
- struct result_of_get
- {
- typedef typename mpl::at<
- member_attrib_type_list,
- mpl::int_<I>
- >::type type;
- };
-
- template <int I>
- struct inherited_attrib_meta_class_and_pos
- {
- typedef typename mpl::at<
- typename detail::inherited_attrib_owners_and_offsets,
- mpl::int_<I>
- >::type owner_and_offset;
-
- typedef typename owner_and_offset::first meta_class;
- typedef typename mpl::int_<mpl::minus<
- mpl::int_<I>,
- typename owner_and_offset::second
- >::value> position;
- };
-
- template <int I>
- struct own_attrib_meta_class_and_pos
- {
- typedef typename mpl::int_<mpl::minus<
- mpl::int_<I>,
- typename mpl::size<inherited_member_attrib_type_list>::type
- >::value> position;
- };
-
- /** This function is used to get the names of the member
- * attributes from the base classes.
- */
- template <int I>
- static const bchar*
- base_name(mpl::int_<I> pos, mpl::bool_<true>)
- {
- typedef typename inherited_attrib_meta_class_and_pos<I>
- ::meta_class meta_class;
- typedef typename inherited_attrib_meta_class_and_pos<I>
- ::position new_pos_type;
-
- return meta_class::attributes::base_name(new_pos_type());
- }
-
- template <int I>
- static const bchar*
- base_name(mpl::int_<I> pos, mpl::bool_<false>)
- {
- typedef typename own_attrib_meta_class_and_pos<I>
- ::position new_pos_type;
-
- return meta_class::attributes::base_name(new_pos_type());
- }
-
-
- /** This function is used to get the member attributes
- * from the base classes.
- */
- template <class a_class, int I>
- static typename result_of_get<I>::type
- get(a_class context, mpl::int_<I> pos, mpl::bool_<true>)
- {
- typedef typename inherited_attrib_meta_class_and_pos<I>
- ::meta_class meta_class;
- typedef typename inherited_attrib_meta_class_and_pos<I>
- ::position new_pos_type;
-
- return meta_class::attributes::get(context, new_pos_type());
-
- }
- template <class a_class, int I>
- static typename result_of_get<I>::type
- get(a_class context, mpl::int_<I> pos, mpl::bool_<false>)
- {
- typedef typename own_attrib_meta_class_and_pos<I>
- ::position new_pos_type;
- return meta_class::attributes::get(context, new_pos_type());
- }
-
-
- /** This function is used to query the member attributes
- * from the base classes.
- */
- template <class a_class, int I, typename dest_type>
- static dest_type&
- query(a_class context, mpl::int_<I> pos, dest_type& dest, mpl::bool_<true>)
- {
- typedef typename inherited_attrib_meta_class_and_pos<I>
- ::meta_class meta_class;
- typedef typename inherited_attrib_meta_class_and_pos<I>
- ::position new_pos_type;
-
- return meta_class::attributes::query(context, new_pos_type(), dest);
-
- }
-
- template <class a_class, int I, typename dest_type>
- static dest_type&
- query(a_class context, mpl::int_<I> pos, dest_type& dest, mpl::bool_<false>)
- {
- typedef typename own_attrib_meta_class_and_pos<I>
- ::position new_pos_type;
- return meta_class::attributes::query(context, new_pos_type(), dest);
- }
-
-
- /** This function is used to query the member attributes
- * from the base classes.
- */
- template <class a_class, int I, typename value_type>
- static void
- set(a_class& context, mpl::int_<I> pos, value_type value, mpl::bool_<true>)
- {
- typedef typename inherited_attrib_meta_class_and_pos<I>
- ::meta_class meta_class;
- typedef typename inherited_attrib_meta_class_and_pos<I>
- ::position new_pos_type;
-
- meta_class::attributes::set(context, new_pos_type(), value);
- }
-
- template <class a_class, int I, typename value_type>
- static void
- set(a_class& context, mpl::int_<I> pos, value_type value, mpl::bool_<false>)
- {
- typedef typename own_attrib_meta_class_and_pos<I>
- ::position new_pos_type;
- meta_class::attributes::set(context, new_pos_type(), value);
- }
-
- }; // struct detail
-
- /** The list of inherited attribute types
- */
- typedef typename detail::inherited_member_attrib_type_list inherited_type_list;
-
- /** The size of the type_list, i.e. the count of inherited attributes
- */
- struct inherited_size : public mpl::size<inherited_type_list> { };
-
- /** The list of types of all attributes including
- * the inherited ones.
- */
- typedef typename detail::member_attrib_type_list type_list;
-
- /** The size of the type_list, i.e. the count of all attributes
- */
- struct size : public mpl::size<type_list> { };
-
- /** Gets the name of the I-th member (including
- * the inherited ones)
- */
- template <int I>
- static const bchar*
- base_name(mpl::int_<I> pos)
- {
- typedef typename mpl::less<
- mpl::int_<I>,
- inherited_size
- >::type is_inherited;
-
- return detail::base_name(pos, is_inherited());
- }
-
- /** Gets the value of the I-th member (including
- * the inherited ones)
- */
- template <class a_class, int I>
- static typename detail::template result_of_get<I>::type
- get(a_class context, mpl::int_<I> pos)
- {
- typedef typename mpl::less<
- mpl::int_<I>,
- inherited_size
- >::type is_inherited;
-
- return detail::get(context, pos, is_inherited());
- }
-
- /** Queries the value of the I-th member (including
- * the inherited ones)
- */
- template <class a_class, int I, typename dest_type>
- static dest_type&
- query(a_class context, mpl::int_<I> pos, dest_type& dest)
- {
- typedef typename mpl::less<
- mpl::int_<I>,
- inherited_size
- >::type is_inherited;
-
- return detail::query(context, pos, dest, is_inherited());
- }
-
- /** Sets the value of the I-th member (including
- * the inherited ones)
- */
- template <class a_class, int I, typename value_type>
- static void
- set(a_class& context, mpl::int_<I> pos, value_type value)
- {
- typedef typename mpl::less<
- mpl::int_<I>,
- inherited_size
- >::type is_inherited;
-
- detail::set(context, pos, value, is_inherited());
- }
- }; // all_attributes
+ typedef meta_class_attributes<reflected_class, variant_tag>
+ attributes;
+ typedef meta_class_all_attributes<meta_class<reflected_class, variant_tag> >
+ all_attributes;
};
Modified: sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml
==============================================================================
--- sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml (original)
+++ sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml 2008-05-01 04:12:50 EDT (Thu, 01 May 2008)
@@ -98,7 +98,10 @@
- Updated several sources to comply with the Boost Coding Guidelines
for Integral Constant Expressions, now using the BOOST_STATIC_CONSTANT
macro.
-
+ </revision>
+ <revision id="20080501" major="0" minor="1" micro="16" author="m_ch">
+ - Moved the all_attributes implementation out of the meta_class
+ to a separate template (placed in mirror/meta_attribs.cpp)
</revision>
</revisions>
</library>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk