Boost logo

Boost-Commit :

From: chochlik_at_[hidden]
Date: 2008-05-01 11:43:21


Author: matus.chochlik
Date: 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
New Revision: 44976
URL: http://svn.boost.org/trac/boost/changeset/44976

Log:
- Major redesign and rewrite of certain things
- Moved the all_attributes implementation out of the meta_class
  to a separate template (placed in mirror/meta_attribs.cpp)
- Renamed the meta_type::base_type to meta_type::reflected_type
- Removed the for_each function from the meta_class::attributes
  and meta_class::all_attributes
- Added some separate algorithms working on the meta_class::attributes
  and meta_class::all_attributes including for_each and reverse_for_each
- Added some separate algorithms working on the meta_class::base_classes
  including for_each and reverse_for_each
- Added some useful functors
- Moved the reflects_*.cpp to the new traits subfolder
- Added 'position' type to the meta_inheritance template
- Updated examples to show the new features
- Added two meta_class traversal algorithms
- Added example showing class structure traversal
- Tested only with MSVC++ 2008 EE, so may fail to compile with other compilers

Added:
   sandbox/mirror/boost/mirror/algorithm/at.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/
   sandbox/mirror/boost/mirror/algorithm/detail/attribute_at.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/base_class_at.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/for_each.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/iterative.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/no_op.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/reverse_for_each.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/for_each.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/reverse_for_each.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/size.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithms.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/function/
   sandbox/mirror/boost/mirror/function/identity_op.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/function/select_base_name.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/function/select_full_name.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/functions.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/traversal.hpp (contents, props changed)
   sandbox/mirror/libs/mirror/example/traversal/
   sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp (contents, props changed)
Removed:
   sandbox/mirror/boost/mirror/reflects_class.hpp
   sandbox/mirror/boost/mirror/reflects_global_scope.hpp
   sandbox/mirror/boost/mirror/reflects_namespace.hpp
   sandbox/mirror/boost/mirror/reflects_type.hpp
   sandbox/mirror/boost/mirror/reflects_virtual_inheritance.hpp
Text files modified:
   sandbox/mirror/boost/mirror/detail/meta_attribs_base.hpp | 82 +------------------------------
   sandbox/mirror/boost/mirror/detail/meta_attribs_getset.hpp | 8 +-
   sandbox/mirror/boost/mirror/meta_attributes.hpp | 90 ++++++++++++++++++++++++++++++---
   sandbox/mirror/boost/mirror/meta_class.hpp | 9 ++-
   sandbox/mirror/boost/mirror/meta_inheritance.hpp | 17 ++++-
   sandbox/mirror/boost/mirror/meta_type.hpp | 22 ++++----
   sandbox/mirror/boost/mirror/meta_types/boost_tuple.hpp | 2
   sandbox/mirror/boost/mirror/meta_types/std_list.hpp | 2
   sandbox/mirror/boost/mirror/meta_types/std_map.hpp | 2
   sandbox/mirror/boost/mirror/meta_types/std_pair.hpp | 2
   sandbox/mirror/boost/mirror/meta_types/std_set.hpp | 2
   sandbox/mirror/boost/mirror/meta_types/std_slist.hpp | 2
   sandbox/mirror/boost/mirror/meta_types/std_vector.hpp | 2
   sandbox/mirror/boost/mirror/utils/name_to_stream/namespace.hpp | 2
   sandbox/mirror/boost/mirror/visitors/fallback.hpp | 8 +-
   sandbox/mirror/boost/mirror/visitors/sample.hpp | 105 +++++++++++++++++++++++++++++++++++++++
   sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml | 16 ++++++
   sandbox/mirror/libs/mirror/example/registering/classes.cpp | 43 ++++-----------
   sandbox/mirror/libs/mirror/example/registering/types.cpp | 2
   sandbox/mirror/libs/mirror/example/registering/virtual_bases.cpp | 36 +++---------
   sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp | 29 ++++++++--
   21 files changed, 296 insertions(+), 187 deletions(-)

