|
Boost-Commit : |
From: chochlik_at_[hidden]
Date: 2008-07-08 06:42:06
Author: matus.chochlik
Date: 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
New Revision: 47212
URL: http://svn.boost.org/trac/boost/changeset/47212
Log:
- The meta-attribute registering macros were reimplemented and the examples updated accordingly
Text files modified:
sandbox/mirror/boost/mirror/detail/meta_attribs_base.hpp | 268 ++++++++++++++++++++++++++++++---------
sandbox/mirror/boost/mirror/detail/meta_attribs_outline.hpp | 8
sandbox/mirror/boost/mirror/detail/meta_type_registering.hpp | 72 +++++++++-
sandbox/mirror/boost/mirror/meta_attributes.hpp | 14 -
sandbox/mirror/boost/mirror/meta_classes/boost_tuple.hpp | 6
sandbox/mirror/boost/mirror/meta_classes/std_pair.hpp | 4
sandbox/mirror/libs/mirror/example/registering/classes.cpp | 18 ++
sandbox/mirror/libs/mirror/example/registering/virtual_bases.cpp | 16 +-
sandbox/mirror/libs/mirror/example/serialization/cube.cpp | 84 ++++++-----
sandbox/mirror/libs/mirror/example/traversal/sample_meta_path.cpp | 16 +-
sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp | 16 +-
11 files changed, 365 insertions(+), 157 deletions(-)
Modified: sandbox/mirror/boost/mirror/detail/meta_attribs_base.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/meta_attribs_base.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/meta_attribs_base.hpp 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
@@ -49,36 +49,50 @@
struct __ { };
}
-/** Additional attribute traits
+/** Additional attribute traits containing information
+ * about storage class specifiers and some information
+ * about the type of the attribute
*/
-template <class Specifiers>
+template <class Specifiers, class TypeOrTypedefSelector>
struct meta_class_attribute_traits;
/** Specialization for non-static, non-mutable members
*/
-template <>
-struct meta_class_attribute_traits<attrib_storage_specifiers::__>
+template <class TypeOrTypedefSelector>
+struct meta_class_attribute_traits<
+ attrib_storage_specifiers::__,
+ TypeOrTypedefSelector
+>
{
typedef mpl::false_ is_static;
typedef mpl::false_ is_mutable;
+ typedef TypeOrTypedefSelector meta_type_selector;
};
/** Specialization for static member attribs
*/
-template <>
-struct meta_class_attribute_traits<attrib_storage_specifiers::static_>
+template <class TypeOrTypedefSelector>
+struct meta_class_attribute_traits<
+ attrib_storage_specifiers::static_,
+ TypeOrTypedefSelector
+>
{
typedef mpl::true_ is_static;
typedef mpl::false_ is_mutable;
+ typedef TypeOrTypedefSelector meta_type_selector;
};
/** Specialization for mutable member attribs
*/
-template <>
-struct meta_class_attribute_traits<attrib_storage_specifiers::mutable_>
+template <class TypeOrTypedefSelector>
+struct meta_class_attribute_traits<
+ attrib_storage_specifiers::mutable_,
+ TypeOrTypedefSelector
+>
{
typedef mpl::false_ is_static;
typedef mpl::true_ is_mutable;
+ typedef TypeOrTypedefSelector meta_type_selector;
};
@@ -132,54 +146,65 @@
/** Helper macro expanding into a prologue of a meta-attribute
* declaration
*/
-#define BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_PROLOGUE( \
+#define BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_BASE_PROLOGUE( \
SPECIFIERS, \
+ TYPE_SELECTOR, \
NAME \
) \
- _partial_list_##NAME; \
- typedef mpl::int_< mpl::size< _partial_list_##NAME >::value > \
- _position_of_##NAME; \
+ partial_list_##NAME; \
+ typedef mpl::int_< mpl::size< partial_list_##NAME >::value > \
+ position_of_##NAME; \
static const bchar* base_name( \
- _position_of_##NAME \
+ position_of_##NAME \
){return BOOST_STR_LIT(#NAME);} \
static meta_class_attribute_traits< \
- ::boost::mirror::attrib_storage_specifiers:: SPECIFIERS##_ \
- > get_traits(_position_of_##NAME);
+ ::boost::mirror::attrib_storage_specifiers:: SPECIFIERS##_, \
+ TYPE_SELECTOR \
+ > get_traits(position_of_##NAME);
/** Helper macro expanding into an epilogue of a meta-attribute
* declaration
*/
#define BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_EPILOGUE( \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
TYPENAME_KW \
-) typedef TYPENAME_KW mpl::push_back<_partial_list_##NAME, TYPE>::type
+) typedef TYPENAME_KW mpl::push_back< \
+ partial_list_##NAME, \
+ typename ::boost::mirror::typedef_::extract_type< \
+ TYPE_SELECTOR \
+ >::type \
+>::type
/** Helper macro expanding into the declaraion of getter
* function of the meta-attribute
*/
#define BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_GETTER( \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
GETTER_BODY, \
TYPENAME_KW \
-) inline static TYPENAME_KW call_traits<TYPE>::param_type get( \
+) inline static TYPENAME_KW call_traits< \
+ typename ::boost::mirror::typedef_::extract_type< \
+ TYPE_SELECTOR \
+ >::type \
+ >::param_type get( \
const Class& instance, \
- _position_of_##NAME \
- ) GETTER_BODY
+ position_of_##NAME position \
+ ) GETTER_BODY
/** Helper macro expanding into the declaration of query
* function of the meta-attribute
*/
#define BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_QUERY( \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
QUERY_BODY, \
TYPENAME_KW \
) template <typename DestType> \
inline static DestType& query( \
const Class& instance, \
- _position_of_##NAME, \
+ position_of_##NAME, \
DestType& dest \
) QUERY_BODY
@@ -187,58 +212,87 @@
* function of the meta-attribute
*/
#define BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_SETTER( \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
SETTER_BODY, \
TYPENAME_KW \
) inline static void set( \
Class& instance, \
- _position_of_##NAME, \
- TYPENAME_KW call_traits<TYPE>::param_type value \
+ position_of_##NAME, \
+ TYPENAME_KW call_traits< \
+ typename ::boost::mirror::typedef_::extract_type< \
+ TYPE_SELECTOR \
+ >::type \
+ >::param_type value \
) SETTER_BODY \
inline static void set( \
const Class& instance, \
- _position_of_##NAME, \
- TYPENAME_KW call_traits<TYPE>::param_type value \
+ position_of_##NAME, \
+ TYPENAME_KW call_traits< \
+ typename ::boost::mirror::typedef_::extract_type< \
+ TYPE_SELECTOR \
+ >::type \
+ >::param_type value \
) { }
-/** General macro for registering meta data about class' or template's
- * member attribute
- */
-
-#define BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB( \
+#define BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_PROLOGUE( \
SPECIFIERS, \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
GETTER_BODY, \
QUERY_BODY, \
SETTER_BODY, \
TYPENAME_KW \
) \
- BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_PROLOGUE( \
+ BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_BASE_PROLOGUE( \
SPECIFIERS, \
+ TYPE_SELECTOR, \
NAME \
) \
BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_GETTER( \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
GETTER_BODY, \
TYPENAME_KW \
) \
BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_QUERY( \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
QUERY_BODY, \
TYPENAME_KW \
) \
BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_SETTER( \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
SETTER_BODY, \
TYPENAME_KW \
) \
+
+
+/** General macro for registering meta data about class' or template's
+ * member attribute
+ */
+
+#define BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB( \
+ SPECIFIERS, \
+ TYPE_SELECTOR, \
+ NAME, \
+ GETTER_BODY, \
+ QUERY_BODY, \
+ SETTER_BODY, \
+ TYPENAME_KW \
+) \
+ BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_PROLOGUE( \
+ SPECIFIERS, \
+ TYPE_SELECTOR, \
+ NAME, \
+ GETTER_BODY, \
+ QUERY_BODY, \
+ SETTER_BODY, \
+ TYPENAME_KW \
+ ) \
BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_EPILOGUE( \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
TYPENAME_KW \
) \
@@ -249,14 +303,14 @@
*/
#define BOOST_MIRROR_REG_CLASS_ATTRIB( \
SPECIFIERS, \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
GETTER_BODY, \
QUERY_BODY, \
SETTER_BODY \
) BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB( \
SPECIFIERS, \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
GETTER_BODY, \
QUERY_BODY, \
@@ -269,14 +323,14 @@
*/
#define BOOST_MIRROR_REG_TEMPLATE_ATTRIB( \
SPECIFIERS, \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
GETTER_BODY, \
QUERY_BODY, \
SETTER_BODY \
) BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB( \
SPECIFIERS, \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
GETTER_BODY, \
QUERY_BODY, \
@@ -290,11 +344,11 @@
*/
#define BOOST_MIRROR_REG_SIMPLE_TEMPLATE_OR_CLASS_ATTRIB( \
SPECIFIERS, \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
TYPENAME_KW \
) BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB( \
- SPECIFIERS, TYPE, NAME, \
+ SPECIFIERS, TYPE_SELECTOR, NAME, \
{return instance.NAME;}, \
{dest = DestType(instance.NAME); return dest;}, \
{instance.NAME = value;}, \
@@ -308,11 +362,11 @@
*/
#define BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB( \
SPECIFIERS, \
- TYPE, \
+ TYPE_SELECTOR, \
NAME \
) BOOST_MIRROR_REG_SIMPLE_TEMPLATE_OR_CLASS_ATTRIB( \
SPECIFIERS, \
- TYPE, \
+ TYPE_SELECTOR, \
NAME, \
BOOST_PP_EMPTY() \
)
@@ -332,17 +386,120 @@
typename \
)
+/** Macro used for registering meta-data about class' or template's
+ * attribute that can be accessed from the outside by calling
+ * the getter function as specified by GETTER_CALL and setter
+ * function as specified by SETTER_CALL.
+ */
+#define BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_GET_SET( \
+ SPECIFIERS, \
+ TYPE_SELECTOR, \
+ NAME, \
+ GETTER_CALL, \
+ SETTER_CALL, \
+ TYPENAME_KW \
+) BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB( \
+ SPECIFIERS, TYPE_SELECTOR, NAME, \
+ {return instance.GETTER_CALL;}, \
+ {dest = DestType(instance.GETTER_CALL); return dest;}, \
+ {instance.SETTER_CALL;}, \
+ TYPENAME_KW \
+ )
+
+
+/** Macro used for registering meta-data about class' attribute
+ * that can be accessed from the outside by calling
+ * the getter function as specified by GETTER_CALL and setter
+ * function as specified by SETTER_CALL.
+ */
+#define BOOST_MIRROR_REG_CLASS_ATTRIB_GET_SET( \
+ SPECIFIERS, \
+ TYPE_SELECTOR, \
+ NAME, \
+ GETTER_CALL, \
+ SETTER_CALL \
+) BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_GET_SET( \
+ SPECIFIERS, \
+ TYPE_SELECTOR, \
+ NAME, \
+ GETTER_CALL, \
+ SETTER_CALL, \
+ BOOST_PP_EMPTY() \
+)
+
+/** Macro used for registering meta-data about template's attribute
+ * that can be accessed from the outside by calling
+ * the getter function as specified by GETTER_CALL and setter
+ * function as specified by SETTER_CALL.
+ */
+#define BOOST_MIRROR_REG_TEMPLATE_ATTRIB_GET_SET( \
+ SPECIFIERS, \
+ TYPE, \
+ NAME, \
+ GETTER_CALL, \
+ SETTER_CALL \
+) BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_GET_SET( \
+ SPECIFIERS, \
+ TYPE, \
+ NAME, \
+ GETTER_CALL, \
+ SETTER_CALL, \
+ typename \
+)
+
+#define BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_WITH_OUTLINE( \
+ SPECIFIERS, \
+ TYPE_SELECTOR, \
+ NAME, \
+ GETTER_BODY, \
+ QUERY_BODY, \
+ SETTER_BODY, \
+ TYPENAME_KW \
+) \
+ BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_PROLOGUE( \
+ SPECIFIERS, \
+ TYPE_SELECTOR, \
+ NAME, \
+ GETTER_BODY, \
+ QUERY_BODY, \
+ SETTER_BODY, \
+ TYPENAME_KW \
+ ) \
+ BOOST_MIRROR_DECLARE_ATTRIB_OUTLINE(TYPE, NAME) \
+ BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_EPILOGUE( \
+ TYPE_SELECTOR, \
+ NAME, \
+ TYPENAME_KW \
+ ) \
+
+
+#define BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB_OUTLINE( \
+ SPECIFIERS, \
+ TYPE_SELECTOR, \
+ NAME \
+) \
+ BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_WITH_OUTLINE( \
+ SPECIFIERS, \
+ TYPE_SELECTOR, \
+ NAME, \
+ {return instance.NAME;}, \
+ {dest = DestType(instance.NAME); return dest;}, \
+ {instance.NAME = value;}, \
+ BOOST_PP_EMPTY() \
+ )
+
#ifdef NEVER_COMPILE_THIS
+
+
/** This macro declares the meta-data for a single class' attribute outline
*/
#define BOOST_MIRROR_REG_CLASS_ATTRIB_OUTLINE(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_DECLARE_ATTRIB_OUTLINE(NUMBER, TYPE, NAME) \
BOOST_MIRROR_REG_CLASS_ATTRIB_EPILOGUE(NUMBER, TYPE, NAME, false)
/** This macro declares the meta-data for a single templates attribute
@@ -354,21 +511,6 @@
BOOST_MIRROR_DECLARE_ATTRIB_OUTLINE(NUMBER, TYPE, NAME) \
BOOST_MIRROR_REG_TEMPLATE_ATTRIB_EPILOGUE(NUMBER, TYPE, NAME, false)
-/** 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, false)
-
-/** 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, false)
#endif // NEVER_COMPILE_THIS
Modified: sandbox/mirror/boost/mirror/detail/meta_attribs_outline.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/meta_attribs_outline.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/meta_attribs_outline.hpp 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
@@ -47,7 +47,7 @@
}
};
-#define BOOST_MIRROR_DECLARE_ATTRIB_OUTLINE(NUMBER, TYPE, NAME) \
+#define BOOST_MIRROR_DECLARE_ATTRIB_OUTLINE(TYPE, NAME) \
template <template <class> class Model> \
struct NAME##_outline_holder \
{ \
@@ -56,7 +56,7 @@
Class, \
variant_tag, \
meta_class_attributes<Class, variant_tag>, \
- mpl::int_<NUMBER> \
+ position_of_##NAME \
>, \
Model \
> \
@@ -66,7 +66,7 @@
Class, \
variant_tag, \
meta_class_attributes<Class, variant_tag>, \
- mpl::int_<NUMBER> \
+ position_of_##NAME \
>, \
Model \
> base; \
@@ -81,7 +81,7 @@
: NAME(classModel){ } \
}; \
template <template <class> class Model> \
- static NAME##_outline_holder<Model> get_outline_holder(Model<void>*, mpl::int_<NUMBER>);
+ static NAME##_outline_holder<Model> get_outline_holder(Model<void>*, position_of_##NAME);
} // namespace detail
Modified: sandbox/mirror/boost/mirror/detail/meta_type_registering.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/meta_type_registering.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/meta_type_registering.hpp 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
@@ -92,28 +92,79 @@
}; \
} // namespace detail
-/** Macro that expands into a typedef-ined type selectos
+
+/** All typedefined types are registered in this namespace
+ * as templates
+ */
+namespace typedef_ {
+
+ // this type is used to recognize the Typedef<Namespace, typedef_tag>
+ // templates representing registered typedefs from other
+ // 'template <class, class> class' templates
+ struct typedef_tag { };
+
+ /** this meta-function is used to extract the type
+ * from regular types and typedef type selectors
+ * in a uniform way.
+ *
+ * By default the template argument is 'returned'
+ */
+ template <class TypeOrTypedefSelector>
+ struct extract_type
+ {
+ typedef TypeOrTypedefSelector type;
+ };
+
+ /** This is specialization for the templates in mirror::typedef_
+ * that represent the registered typedefined types.
+ * In this case the base_type of the selector is returned
+ */
+ template <
+ template <class, class> class TypedefSelector,
+ class NamespacePlaceholder
+ >
+ struct extract_type<TypedefSelector<NamespacePlaceholder, typedef_tag> >
+ {
+ typedef typename TypedefSelector<
+ NamespacePlaceholder,
+ typedef_tag
+ >::base_type type;
+ };
+} // namespace typedef_
+
+
+
+/** Macro that expands into a typedef-ined type selector
*/
#define BOOST_MIRROR_GET_TYPEDEFD_TYPE_SELECTOR(NAMESPACE, TYPEDEFD_NAME) \
::boost::mirror::typedef_::TYPEDEFD_NAME < \
- BOOST_MIRRORED_NAMESPACE( NAMESPACE ) \
+ BOOST_MIRRORED_NAMESPACE( NAMESPACE ), \
+ ::boost::mirror::typedef_::typedef_tag \
>
/** Macro that expands into a typedef-ined type selector
*/
#define BOOST_MIRROR_GET_TYPEDEFD_TYPE_SELECTOR_GS(TYPEDEFD_NAME) \
::boost::mirror::typedef_::TYPEDEFD_NAME < \
- BOOST_MIRRORED_GLOBAL_SCOPE() \
- >
+ BOOST_MIRRORED_GLOBAL_SCOPE(), \
+ ::boost::mirror::typedef_::typedef_tag \
+ >
+
+#define BOOST_MIRROR_TYPEDEF(NAMESPACE, TYPEDEFD_NAME) \
+ BOOST_MIRROR_GET_TYPEDEFD_TYPE_SELECTOR(NAMESPACE, TYPEDEFD_NAME)
+
+#define BOOST_MIRROR_TYPEDEF_GS(TYPEDEFD_NAME) \
+ BOOST_MIRROR_GET_TYPEDEFD_TYPE_SELECTOR_GS(TYPEDEFD_NAME)
/** Macro for registering typedef-ined types in the global scope
*/
#define BOOST_MIRROR_REG_TYPEDEF_GLOBAL_SCOPE(TYPEDEFD_NAME) \
namespace typedef_ { \
- template <class MetaNamespace> struct TYPEDEFD_NAME; \
+ template <class MetaNamespace, class Tag> struct TYPEDEFD_NAME; \
template <> struct TYPEDEFD_NAME< \
- BOOST_MIRRORED_GLOBAL_SCOPE() \
- > { }; \
+ BOOST_MIRRORED_GLOBAL_SCOPE(), \
+ ::boost::mirror::typedef_::typedef_tag \
+ > {typedef TYPEDEFD_NAME base_type;}; \
} /* namespace typedef_ */ \
namespace detail { \
template <> struct registered_type_info< \
@@ -134,10 +185,11 @@
*/
#define BOOST_MIRROR_REG_TYPEDEF(NAMESPACE, TYPEDEFD_NAME) \
namespace typedef_ { \
- template <class MetaNamespace> struct TYPEDEFD_NAME; \
+ template <class MetaNamespace, class Tag> struct TYPEDEFD_NAME; \
template <> struct TYPEDEFD_NAME< \
- BOOST_MIRRORED_NAMESPACE( NAMESPACE ) \
- > { }; \
+ BOOST_MIRRORED_NAMESPACE( NAMESPACE ), \
+ ::boost::mirror::typedef_::typedef_tag \
+ > {typedef NAMESPACE :: TYPEDEFD_NAME base_type;}; \
} /* namespace typedef_ */ \
namespace detail { \
template <> struct registered_type_info< \
Modified: sandbox/mirror/boost/mirror/meta_attributes.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_attributes.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_attributes.hpp 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
@@ -602,7 +602,7 @@
// in this instance
typedef MetaAttributes meta_attributes;
- // the position of the meta-attribute in the instance
+ // the position of the meta-attribute
typedef AttribPos position;
// the type of the attribute
@@ -611,19 +611,12 @@
position
>::type type;
-
// base name getter
inline static const bchar* base_name(void)
{
return meta_attributes::base_name(position());
}
- // full name getter
- inline static const bchar* full_name(void)
- {
- return meta_attributes::full_name(position());
- }
-
typedef typename meta_class::reflected_type reflected_class;
// value getter
@@ -662,6 +655,11 @@
)
typedef typename detail_traits::type traits;
+ /** The meta-type of the attribute
+ */
+ typedef meta_type<
+ typename traits::meta_type_selector
+ > meta_type;
};
} // namespace mirror
Modified: sandbox/mirror/boost/mirror/meta_classes/boost_tuple.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_classes/boost_tuple.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_classes/boost_tuple.hpp 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
@@ -81,8 +81,10 @@
// traits getter
template <int I>
- static meta_class_attribute_traits<false>
- get_traits(mpl::int_<I>);
+ static meta_class_attribute_traits<
+ ::boost::mirror::attrib_storage_specifiers::__,
+ typename att_val_pass<I>::type
+ > get_traits(mpl::int_<I>);
//
typedef template_params
Modified: sandbox/mirror/boost/mirror/meta_classes/std_pair.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_classes/std_pair.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_classes/std_pair.hpp 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
@@ -17,8 +17,8 @@
namespace mirror {
BOOST_MIRROR_REG_TEMPLATE_ATTRIBS_BEGIN(::std::pair, 2)
- BOOST_MIRROR_REG_TEMPLATE_ATTRIB(0, T0, first)
- BOOST_MIRROR_REG_TEMPLATE_ATTRIB(1, T1, second)
+ BOOST_MIRROR_REG_SIMPLE_TEMPLATE_ATTRIB(_, T0, first)
+ BOOST_MIRROR_REG_SIMPLE_TEMPLATE_ATTRIB(_, T1, second)
BOOST_MIRROR_REG_TEMPLATE_ATTRIBS_END
Modified: sandbox/mirror/libs/mirror/example/registering/classes.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/registering/classes.cpp (original)
+++ sandbox/mirror/libs/mirror/example/registering/classes.cpp 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
@@ -105,8 +105,17 @@
char a_char;
bool a_bool;
};
+ //
+ // a static member attribute
+ static const short a_short;
+
+ // a mutable member attribute
+ mutable long a_long;
};
+const short bar::a_short = 123;
+
+
} // namespace detail
} // namespace stuff
@@ -153,7 +162,6 @@
public, ::test::stuff::detail::bar_base
)
-
/** Class attributes
*/
// register the attributes of bar_base
@@ -188,7 +196,7 @@
// attributes with typedef'd types
//BOOST_MIRROR_REG_CLASS_ATTRIB_SETTER_TD(4, _boost, ::boost, bstring, a_string, set_string)
BOOST_MIRROR_REG_CLASS_ATTRIB(
- _, ::boost::bstring, a_string,
+ _, BOOST_MIRROR_TYPEDEF(::boost, bstring), a_string,
{return instance.a_string;},
{dest = DestType(instance.a_string); return dest;},
{instance.set_string(value);}
@@ -212,7 +220,7 @@
{
typedef MetaObject meta_object;
//
- // prints some info about the meta-object t
+ // prints some info about the meta-object
// to the given stream
template <class OutStream>
OutStream& print(OutStream& s) const
@@ -326,7 +334,9 @@
{
using namespace ::std;
s << endl << " - " <<
- name_to_stream< BOOST_MIRRORED_TYPE(typename MetaAttribute::type) >() <<
+ name_to_stream<
+ typename MetaAttribute::meta_type
+ >() <<
" " <<
ma.base_name();
}
Modified: sandbox/mirror/libs/mirror/example/registering/virtual_bases.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/registering/virtual_bases.cpp (original)
+++ sandbox/mirror/libs/mirror/example/registering/virtual_bases.cpp 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
@@ -136,35 +136,35 @@
/** Class attributes
*/
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::A)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, long, l)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, long, l)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::B)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, int, i)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, int, i)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::C)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, double, d)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, double, d)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::D)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, short, s)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, short, s)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::E)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, float, f)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, float, f)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::F)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, bool, b)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, bool, b)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::G)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, char, c)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, char, c)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::H)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, wchar_t, w)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, wchar_t, w)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
Modified: sandbox/mirror/libs/mirror/example/serialization/cube.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/serialization/cube.cpp (original)
+++ sandbox/mirror/libs/mirror/example/serialization/cube.cpp 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
@@ -94,8 +94,8 @@
float_type _z = 0.0
)
: Coords(_x, _y, _z){ }
- float_type length_squared(void){return x*x + y*y + z*z;}
- float_type length(void){return sqrt(length_squared());}
+ float_type length_squared(void) const {return x*x + y*y + z*z;}
+ float_type length(void) const {return sqrt(length_squared());}
//
friend bool operator == (const Vector& a, const Vector& b)
{
@@ -181,68 +181,72 @@
*/
// register the attributes of Coords
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Graphics::Coords)
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER(
- 0, ::Graphics::Coords::float_type,
- x, get_x, set_x
- )
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER(
- 1, ::Graphics::Coords::float_type,
- y, get_y, set_y
- )
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER(
- 2, ::Graphics::Coords::float_type,
- z, get_z, set_z
- )
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_SETTER(
- 3, ::Graphics::Coords::float_type,
- w, get_w, set_w
+ BOOST_MIRROR_REG_CLASS_ATTRIB_GET_SET(
+ _, ::Graphics::Coords::float_type, x,
+ get_x(), set_x(value)
+ )
+ BOOST_MIRROR_REG_CLASS_ATTRIB_GET_SET(
+ _, ::Graphics::Coords::float_type, y,
+ get_y(), set_y(value)
+ )
+ BOOST_MIRROR_REG_CLASS_ATTRIB_GET_SET(
+ _, ::Graphics::Coords::float_type, z,
+ get_z(), set_z(value)
+ )
+ BOOST_MIRROR_REG_CLASS_ATTRIB_GET_SET(
+ _, ::Graphics::Coords::float_type, w,
+ get_w(), set_w(value)
)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
// register the attributes of Vector
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Graphics::Vector)
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_ONLY(
- 0, ::Graphics::Vector::float_type,
- length_squared, length_squared
- )
- BOOST_MIRROR_REG_CLASS_ATTRIB_GETTER_ONLY(
- 1, ::Graphics::Vector::float_type,
- length, length
+ BOOST_MIRROR_REG_CLASS_ATTRIB(
+ _, ::Graphics::Vector::float_type, length_squared,
+ {return instance.length_squared();},
+ {dest = DestType(instance.length_squared()); return dest;},
+ { } // no setting
+ )
+ BOOST_MIRROR_REG_CLASS_ATTRIB(
+ _, ::Graphics::Vector::float_type, length,
+ {return instance.length();},
+ {dest = DestType(instance.length()); return dest;},
+ { } // no setting
)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
// register the attributes of Cube
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Graphics::Cube)
- BOOST_MIRROR_REG_CLASS_ATTRIB(
- 0, ::Graphics::Vector,
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(
+ _, ::Graphics::Vector,
lbb
)
- BOOST_MIRROR_REG_CLASS_ATTRIB(
- 1, ::Graphics::Vector,
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(
+ _, ::Graphics::Vector,
lbf
)
- BOOST_MIRROR_REG_CLASS_ATTRIB(
- 2, ::Graphics::Vector,
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(
+ _, ::Graphics::Vector,
ltb
)
- BOOST_MIRROR_REG_CLASS_ATTRIB(
- 3, ::Graphics::Vector,
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(
+ _, ::Graphics::Vector,
ltf
)
- BOOST_MIRROR_REG_CLASS_ATTRIB(
- 4, ::Graphics::Vector,
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(
+ _, ::Graphics::Vector,
rbb
)
- BOOST_MIRROR_REG_CLASS_ATTRIB(
- 5, ::Graphics::Vector,
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(
+ _, ::Graphics::Vector,
rbf
)
- BOOST_MIRROR_REG_CLASS_ATTRIB(
- 6, ::Graphics::Vector,
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(
+ _, ::Graphics::Vector,
rtb
)
- BOOST_MIRROR_REG_CLASS_ATTRIB(
- 7, ::Graphics::Vector,
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(
+ _, ::Graphics::Vector,
rtf
)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
Modified: sandbox/mirror/libs/mirror/example/traversal/sample_meta_path.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/traversal/sample_meta_path.cpp (original)
+++ sandbox/mirror/libs/mirror/example/traversal/sample_meta_path.cpp 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
@@ -130,35 +130,35 @@
/** Class attributes
*/
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::A)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, long, l)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, long, l)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::B)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, int, i)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, int, i)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::C)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, double, d)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, double, d)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::D)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, short, s)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, short, s)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::E)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, float, f)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, float, f)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::F)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, bool, b)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, bool, b)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::G)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, char, c)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, char, c)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::H)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, wchar_t, w)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, wchar_t, w)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
} // namespace mirror
Modified: sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp (original)
+++ sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp 2008-07-08 06:42:04 EDT (Tue, 08 Jul 2008)
@@ -130,35 +130,35 @@
/** Class attributes
*/
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::A)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, long, l)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, long, l)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::B)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, int, i)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, int, i)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::C)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, double, d)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, double, d)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::D)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, short, s)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, short, s)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::E)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, float, f)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, float, f)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::F)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, bool, b)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, bool, b)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::G)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, char, c)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, char, c)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::H)
- BOOST_MIRROR_REG_CLASS_ATTRIB(0, wchar_t, w)
+ BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, wchar_t, w)
BOOST_MIRROR_REG_CLASS_ATTRIBS_END
} // namespace mirror
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