Added: sandbox/mirror/boost/mirror/algorithm/at.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/at.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,71 @@
+/**
+ * \file boost/mirror/algorithm/at.hpp
+ * Gets the I-th meta-attribute/meta-inheritence/etc.
+ *
+ * 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_ALGORITHM_AT_HPP
+#define BOOST_MIRROR_ALGORITHM_AT_HPP
+
+#include <boost/mirror/algorithm/detail/attribute_at.hpp>
+#include <boost/mirror/algorithm/detail/base_class_at.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ /** Declaration of the default at_impl
+ * helper template.
+ */
+ template <class meta_object_sequence, class position>
+ struct at_impl { };
+
+ /** Specialization of at_impl<meta_object_sequence>
+ * for meta_class_attributes<>
+ */
+ template <class reflected_class, class variant_tag, class position>
+ struct at_impl<meta_class_attributes<reflected_class, variant_tag>, position >
+ : meta_attribute_at<
+ reflected_class, variant_tag,
+ meta_class_attributes<reflected_class, variant_tag>,
+ position
+ >{ };
+
+ /** Specialization of for_each_impl<meta_object_sequence>
+ * for meta_class_all_attributes<>
+ */
+ template <class reflected_class, class variant_tag, class position>
+ struct at_impl<meta_class_all_attributes<reflected_class, variant_tag>, position >
+ : meta_attribute_at<
+ reflected_class, variant_tag,
+ meta_class_all_attributes<reflected_class, variant_tag>,
+ position
+ >{ };
+
+ /** Specialization of for_each_impl<meta_object_sequence>
+ * for meta_base_classes<>
+ */
+ template <class reflected_class, class variant_tag, class position>
+ struct at_impl<meta_base_classes<reflected_class, variant_tag>, position >
+ : meta_inheritance_at<
+ meta_base_classes<reflected_class, variant_tag>,
+ position
+ >{ };
+
+} // namespace detail
+
+template <
+ class meta_object_sequence,
+ class position
+>
+struct at : detail::at_impl<meta_object_sequence, position>
+{ };
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/attribute_at.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/attribute_at.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,44 @@
+/**
+ * \file boost/mirror/algorithm/detail/attribute_at.hpp
+ * Implementation of the at algorithm
+ *
+ * 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_ALGORITHM_DETAIL_ATTRIBUTE_AT_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_ATTRIBUTE_AT_HPP
+
+// mirror common definitions
+#include <boost/mirror/common_defs.hpp>
+// forward declarations
+#include <boost/mirror/meta_data_fwd.hpp>
+// meta_class_attributes
+// meta_class_all_attributes
+#include <boost/mirror/meta_attributes.hpp>
+
+namespace boost {
+namespace mirror {
+
+namespace detail {
+
+/** Implementation of the for_each function on meta_attributes
+ */
+template <class reflected_class, class variant_tag, class meta_attributes, class position>
+struct meta_attribute_at
+{
+ typedef meta_class_attribute<
+ reflected_class, variant_tag,
+ meta_attributes,
+ position
+ > type;
+};
+
+} // namespace detail
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/base_class_at.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/base_class_at.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,43 @@
+/**
+ * \file boost/mirror/algorithm/detail/base_class_at.hpp
+ * Implementation of the at algorithm for base_classes
+ *
+ * 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_ALGORITHM_DETAIL_BASE_CLASS_AT_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_BASE_CLASS_AT_HPP
+
+// mirror common definitions
+#include <boost/mirror/common_defs.hpp>
+// forward declarations
+#include <boost/mirror/meta_data_fwd.hpp>
+// meta_class_attributes
+// meta_class_all_attributes
+#include <boost/mirror/meta_inheritance.hpp>
+
+namespace boost {
+namespace mirror {
+
+namespace detail {
+
+/** Implementation of the for_each function on meta_attributes
+ */
+template <class meta_base_classes, class position>
+struct meta_inheritance_at
+{
+ typedef typename mpl::at<
+ typename meta_base_classes::list,
+ position
+ >::type type;
+};
+
+} // namespace detail
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/for_each.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/for_each.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,67 @@
+/**
+ * \file boost/mirror/algorithm/detail/for_each.hpp
+ * Implementation of the for_each algorithm
+ *
+ * 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_ALGORITHM_DETAIL_FOR_EACH_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_FOR_EACH_HPP
+
+// mirror common definitions
+#include <boost/mirror/common_defs.hpp>
+// forward declarations
+#include <boost/mirror/meta_data_fwd.hpp>
+// mirror::at
+#include <boost/mirror/algorithm/at.hpp>
+
+namespace boost {
+namespace mirror {
+
+namespace detail {
+
+/** Implementation of the for_each function
+ */
+template <class meta_object_sequence, class sequence_size>
+struct for_each_meta_object
+{
+protected:
+ template <class meta_object_op, class transform_op, int I>
+ static inline void do_apply_to(meta_object_op op, transform_op transf, mpl::int_<I> pos)
+ {
+ typedef typename boost::mirror::at<
+ meta_object_sequence, mpl::int_<I>
+ >:: type meta_object;
+ op(transf(meta_object()));
+ }
+
+ typedef mpl::int_< -1 > begin;
+
+ template <class meta_object_op, class transform_op>
+ static inline void apply_to(meta_object_op op, transform_op transf, begin){ }
+
+ template <class meta_object_op, class transform_op, int I>
+ static inline void apply_to(meta_object_op op, transform_op transf, mpl::int_<I> pos)
+ {
+ apply_to(op, transf, mpl::int_<I - 1>()),
+ do_apply_to(op, transf, pos);
+ }
+public:
+ template <class meta_object_op, class transform_op>
+ static inline meta_object_op perform(meta_object_op op, transform_op transf)
+ {
+ typedef mpl::int_<sequence_size::value - 1> last;
+ apply_to(op, transf, last());
+ return op;
+ }
+};
+
+} // namespace detail
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/iterative.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/iterative.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,67 @@
+/**
+ * \file boost/mirror/algorithm/detail/iterative.hpp
+ * Iterative algorithms on mirror meta-object sequences
+ *
+ * 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_ALGORITHM_DETAIL_ITERATIVE_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_ITERATIVE_HPP
+
+// mirror common definitions
+#include <boost/mirror/common_defs.hpp>
+// forward declarations
+#include <boost/mirror/meta_data_fwd.hpp>
+// mirror::size
+#include <boost/mirror/algorithm/size.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ /** Declaration of the default iterative_algorithm
+ * helper template.
+ */
+ template <class meta_object_sequence, template <class, class> class algo_impl >
+ struct iterative_algorithm { };
+
+ /** Specialization of iterative_algorithm<meta_object_sequence,algo_impl>
+ * for meta_class_attributes<>
+ */
+ template <class reflected_class, class variant_tag, template <class, class> class algo_impl>
+ struct iterative_algorithm<meta_class_attributes<reflected_class, variant_tag>, algo_impl >
+ : algo_impl<
+ meta_class_attributes<reflected_class, variant_tag>,
+ size<meta_class_attributes<reflected_class, variant_tag> >
+ >{ };
+
+ /** Specialization of iterative_algorithm<meta_object_sequence,algo_impl>
+ * for meta_class_all_attributes<>
+ */
+ template <class reflected_class, class variant_tag, template <class, class> class algo_impl>
+ struct iterative_algorithm<meta_class_all_attributes<reflected_class, variant_tag>, algo_impl >
+ : algo_impl<
+ meta_class_all_attributes<reflected_class, variant_tag>,
+ size<meta_class_all_attributes<reflected_class, variant_tag> >
+ >{ };
+
+
+ /** Specialization of iterative_algorithm<meta_object_sequence,algo_impl>
+ * for meta_base_classes<>
+ */
+ template <class reflected_class, class variant_tag, template <class, class> class algo_impl>
+ struct iterative_algorithm<meta_base_classes<reflected_class, variant_tag>, algo_impl >
+ : algo_impl<
+ meta_base_classes<reflected_class, variant_tag>,
+ size<meta_base_classes<reflected_class, variant_tag> >
+ >{ };
+
+} // namespace detail
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/no_op.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/no_op.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,29 @@
+/**
+ * \file boost/mirror/algorithm/detail/no_op.hpp
+ * Dummy no-op functor
+ *
+ * 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_ALGORITHM_DETAIL_NO_OP_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_NO_OP_HPP
+
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+struct no_op
+{
+ template <typename arg_type>
+ inline arg_type operator()(arg_type arg){return arg;}
+};
+
+} // namespace detail
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/reverse_for_each.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/reverse_for_each.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,66 @@
+/**
+ * \file boost/mirror/algorithm/detail/reverse_for_each.hpp
+ * Implementation of the reverse_for_each algorithm
+ *
+ * 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_ALGORITHM_DETAIL_REVERSE_FOR_EACH_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_REVERSE_FOR_EACH_HPP
+
+// mirror common definitions
+#include <boost/mirror/common_defs.hpp>
+// forward declarations
+#include <boost/mirror/meta_data_fwd.hpp>
+// mirror::at
+#include <boost/mirror/algorithm/at.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+/** Implementation of the for_each function
+ */
+template <class meta_object_sequence, class sequence_size>
+struct reverse_for_each_meta_object
+{
+protected:
+ template <class meta_object_op, class transform_op, int I>
+ static void do_apply_to(meta_object_op op, transform_op transf, mpl::int_<I> pos)
+ {
+ typedef typename boost::mirror::at<
+ meta_object_sequence, mpl::int_<I>
+ >:: type meta_object;
+ op(transf(meta_object()));
+ }
+
+ typedef typename mpl::int_<sequence_size::value> end;
+
+ template <class meta_object_op, class transform_op>
+ static void apply_to(meta_object_op op, transform_op transf, end){ }
+
+ template <class meta_object_op, class transform_op, int I>
+ static void apply_to(meta_object_op op, transform_op transf, mpl::int_<I> pos)
+ {
+ apply_to(op, transf, mpl::int_<I + 1>()),
+ do_apply_to(op, transf, pos);
+ }
+public:
+ template <class meta_object_op, class transform_op>
+ static meta_object_op perform(meta_object_op op, transform_op transf)
+ {
+ typedef mpl::int_<0> first;
+ apply_to(op, transf, first());
+ return op;
+ }
+};
+
+} // namespace detail
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/for_each.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/for_each.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,54 @@
+/**
+ * \file boost/mirror/algorithm/for_each.hpp
+ * Run-time application of a functor to all base_classes/attributes/etc.
+ *
+ * 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_ALGORITHM_FOR_EACH_HPP
+#define BOOST_MIRROR_ALGORITHM_FOR_EACH_HPP
+
+#include <boost/mirror/algorithm/detail/for_each.hpp>
+#include <boost/mirror/algorithm/detail/iterative.hpp>
+#include <boost/mirror/algorithm/detail/no_op.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ /** Declaration of the default for_each_impl
+ * helper template.
+ */
+ template <class meta_object_sequence>
+ struct for_each_impl
+ : iterative_algorithm<meta_object_sequence, for_each_meta_object>
+ { };
+
+} // namespace detail
+
+template <
+ class meta_object_sequence,
+ class functor
+>
+static inline functor for_each(functor fn)
+{
+ return detail::for_each_impl<meta_object_sequence> ::perform(fn, detail::no_op());
+}
+
+template <
+ class meta_object_sequence,
+ class transform_op,
+ class functor
+>
+static inline functor for_each(transform_op transf, functor fn)
+{
+ return detail::for_each_impl<meta_object_sequence> ::perform(fn, transf);
+}
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/reverse_for_each.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/reverse_for_each.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,54 @@
+/**
+ * \file boost/mirror/algorithm/reverse_for_each.hpp
+ * Run-time application of a functor to all base_classes/attributes/etc.
+ *
+ * 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_ALGORITHM_REVERSE_FOR_EACH_HPP
+#define BOOST_MIRROR_ALGORITHM_REVERSE_FOR_EACH_HPP
+
+#include <boost/mirror/algorithm/detail/reverse_for_each.hpp>
+#include <boost/mirror/algorithm/detail/iterative.hpp>
+#include <boost/mirror/algorithm/detail/no_op.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ /** Declaration of the default for_each_impl
+ * helper template.
+ */
+ template <class meta_object_sequence>
+ struct reverse_for_each_impl
+ : iterative_algorithm<meta_object_sequence, reverse_for_each_meta_object>
+ { };
+
+} // namespace detail
+
+template <
+ class meta_object_sequence,
+ class functor
+>
+static functor reverse_for_each(functor fn)
+{
+ return detail::reverse_for_each_impl<meta_object_sequence> ::perform(fn, detail::no_op());
+}
+
+template <
+ class meta_object_sequence,
+ class transform_op,
+ class functor
+>
+static functor reverse_for_each(transform_op transf, functor fn)
+{
+ return detail::reverse_for_each_impl<meta_object_sequence> ::perform(fn, transf);
+}
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/size.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/size.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,68 @@
+/**
+ * \file boost/mirror/algorithm/size.hpp
+ * Gets count of meta-attributes/meta-inheritences/etc.
+ *
+ * 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_ALGORITHM_SIZE_HPP
+#define BOOST_MIRROR_ALGORITHM_SIZE_HPP
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ /** Declaration of the default at_impl
+ * helper template.
+ */
+ template <class meta_object_sequence>
+ struct size_impl { };
+
+ /** Specialization of at_impl<meta_object_sequence>
+ * for meta_class_attributes<>
+ */
+ template <class reflected_class, class variant_tag>
+ struct size_impl<meta_class_attributes<reflected_class, variant_tag> >
+ : mpl::size<
+ typename meta_class_attributes<
+ reflected_class,
+ variant_tag
+ >::type_list
+ >{ };
+
+ /** Specialization of for_each_impl<meta_object_sequence>
+ * for meta_class_all_attributes<>
+ */
+ template <class reflected_class, class variant_tag>
+ struct size_impl<meta_class_all_attributes<reflected_class, variant_tag> >
+ : mpl::size<
+ typename meta_class_all_attributes<
+ reflected_class,
+ variant_tag
+ >::type_list
+ >{ };
+
+ /** Specialization of for_each_impl<meta_object_sequence>
+ * for meta_base_classes<>
+ */
+ template <class reflected_class, class variant_tag>
+ struct size_impl<meta_base_classes<reflected_class, variant_tag> >
+ : mpl::size<
+ typename meta_base_classes<
+ reflected_class,
+ variant_tag
+ >::list
+ >{ };
+
+} // namespace detail
+
+template <class meta_object_sequence>
+struct size : detail::size_impl<meta_object_sequence> { };
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithms.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithms.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,23 @@
+/**
+ * \file boost/mirror/algorithms.hpp
+ * Includes all mirror algorithms
+ *
+ * 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_ALGORITHMS_HPP
+#define BOOST_MIRROR_ALGORITHMS_HPP
+
+#include <boost/mirror/algorithm/for_each.hpp>
+#include <boost/mirror/algorithm/reverse_for_each.hpp>
+
+namespace boost {
+namespace mirror {
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

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-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -1,5 +1,5 @@
 /**
- * \file boost/mirror/meta_attribs_simple.hpp
+ * \file boost/mirror/detail/meta_attribs_base.hpp
  * Registering and reflection of simple class attributes
  *
  * Copyright 2008 Matus Chochlik. Distributed under the Boost
@@ -7,8 +7,8 @@
  * 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
+#ifndef BOOST_MIRROR_DETAIL_META_ATTRIBS_BASE_HPP
+#define BOOST_MIRROR_DETAIL_META_ATTRIBS_BASE_HPP
 
 // mirror common definitions
 #include <boost/mirror/common_defs.hpp>
@@ -28,72 +28,10 @@
 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;
 };
@@ -103,10 +41,6 @@
  */
 #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<>
@@ -120,16 +54,6 @@
                 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; \

Modified: sandbox/mirror/boost/mirror/detail/meta_attribs_getset.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/meta_attribs_getset.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/meta_attribs_getset.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -1,5 +1,5 @@
 /**
- * \file boost/mirror/meta_attributes.hpp
+ * \file boost/mirror/detail/meta_attribs_getset.hpp
  * Mscros for declaring meta attributes accessed through getters/setters
  *
  * Copyright 2008 Matus Chochlik. Distributed under the Boost
@@ -7,11 +7,11 @@
  * 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
+#ifndef BOOST_MIRROR_DETAIL_META_ATTRIBS_GETSET_HPP
+#define BOOST_MIRROR_DETAIL_META_ATTRIBS_GETSET_HPP
 
 // macros for declaration of simple meta attributes
-#include <boost/mirror/meta_attribs_base.hpp>
+#include <boost/mirror/detail/meta_attribs_base.hpp>
 //
 // necessary preprocessor macros
 #include <boost/preprocessor/tuple/to_list.hpp>

Added: sandbox/mirror/boost/mirror/function/identity_op.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/function/identity_op.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,30 @@
+/**
+ * \file boost/mirror/function/identity_op.hpp
+ *
+ * Functor that just returns its single argument.
+ *
+ * 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_FUNCTION_IDENTITY_OP_HPP
+#define BOOST_MIRROR_FUNCTION_IDENTITY_OP_HPP
+
+namespace boost {
+namespace mirror {
+
+struct identity_op
+{
+ template <class argument_type>
+ inline argument_type operator()(argument_type arg)
+ {
+ return arg;
+ }
+};
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/function/select_base_name.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/function/select_base_name.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,30 @@
+/**
+ * \file boost/mirror/function/select_base_name.hpp
+ * Functor that returns the base_name when given an
+ * appropriate meta-object.
+ *
+ * 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_FUNCTION_SELECT_BASE_NAME_HPP
+#define BOOST_MIRROR_FUNCTION_SELECT_BASE_NAME_HPP
+
+namespace boost {
+namespace mirror {
+
+struct select_base_name
+{
+ template <class meta_object>
+ inline const bchar* operator()(meta_object)
+ {
+ return meta_object::base_name();
+ }
+};
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/function/select_full_name.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/function/select_full_name.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,30 @@
+/**
+ * \file boost/mirror/function/select_full_name.hpp
+ * Functor that returns the full_name when given an
+ * appropriate meta-object.
+ *
+ * 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_FUNCTION_SELECT_FULL_NAME_HPP
+#define BOOST_MIRROR_FUNCTION_SELECT_FULL_NAME_HPP
+
+namespace boost {
+namespace mirror {
+
+struct select_full_name
+{
+ template <class meta_object>
+ inline const bchar* operator()(meta_object)
+ {
+ return meta_object::full_name();
+ }
+};
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/functions.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/functions.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,24 @@
+/**
+ * \file boost/mirror/functions.hpp
+ * Includes all mirror special functions
+ *
+ * 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_FUNCTIONS_HPP
+#define BOOST_MIRROR_FUNCTIONS_HPP
+
+#include <boost/mirror/function/identity_op.hpp>
+#include <boost/mirror/function/select_base_name.hpp>
+#include <boost/mirror/function/select_full_name.hpp>
+
+namespace boost {
+namespace mirror {
+
+} // 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 11:43:18 EDT (Thu, 01 May 2008)
@@ -22,10 +22,13 @@
          * but allows to work with all member attributes including
          * the inherited ones.
          */
- template <class meta_class>
+ template <
+ class _reflected_type,
+ class _variant_tag
+ >
         struct meta_class_all_attributes
- : detail::meta_class_attrib_utils<meta_class, meta_class_all_attributes<meta_class> >
         {
+ typedef meta_class<_reflected_type, _variant_tag> meta_class;
                 /** This struct "hides" the internal helpers
                  */
                 struct detail
@@ -58,7 +61,7 @@
                         {
                                 typedef typename
                                         meta_inheritance::
- meta_class::
+ meta_base_class::
                                         all_attributes::
                                         detail::
                                         regular_base_class_layout type;
@@ -92,7 +95,7 @@
                         {
                                 typedef typename
                                         meta_inheritance::
- meta_class::
+ meta_base_class::
                                         all_attributes::
                                         detail::
                                         virtual_base_class_layout type;
@@ -107,7 +110,7 @@
                         {
                                 typedef typename
                                         meta_inheritance::
- meta_class::
+ meta_base_class::
                                         all_attributes::
                                         detail::
                                         base_class_layout type;
@@ -172,7 +175,7 @@
                         struct get_base_class_attrib_type_list
                         {
                                 typedef typename meta_inheritance::
- meta_class::
+ meta_base_class::
                                                 attributes::
                                                 type_list type;
                         };
@@ -216,9 +219,9 @@
                         struct get_base_class_attrib_owner_and_offs
                         {
                                 typedef typename meta_inheritance::
- meta_class base_meta_class;
+ meta_base_class meta_base_class;
 
- typedef typename base_meta_class::
+ typedef typename meta_base_class::
                                                 attributes::
                                                 type_list type_list;
 
@@ -226,7 +229,7 @@
                                                 current_list
>::type offset;
                                 typedef typename mpl::pair<
- base_meta_class,
+ meta_base_class,
                                                 offset
> pair;
                                 
@@ -475,8 +478,77 @@
                 }
         }; // all_attributes
 
+namespace detail {
+ /** Instances of this template are used to store information
+ * about single class' member attribute and are used mainly
+ * in the algorithms.
+ */
+ template <
+ class _reflected_type,
+ class _variant_tag,
+ class _meta_attributes,
+ class _attrib_pos
+ >
+ struct meta_class_attribute
+ {
+ // the meta-class for the class to which
+ // the attribute belongs
+ typedef meta_class<_reflected_type, _variant_tag> meta_class;
+
+ // the meta-attributes list (own/all)
+ // into which the attribute belongs
+ // in this context
+ typedef _meta_attributes meta_attributes;
+
+ // the position of the meta-attribute in the context
+ typedef _attrib_pos position;
+
+ // the type of the attribute
+ typedef typename mpl::at<
+ typename meta_attributes::type_list,
+ position
+ >::type type;
+
+ // base name getter
+ static const bchar* base_name(void)
+ {
+ return meta_attributes::base_name(position());
+ }
+
+ // full name getter
+ static const bchar* full_name(void)
+ {
+ return meta_attributes::full_name(position());
+ }
+
+ typedef typename meta_class::reflected_type reflected_class;
 
+ // value getter
+ static typename call_traits<type>::param_type
+ get(const reflected_class& context)
+ {
+ return meta_attributes::get(context, position());
+ }
+
+ // value query
+ template <typename dest_type>
+ static dest_type& query(const reflected_class& context, dest_type& dest)
+ {
+ return meta_attributes::query(context, position(), dest);
+ }
 
+ // value setter
+ static void set(reflected_class& context, typename call_traits<type>::param_type val)
+ {
+ meta_attributes::set(context, position(), val);
+ }
+ // value setter
+ static void set(const reflected_class& context, typename call_traits<type>::param_type val)
+ {
+ meta_attributes::set(context, position(), val);
+ }
+ };
+} // namespace detail
 } // 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 11:43:18 EDT (Thu, 01 May 2008)
@@ -28,7 +28,7 @@
 // reflection of class inheritance
 #include <boost/mirror/meta_inheritance.hpp>
 // inheritance trait
-#include <boost/mirror/reflects_virtual_inheritance.hpp>
+#include <boost/mirror/traits/reflects_virtual_inheritance.hpp>
 // reflection of class member attributes
 #include <boost/mirror/meta_attributes.hpp>
 
@@ -44,6 +44,7 @@
>
 struct meta_class : public meta_type<reflected_class>
 {
+
         /** The base classes of a class.
          * The member base_classes::list is a mpl::vector of
          * meta_inheritance<> specializations, one for every
@@ -51,7 +52,7 @@
          */
         typedef meta_base_classes<reflected_class, variant_tag> base_classes;
 
- /** The member attributes of the class (not includeing the inherited
+ /** The member attributes of the class (not including the inherited
          * member attribs.
          * The attributes::type_list is a mpl::vector of types
          * of the attributes.
@@ -68,7 +69,9 @@
         typedef meta_class_attributes<reflected_class, variant_tag>
                 attributes;
 
- typedef meta_class_all_attributes<meta_class<reflected_class, variant_tag> >
+ /** Same as attributes but containing also the inherited attributes
+ */
+ typedef meta_class_all_attributes<reflected_class, variant_tag >
                 all_attributes;
 };
 

Modified: sandbox/mirror/boost/mirror/meta_inheritance.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_inheritance.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_inheritance.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -35,7 +35,7 @@
         typedef inheritance_spec inheritance_specifier;
         typedef access_spec access_specifier;
         typedef the_base_class base_class;
- typedef BOOST_MIRROR_REFLECT_CLASS(the_base_class) meta_class;
+ typedef BOOST_MIRROR_REFLECT_CLASS(the_base_class) meta_base_class;
 };
 
 /** This template stores the inheritance type and access specifier
@@ -117,7 +117,8 @@
  * of a base class for a derived class
  */
 template <
- class the_base_class,
+ class base_class_position,
+ class the_base_class,
         typename access_spec,
         typename inheritance_spec = nonvirtual_base_
>
@@ -126,7 +127,10 @@
         the_base_class,
         access_spec,
         inheritance_spec
->{ };
+>
+{
+ typedef base_class_position position;
+};
 
 /** Default (empty) list of base classes of a meta_class
  */
@@ -158,6 +162,7 @@
 #define BOOST_MIRROR_REG_BASE_CLASS_SIMPLE(NUMBER, A_BASE_CLASS) \
         BOOST_PP_COMMA_IF(NUMBER) \
         meta_inheritance<\
+ mpl::int_<NUMBER>, \
                 A_BASE_CLASS, \
                 class_kind_default_access<\
                         meta_class_kind< A_BASE_CLASS >::result \
@@ -170,7 +175,8 @@
  * zero, declarations must be ordered by number.
  */
 #define BOOST_MIRROR_REG_BASE_CLASS(NUMBER, ACCESS_SPEC, A_BASE_CLASS) \
- BOOST_PP_COMMA_IF(NUMBER) meta_inheritance<A_BASE_CLASS, ACCESS_SPEC##_>
+ BOOST_PP_COMMA_IF(NUMBER) \
+ meta_inheritance<mpl::int_<NUMBER>, A_BASE_CLASS, ACCESS_SPEC##_>
 
 /** This macro declares that the A_BASE_CLASS class is the i-th
  * base class of the given class, with the given access specifier
@@ -178,7 +184,8 @@
  * zero, declarations must be ordered by number.
  */
 #define BOOST_MIRROR_REG_BASE_CLASS_VIRTUAL(NUMBER, ACCESS_SPEC, A_BASE_CLASS) \
- BOOST_PP_COMMA_IF(NUMBER) meta_inheritance<A_BASE_CLASS, ACCESS_SPEC##_, virtual_base_>
+ BOOST_PP_COMMA_IF(NUMBER) \
+ meta_inheritance<mpl::int_<NUMBER>, A_BASE_CLASS, ACCESS_SPEC##_, virtual_base_>
 
 /** This macro finishes the declaration of base classes
  * of the given class

Modified: sandbox/mirror/boost/mirror/meta_type.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_type.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_type.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -79,7 +79,7 @@
         template <> struct meta_type< NAMESPACE::BASE_NAME > \
         { \
                 typedef BOOST_MIRROR_REFLECT_NAMESPACE(NAMESPACE_ALIAS) scope; \
- typedef NAMESPACE::BASE_NAME base_type; \
+ typedef NAMESPACE::BASE_NAME reflected_type; \
                 static const bchar* base_name(void) {return BOOST_STR_LIT(#BASE_NAME);}\
                 BOOST_STATIC_CONSTANT( \
                         int, \
@@ -99,7 +99,7 @@
         ) > \
         { \
                 typedef BOOST_MIRROR_REFLECT_NAMESPACE(NAMESPACE_ALIAS) scope; \
- typedef NAMESPACE::TYPEDEFD_NAME base_type; \
+ typedef NAMESPACE::TYPEDEFD_NAME reflected_type; \
                 static const bchar* base_name(void) {return BOOST_STR_LIT(#TYPEDEFD_NAME);}\
                 BOOST_STATIC_CONSTANT( \
                         int, \
@@ -115,7 +115,7 @@
         template <> struct meta_type< BASE_NAME > \
         { \
                 typedef BOOST_MIRROR_REFLECT_NAMESPACE(_) scope; \
- typedef BASE_NAME base_type; \
+ typedef BASE_NAME reflected_type; \
                 static const bchar* base_name(void) {return BOOST_STR_LIT(#BASE_NAME);}\
                 BOOST_STATIC_CONSTANT( \
                         int, \
@@ -133,7 +133,7 @@
         template <> struct meta_type< WRAPPER::BASE_NAME > \
         { \
                 typedef meta_class< WRAPPER > scope; \
- typedef WRAPPER::BASE_NAME base_type; \
+ typedef WRAPPER::BASE_NAME reflected_type; \
                 static const bchar* base_name(void) {return BOOST_STR_LIT(#BASE_NAME);}\
                 BOOST_STATIC_CONSTANT( \
                         int, \
@@ -193,7 +193,7 @@
>
 {
         typedef typename meta_type<pointee_type>::scope scope;
- typedef pointee_type* base_type;
+ typedef pointee_type* reflected_type;
 };
 
 /** Meta-types for arrays
@@ -204,7 +204,7 @@
>
 {
         typedef typename meta_type<element_type>::scope scope;
- typedef element_type base_type[size];
+ typedef element_type reflected_type[size];
 };
 
 template <class element_type, size_t size>
@@ -213,7 +213,7 @@
>
 {
         typedef typename meta_type<element_type>::scope scope;
- typedef element_type base_type[size];
+ typedef element_type reflected_type[size];
 };
 
 /** Meta-types for references
@@ -224,7 +224,7 @@
>
 {
         typedef typename meta_type<refered_to_type>::scope scope;
- typedef refered_to_type& base_type;
+ typedef refered_to_type& reflected_type;
 };
 
 /** Meta-types for const types
@@ -235,7 +235,7 @@
>
 {
         typedef typename meta_type<non_const_type>::scope scope;
- typedef const non_const_type base_type;
+ typedef const non_const_type reflected_type;
 };
 
 /** Meta-types for volatile types
@@ -246,7 +246,7 @@
>
 {
         typedef typename meta_type<non_volatile_type>::scope scope;
- typedef volatile non_volatile_type base_type;
+ typedef volatile non_volatile_type reflected_type;
 };
 
 /** Meta-types for const volatile types
@@ -257,7 +257,7 @@
>
 {
         typedef typename meta_type<non_cv_type>::scope scope;
- typedef const volatile non_cv_type base_type;
+ typedef const volatile non_cv_type reflected_type;
 };
 
 

Modified: sandbox/mirror/boost/mirror/meta_types/boost_tuple.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_types/boost_tuple.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_types/boost_tuple.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -66,7 +66,7 @@
         typedef BOOST_MIRROR_REFLECT_NAMESPACE(_boost_tuples) scope;
         typedef ::boost::tuples::tuple<
                 BOOST_MIRROR_TMP_BOOST_TUPLE_TEMPL_ARG_NAMES()
- > base_type;
+ > reflected_type;
 };
 
 // undefine the helper macros

Modified: sandbox/mirror/boost/mirror/meta_types/std_list.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_types/std_list.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_types/std_list.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -41,7 +41,7 @@
>
 {
         typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
- typedef ::std::list<T, Allocator> base_type;
+ typedef ::std::list<T, Allocator> reflected_type;
 };
 
 

Modified: sandbox/mirror/boost/mirror/meta_types/std_map.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_types/std_map.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_types/std_map.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -41,7 +41,7 @@
>
 {
         typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
- typedef ::std::map<K, T, Comp, Allocator> base_type;
+ typedef ::std::map<K, T, Comp, Allocator> reflected_type;
 };
 
 

Modified: sandbox/mirror/boost/mirror/meta_types/std_pair.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_types/std_pair.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_types/std_pair.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -42,7 +42,7 @@
>
 {
         typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
- typedef ::std::pair<first_type, second_type> base_type;
+ typedef ::std::pair<first_type, second_type> reflected_type;
 };
 
 

Modified: sandbox/mirror/boost/mirror/meta_types/std_set.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_types/std_set.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_types/std_set.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -41,7 +41,7 @@
>
 {
         typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
- typedef ::std::set<K, Comp, Allocator> base_type;
+ typedef ::std::set<K, Comp, Allocator> reflected_type;
 };
 
 

Modified: sandbox/mirror/boost/mirror/meta_types/std_slist.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_types/std_slist.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_types/std_slist.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -41,7 +41,7 @@
>
 {
         typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
- typedef ::std::slist<T, Allocator> base_type;
+ typedef ::std::slist<T, Allocator> reflected_type;
 };
 
 

Modified: sandbox/mirror/boost/mirror/meta_types/std_vector.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_types/std_vector.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_types/std_vector.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -41,7 +41,7 @@
>
 {
         typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
- typedef ::std::vector<T, Allocator> base_type;
+ typedef ::std::vector<T, Allocator> reflected_type;
 };
 
 

Deleted: sandbox/mirror/boost/mirror/reflects_class.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/reflects_class.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
+++ (empty file)
@@ -1,32 +0,0 @@
-/**
- * \file boost/mirror/reflects_class.hpp
- * Meta function that returns true if the given meta-object
- * reflects a class
- *
- * 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_REFLECTS_CLASS_HPP
-#define BOOST_MIRROR_META_REFLECTS_CLASS_HPP
-
-// true type/false type for trait templates
-#include <boost/type_traits/integral_constant.hpp>
-#include <boost/mirror/meta_class.hpp>
-
-namespace boost {
-namespace mirror {
-
-template <class meta_object>
-struct reflects_class : public false_type{ };
-
-template <class base_class>
-struct reflects_class<meta_class<base_class> > : public true_type{ };
-
-
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Deleted: sandbox/mirror/boost/mirror/reflects_global_scope.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/reflects_global_scope.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
+++ (empty file)
@@ -1,35 +0,0 @@
-/**
- * \file boost/mirror/reflects_global_scope.hpp
- * Meta function that returns true if the given meta_namespace
- * reflects the global scope
- *
- * 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_REFLECTS_GLOBAL_SCOPE_HPP
-#define BOOST_MIRROR_META_REFLECTS_GLOBAL_SCOPE_HPP
-
-// true type/false type for trait templates
-#include <boost/type_traits/integral_constant.hpp>
-
-namespace boost {
-namespace mirror {
-
-/** Reflects-global-scope trait template for other meta-namespaces
- */
-template <class meta_namespace>
-struct reflects_global_scope : public false_type{ };
-
-/** Reflects-global-scope trait specialization for global scope meta_namespace
- */
-template <>
-struct reflects_global_scope<BOOST_MIRROR_REFLECT_NAMESPACE(_)> : public true_type{ };
-
-
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Deleted: sandbox/mirror/boost/mirror/reflects_namespace.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/reflects_namespace.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
+++ (empty file)
@@ -1,32 +0,0 @@
-/**
- * \file boost/mirror/reflects_namespace.hpp
- * Meta function that returns true if the given meta-object
- * reflects a namespace
- *
- * 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_REFLECTS_NAMESPACE_HPP
-#define BOOST_MIRROR_META_REFLECTS_NAMESPACE_HPP
-
-// true type/false type for trait templates
-#include <boost/type_traits/integral_constant.hpp>
-#include <boost/mirror/meta_namespace.hpp>
-
-namespace boost {
-namespace mirror {
-
-template <class meta_object>
-struct reflects_namespace : public false_type{ };
-
-template <class namespace_alias>
-struct reflects_namespace<meta_namespace<namespace_alias> > : public true_type{ };
-
-
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Deleted: sandbox/mirror/boost/mirror/reflects_type.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/reflects_type.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
+++ (empty file)
@@ -1,36 +0,0 @@
-/**
- * \file boost/mirror/reflects_types.hpp
- * Meta function that returns true if the given meta-object
- * reflects a type
- *
- * 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_REFLECTS_TYPE_HPP
-#define BOOST_MIRROR_META_REFLECTS_TYPE_HPP
-
-// true type/false type for trait templates
-#include <boost/type_traits/integral_constant.hpp>
-#include <boost/mirror/meta_type.hpp>
-
-namespace boost {
-namespace mirror {
-
-template <class meta_object>
-struct reflects_type : public false_type{ };
-
-template <class base_type>
-struct reflects_type<meta_type<base_type> > : public true_type{ };
-
-
-template <class base_class>
-struct reflects_type<meta_class<base_class> > : public true_type{ };
-
-
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Deleted: sandbox/mirror/boost/mirror/reflects_virtual_inheritance.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/reflects_virtual_inheritance.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
+++ (empty file)
@@ -1,53 +0,0 @@
-/**
- * \file boost/mirror/reflects_virtual_inheritance.hpp
- * Meta function that returns true if the given meta-inheritance
- * reflects virtual inheritance.
- *
- * 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_REFLECTS_VIRTUAL_INHERITANCE_HPP
-#define BOOST_MIRROR_META_REFLECTS_VIRTUAL_INHERITANCE_HPP
-
-// true type/false type for trait templates
-#include <boost/type_traits/integral_constant.hpp>
-#include <boost/mirror/meta_inheritance.hpp>
-
-namespace boost {
-namespace mirror {
-
-template <class meta_object>
-struct reflects_virtual_inheritance;
-
-template <
- class base_class,
- typename access_spec
->
-struct reflects_virtual_inheritance<
- meta_inheritance<
- base_class,
- access_spec,
- virtual_base_
- >
-> : public true_type{ };
-
-template <
- class base_class,
- typename access_spec
->
-struct reflects_virtual_inheritance<
- meta_inheritance<
- base_class,
- access_spec,
- nonvirtual_base_
- >
-> : public false_type{ };
-
-
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Added: sandbox/mirror/boost/mirror/traversal.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/traversal.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,113 @@
+/**
+ * \file boost/mirror/traversal.hpp
+ * Traversal of meta classes by a visitor
+ *
+ * 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_TRAVERSAL_HPP
+#define BOOST_MIRROR_TRAVERSAL_HPP
+
+#include <boost/mirror/meta_class.hpp>
+#include <boost/mirror/algorithm/for_each.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ template <class meta_class>
+ struct traversal_utils
+ {
+ protected:
+ template <class visitor_type>
+ class attribute_traversal
+ {
+ public:
+ attribute_traversal(visitor_type _visitor)
+ : visitor(_visitor){ }
+
+ template <class meta_attribute>
+ void operator ()(meta_attribute ma)
+ {
+ visitor.enter_attribute(ma);
+ deep_traversal_of<
+ BOOST_MIRROR_REFLECT_CLASS(meta_attribute::type)
+ >::accept(visitor);
+ visitor.leave_attribute(ma);
+ }
+ private:
+ visitor_type visitor;
+ };
+
+ template <class visitor_type>
+ static inline attribute_traversal<visitor_type>
+ show_attribs_to(visitor_type visitor)
+ {
+ return attribute_traversal<visitor_type>(visitor);
+ }
+
+ template <class visitor_type>
+ class base_class_traversal
+ {
+ public:
+ base_class_traversal(visitor_type _visitor)
+ : visitor(_visitor){ }
+
+ template <class meta_inheritance>
+ void operator ()(meta_inheritance mbc)
+ {
+ visitor.enter_base_class(mbc);
+ deep_traversal_of<
+ meta_inheritance::meta_base_class
+ >::accept(visitor);
+ visitor.leave_base_class(mbc);
+ }
+ private:
+ visitor_type visitor;
+ };
+
+ template <class visitor_type>
+ static inline base_class_traversal<visitor_type>
+ show_bases_to(visitor_type visitor)
+ {
+ return base_class_traversal<visitor_type>(visitor);
+ }
+ };
+
+
+} // namespace detail
+
+template <class meta_class>
+struct deep_traversal_of : detail::traversal_utils<meta_class>
+{
+ template <class visitor_type>
+ static void accept(visitor_type visitor)
+ {
+ meta_class mc;
+ visitor.enter_type(mc);
+ for_each<meta_class::base_classes>(show_bases_to(visitor));
+ for_each<meta_class::attributes>(show_attribs_to(visitor));
+ visitor.leave_type(mc);
+ }
+};
+
+template <class meta_class>
+struct flat_traversal_of : detail::traversal_utils<meta_class>
+{
+ template <class visitor_type>
+ static void accept(visitor_type visitor)
+ {
+ meta_class mc;
+ visitor.enter_type(mc);
+ for_each<meta_class::all_attributes>(show_attribs_to(visitor));
+ visitor.leave_type(mc);
+ }
+};
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Modified: sandbox/mirror/boost/mirror/utils/name_to_stream/namespace.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/utils/name_to_stream/namespace.hpp (original)
+++ sandbox/mirror/boost/mirror/utils/name_to_stream/namespace.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -14,7 +14,7 @@
 #include <boost/mirror/utils/name_to_stream/common.hpp>
 // meta namespaces (includes boost/char_type_switch/string.hpp)
 #include <boost/mirror/meta_namespace.hpp>
-#include <boost/mirror/reflects_global_scope.hpp>
+#include <boost/mirror/traits/reflects_global_scope.hpp>
 
 namespace boost {
 namespace mirror {

Modified: sandbox/mirror/boost/mirror/visitors/fallback.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/visitors/fallback.hpp (original)
+++ sandbox/mirror/boost/mirror/visitors/fallback.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -20,9 +20,11 @@
 
 struct fallback_visitor
 {
- // visitation of the
- template <typename base_type, typename meta_type>
- void visit_instance(const meta_type& meta_data, base_type& instance, const bchar* name){ }
+ template <class meta_class>
+ void enter_type(meta_class){ }
+
+ template <class meta_class>
+ void leave_type(meta_class){ }
 };
 
 } // namespace mirror

Modified: sandbox/mirror/boost/mirror/visitors/sample.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/visitors/sample.hpp (original)
+++ sandbox/mirror/boost/mirror/visitors/sample.hpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -13,13 +13,116 @@
 // meta namespaces (includes boost/char_type_switch/string.hpp)
 #include <boost/mirror/meta_namespace.hpp>
 // meta types
-#include <boost/mirror/meta_type.hpp>
+#include <boost/mirror/meta_class.hpp>
+// traits
+#include <boost/mirror/traits/reflects_virtual_inheritance.hpp>
+#include <boost/mirror/traits/reflects_global_scope.hpp>
 // the base fallback visitor implementation
 #include <boost/mirror/visitors/fallback.hpp>
 
 namespace boost {
 namespace mirror {
 
+class sample_visitor : public fallback_visitor
+{
+public:
+ sample_visitor(void):indent(0){ }
+
+ // enter a class/type
+ template <class meta_class>
+ void enter_type(meta_class)
+ {
+ using namespace ::std;
+ using namespace ::boost;
+ print_indentation();
+ ++indent;
+ bcout <<
+ "<type name='" <<
+ meta_class::base_name();
+ if(!reflects_global_scope<meta_class::scope>::value)
+ {
+ bcout <<
+ "' scope='" <<
+ meta_class::scope::full_name();
+ }
+ bcout <<
+ "'>" <<
+ endl;
+ }
+
+ // leave the class/type
+ template <class meta_class>
+ void leave_type(meta_class)
+ {
+ using namespace ::std;
+ using namespace ::boost;
+ --indent;
+ print_indentation();
+ bcout << "</type>" << endl;
+ }
+
+ // enter a base class
+ template <class meta_inheritance>
+ void enter_base_class(meta_inheritance)
+ {
+ using namespace ::std;
+ using namespace ::boost;
+ print_indentation();
+ ++indent;
+ bcout <<
+ "<base_class number='" <<
+ meta_inheritance::position::value <<
+ "' is_virtual='"<<
+ (reflects_virtual_inheritance<meta_inheritance>::value ? "true" : "false") <<
+ "'>" <<
+ endl;
+ }
+
+ // leave base class
+ template <class meta_class>
+ void leave_base_class(meta_class)
+ {
+ using namespace ::std;
+ using namespace ::boost;
+ --indent;
+ print_indentation();
+ bcout << "</base_class>" << endl;
+ }
+
+ template <class meta_attribute>
+ void enter_attribute(meta_attribute)
+ {
+ using namespace ::std;
+ using namespace ::boost;
+ print_indentation();
+ ++indent;
+ bcout <<
+ "<attribute number='" <<
+ meta_attribute::position::value <<
+ "' name='" <<
+ meta_attribute::base_name() <<
+ "'>" <<
+ endl;
+ }
+
+ template <class meta_attribute>
+ void leave_attribute(meta_attribute)
+ {
+ using namespace ::std;
+ using namespace ::boost;
+ --indent;
+ print_indentation();
+ bcout << "</attribute>" << endl;
+ }
+private:
+ int indent;
+ void print_indentation(void)
+ {
+ for(int i=0;i!=indent;++i)
+ bcout << ' ';
+ }
+};
+
 
 } // namespace mirror
 } // namespace boost

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 11:43:18 EDT (Thu, 01 May 2008)
@@ -100,8 +100,24 @@
                           macro.
                 </revision>
                 <revision id="20080501" major="0" minor="1" micro="16" author="m_ch">
+ - Major redesign and rewrite of certain things
                         - Moved the all_attributes implementation out of the meta_class
                           to a separate template (placed in mirror/meta_attribs.cpp)
+ - Renamed the meta_type::base_type to meta_type::reflected_type
+ - Removed the for_each function from the meta_class::attributes
+ and meta_class::all_attributes
+ - Added some separate algorithms working on the meta_class::attributes
+ and meta_class::all_attributes including for_each and reverse_for_each
+ - Added some separate algorithms working on the meta_class::base_classes
+ including for_each and reverse_for_each
+ - Added some useful functors
+ - Moved the reflects_*.cpp to the new traits subfolder
+ - Added 'position' type to the meta_inheritance template
+ - Updated examples to show the new features
+ - Added two meta_class traversal algorithms
+ - Added example showing class structure traversal
+ - Tested only with MSVC++ 2008 EE, so may fail to compile with other compilers
+
                 </revision>
         </revisions>
 </library>

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-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -25,11 +25,12 @@
 #include <boost/mirror/meta_class.hpp>
 
 #include <boost/mirror/utils/name_to_stream.hpp>
+#include <boost/mirror/algorithms.hpp>
 
-#include <boost/mirror/reflects_global_scope.hpp>
-#include <boost/mirror/reflects_namespace.hpp>
-#include <boost/mirror/reflects_class.hpp>
-#include <boost/mirror/reflects_type.hpp>
+#include <boost/mirror/traits/reflects_global_scope.hpp>
+#include <boost/mirror/traits/reflects_namespace.hpp>
+#include <boost/mirror/traits/reflects_class.hpp>
+#include <boost/mirror/traits/reflects_type.hpp>
 
 
 /** First declare some namespaces and classes
@@ -238,7 +239,7 @@
         template <class out_stream, class meta_object>
         out_stream& print_base_classes(out_stream& s, meta_object*) const {return s;}
         //
- // a function object that gets called by mpl::for_each
+ // a function object that gets called by mirror::for_each
         // for every base class of the given class
         template <class out_stream>
         struct base_class_printer
@@ -254,7 +255,7 @@
                         // it's base_class typedef is the type
                         // of the base class
                         using namespace ::std;
- typedef typename meta_inheritance::meta_class meta_class;
+ typedef typename meta_inheritance::meta_base_class meta_class;
                         s << endl << " - " << name_to_stream<meta_class>();
                 }
         };
@@ -278,7 +279,7 @@
                 else s << "no base classes.";
                 //
                 // execute the printer on the list of base classes
- mpl::for_each<base_class_list>(base_class_printer<out_stream>(s));
+ for_each<meta_object::base_classes>(base_class_printer<out_stream>(s));
                 //
                 return s << endl;
         }
@@ -298,32 +299,14 @@
                 attrib_printer(out_stream& _s):s(_s){ }
                 //
                 // function call operator
- template <
- class meta_class,
- class meta_attributes,
- class iterator,
- class attrib_type
- >
- void operator()(meta_class mc, meta_attributes ma, iterator pos, attrib_type*) const
+ template <class meta_attribute>
+ void operator()(meta_attribute ma) const
                 {
- // the first argument is a undefined pointer to the
- // meta_class which we are inspecting (it only conveys
- // the information about the meta_class<> specialization
- //
- // the second argument is the position that can be used
- // to access base_name of the i-th attribute. Basically
- // this is a mpl::int_<>
- //
- // the third attribute is an undefined pointer used to
- // pass the info about the i-th member attrib type
- //
- // NOTE: the pointers may be replaced by mpl::identity<>
- // or some other type in the future
                         using namespace ::std;
                         s << endl << " - " <<
- name_to_stream< BOOST_MIRROR_REFLECT_TYPE(attrib_type) >() <<
+ name_to_stream< BOOST_MIRROR_REFLECT_TYPE(typename meta_attribute::type) >() <<
                                 " " <<
- ma.base_name(pos);
+ ma.base_name();
                 }
         };
         //
@@ -346,7 +329,7 @@
                 // execute the printer on the list of member attributes
                 // note that the type of functor and the implementation
                 // of for_each is likely subject to changes
- meta_object::attributes::for_each(attrib_printer<out_stream>(s));
+ for_each<meta_object::attributes>(attrib_printer<out_stream>(s));
                 return s << ::std::endl;
         }
 

Modified: sandbox/mirror/libs/mirror/example/registering/types.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/registering/types.cpp (original)
+++ sandbox/mirror/libs/mirror/example/registering/types.cpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -14,7 +14,7 @@
 #include <boost/mirror/meta_namespace.hpp>
 #include <boost/mirror/meta_type.hpp>
 //
-#include <boost/mirror/reflects_global_scope.hpp>
+#include <boost/mirror/traits/reflects_global_scope.hpp>
 // utility that allows to put the name of the type to a given stream
 #include <boost/mirror/utils/name_to_stream/type.hpp>
 //

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-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -30,7 +30,7 @@
 #include <boost/mirror/meta_class.hpp>
 
 #include <boost/mirror/utils/name_to_stream.hpp>
-
+#include <boost/mirror/algorithms.hpp>
 
 /** First declare some namespaces and classes
  */
@@ -174,20 +174,20 @@
 
 struct attrib_printer
 {
- template <class meta_class, class meta_attributes, class iterator, class attrib_type>
- void operator()(meta_class mc, meta_attributes ma, iterator pos, attrib_type*) const
+ template <class meta_attribute>
+ void operator()(meta_attribute ma) const
                 {
                         using namespace ::std;
                         using namespace ::boost;
                         using namespace ::boost::mirror;
- typedef BOOST_MIRROR_REFLECT_TYPE(attrib_type) mt;
+ typedef BOOST_MIRROR_REFLECT_TYPE(typename meta_attribute::type) mt;
                         bcout <<
                                 " " <<
- iterator::value <<
+ meta_attribute::position::value <<
                                 ": " <<
- mt::full_name() <<
+ meta_attribute::meta_class::full_name() <<
                                 " " <<
- ma.base_name(pos) <<
+ ma.base_name() <<
                                 ";" <<
                                 endl;
                 }
@@ -214,7 +214,7 @@
         bcout << meta_T::all_attributes::inherited_size::value << " inherited member attrib(s)" << endl;
         bcout << meta_T::all_attributes::size::value << " member attrib(s)" << endl;
         // execute a functor on all attributes
- meta_T::all_attributes::for_each(attrib_printer());
+ for_each<meta_T::all_attributes>(attrib_printer());
         //
         // The attrbs of H are reflected in the following order
         // A::l (long)
@@ -310,24 +310,8 @@
         //
         bcout << "--------------------------------------------" << endl;
         //
+
+ //
         return 0;
 }
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

Modified: sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp (original)
+++ sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -16,7 +16,8 @@
 #include <boost/mirror/meta_type.hpp>
 #include <boost/mirror/meta_class.hpp>
 
-#include <boost/mirror/utils/name_to_stream.hpp>
+#include <boost/mirror/algorithms.hpp>
+#include <boost/mirror/functions.hpp>
 
 #include <boost/mirror/meta_types/boost_tuple.hpp>
 #include <boost/mirror/meta_types/std_pair.hpp>
@@ -34,23 +35,32 @@
                 attrib_value_printer(a_class& _inst)
                 : inst(_inst){ }
         
- template <class meta_class, class meta_attributes, class iterator, class attrib_type>
- void operator()(meta_class mc, meta_attributes ma, iterator pos, attrib_type*) const
+ template <typename meta_attribute>
+ void operator()(meta_attribute ma) const
                 {
                         using namespace ::std;
                         using namespace ::boost;
                         using namespace ::boost::mirror;
                         bcout <<
                                 " " <<
- ma.base_name(pos) <<
+ ma.base_name() <<
                                 " = " <<
- ma.get(inst, pos) <<
+ ma.get(inst) <<
                                 endl;
                 }
 private:
         a_class& inst;
 };
 
+struct str_printer
+{
+ void operator()(const ::boost::bchar* str) const
+ {
+ using namespace ::std;
+ using namespace ::boost;
+ bcout << str << ", ";
+ }
+};
 
 int main(void)
 {
@@ -109,12 +119,17 @@
         //
         tuple<int, int, int, int, int, int, int, int, int, int> x(0,1,2,3,4,5,6,7,8,9);
         typedef BOOST_MIRROR_REFLECT_CLASS(BOOST_TYPEOF(x)) meta_X;
- attrib_value_printer<meta_X::base_type> p(x);
+ attrib_value_printer<meta_X::reflected_type> p(x);
         //
         bcout << "The type name is: "<< meta_X::base_name() << endl;
         bcout << "The class has "<< meta_X::all_attributes::size::value << " members" << endl;
         bcout << "---------------------------------------------------" << endl;
- meta_X::all_attributes::for_each(p);
+ for_each<meta_X::all_attributes>(p);
+ bcout << "---------------------------------------------------" << endl;
+ reverse_for_each<meta_X::all_attributes>(p);
+ bcout << "---------------------------------------------------" << endl;
+ for_each<meta_X::all_attributes>(select_base_name(), str_printer());
+ bcout << endl;
         bcout << "---------------------------------------------------" << endl;
         bcout << "Finished" << endl;
 

Added: sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp 2008-05-01 11:43:18 EDT (Thu, 01 May 2008)
@@ -0,0 +1,200 @@
+/**
+ * \file examples/traversal/sample_visitor.cpp
+ *
+ * Example of class structure deep and flat traversal
+ *
+ * NOTE: if You are not familiar with registration
+ * and reflection, You should probably
+ * see examples in examples/registering/ first.
+ *
+ * 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)
+ */
+
+#include <boost/char_type_switch/iostream.hpp>
+
+#include <boost/mirror/meta_namespace.hpp>
+#include <boost/mirror/meta_type.hpp>
+#include <boost/mirror/meta_class.hpp>
+
+#include <boost/mirror/meta_types/std_pair.hpp>
+#include <boost/mirror/meta_types/boost_tuple.hpp>
+#include <boost/mirror/meta_classes/boost_tuple.hpp>
+
+
+#include <boost/mirror/visitors/sample.hpp>
+#include <boost/mirror/traversal.hpp>
+
+/** First declare some namespaces and classes
+ */
+
+namespace Test {
+
+ struct A
+ {
+ long l;
+ };
+
+ struct B : virtual A
+ {
+ int i;
+ };
+
+ struct C : virtual A
+ {
+ double d;
+ };
+
+ struct D : virtual A
+ {
+ short s;
+ };
+
+ struct E : B, C, D
+ {
+ float f;
+ };
+
+ struct F : virtual E
+ {
+ bool b;
+ };
+
+ struct G : virtual E
+ {
+ char c;
+ };
+
+ struct H : F, G
+ {
+ wchar_t w;
+ };
+
+
+} // namespace Test
+
+namespace boost {
+namespace mirror {
+
+/** Register the Test namespace
+ */
+BOOST_MIRROR_REG_META_NAMESPACE_TOP_LEVEL(Test)
+
+/** Register the types and classes
+ */
+BOOST_MIRROR_REG_META_TYPE(_Test, ::Test, A)
+BOOST_MIRROR_REG_META_TYPE(_Test, ::Test, B)
+BOOST_MIRROR_REG_META_TYPE(_Test, ::Test, C)
+BOOST_MIRROR_REG_META_TYPE(_Test, ::Test, D)
+BOOST_MIRROR_REG_META_TYPE(_Test, ::Test, E)
+BOOST_MIRROR_REG_META_TYPE(_Test, ::Test, F)
+BOOST_MIRROR_REG_META_TYPE(_Test, ::Test, G)
+BOOST_MIRROR_REG_META_TYPE(_Test, ::Test, H)
+
+
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::B)
+BOOST_MIRROR_REG_BASE_CLASS_VIRTUAL(0, public, ::Test::A)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::C)
+BOOST_MIRROR_REG_BASE_CLASS_VIRTUAL(0, public, ::Test::A)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::D)
+BOOST_MIRROR_REG_BASE_CLASS_VIRTUAL(0, public, ::Test::A)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::E)
+BOOST_MIRROR_REG_BASE_CLASS_SIMPLE(0, ::Test::B)
+BOOST_MIRROR_REG_BASE_CLASS_SIMPLE(1, ::Test::C)
+BOOST_MIRROR_REG_BASE_CLASS_SIMPLE(2, ::Test::D)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::F)
+BOOST_MIRROR_REG_BASE_CLASS_VIRTUAL(0, public, ::Test::E)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::G)
+BOOST_MIRROR_REG_BASE_CLASS_VIRTUAL(0, public, ::Test::E)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::H)
+BOOST_MIRROR_REG_BASE_CLASS_SIMPLE(0, ::Test::F)
+BOOST_MIRROR_REG_BASE_CLASS_SIMPLE(1, ::Test::G)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+
+
+/** Class attributes
+ */
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::A)
+ BOOST_MIRROR_REG_CLASS_ATTRIB(0, 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_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::C)
+ BOOST_MIRROR_REG_CLASS_ATTRIB(0, 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_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::E)
+ BOOST_MIRROR_REG_CLASS_ATTRIB(0, 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_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::G)
+ BOOST_MIRROR_REG_CLASS_ATTRIB(0, 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_CLASS_ATTRIBS_END
+
+} // namespace mirror
+} // namespace boost
+
+
+int main(void)
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ using namespace ::Test;
+ //
+ typedef BOOST_MIRROR_REFLECT_CLASS(H) meta_H;
+ //
+ bcout << "--------------------------------------------" << endl;
+ deep_traversal_of<meta_H>::accept(sample_visitor());
+ bcout << "--------------------------------------------" << endl;
+ flat_traversal_of<meta_H>::accept(sample_visitor());
+ bcout << "--------------------------------------------" << endl;
+ //
+ //
+ typedef pair<int volatile, long const> T1;
+ typedef pair<double * const *, float> T2;
+ typedef pair<char const [12], wchar_t [4]> T3;
+ typedef pair<bool, bool> T4;
+ typedef pair<T1, T2> T5;
+ typedef pair<T3, T4> T6;
+ typedef pair<T5, T6> T7;
+ typedef tuple<T1, T2, T3, T4, T5, T6, T7> T;
+ typedef BOOST_MIRROR_REFLECT_CLASS(T) meta_T;
+ //
+ bcout << "--------------------------------------------" << endl;
+ deep_traversal_of<meta_T>::accept(sample_visitor());
+ bcout << "--------------------------------------------" << endl;
+ flat_traversal_of<meta_T>::accept(sample_visitor());
+ bcout << "--------------------------------------------" << endl;
+ //
+ return 0;
+}


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