Boost logo

Boost-Commit :

From: chochlik_at_[hidden]
Date: 2008-06-20 08:15:44


Author: matus.chochlik
Date: 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
New Revision: 46551
URL: http://svn.boost.org/trac/boost/changeset/46551

Log:
                        - Minor update of class traversals
                        - Fixed some bugs in the meta-path related templates
- Added a new meta-path axis (parent)
- The interface of the visitors has been updated
- Added a new sample visitor showing what meta-path
  expressions can currently do
- Tested with MSVC++ 2008 EE On Vista

Added:
   sandbox/mirror/boost/mirror/meta_path/export_nodes.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/meta_path/export_paths_and_nodes.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/meta_path/for_each.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/meta_path/parent.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/visitors/meta_path_sample.hpp (contents, props changed)
Text files modified:
   sandbox/mirror/boost/mirror/detail/meta_attribs_outline.hpp | 4 +-
   sandbox/mirror/boost/mirror/detail/traversal.hpp | 2 +
   sandbox/mirror/boost/mirror/meta_attributes.hpp | 3 -
   sandbox/mirror/boost/mirror/meta_class.hpp | 4 +-
   sandbox/mirror/boost/mirror/meta_destructor.hpp | 3 --
   sandbox/mirror/boost/mirror/meta_path/ancestors.hpp | 54 ++++++++++++++++++++++++++-------------
   sandbox/mirror/boost/mirror/meta_path/node_context.hpp | 5 ++
   sandbox/mirror/boost/mirror/visitors/sample.hpp | 35 ++++++++++++++++++++-----
   sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml | 9 ++++++
   sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp | 8 +++++
   10 files changed, 91 insertions(+), 36 deletions(-)

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-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -52,7 +52,7 @@
         struct NAME##_outline_holder \
         { \
                 struct outline : public mirror::detail::meta_attribute_outline< \
- mirror::detail::meta_class_attribute< \
+ mirror::meta_class_attribute< \
                                 Class, \
                                 variant_tag, \
                                 meta_class_attributes<Class, variant_tag>, \
@@ -62,7 +62,7 @@
> \
                 {\
                         typedef mirror::detail::meta_attribute_outline< \
- mirror::detail::meta_class_attribute< \
+ mirror::meta_class_attribute< \
                                         Class, \
                                         variant_tag, \
                                         meta_class_attributes<Class, variant_tag>, \

Modified: sandbox/mirror/boost/mirror/detail/traversal.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/traversal.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/traversal.hpp 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -201,6 +201,7 @@
                         {
                                 visitor.enter_base_classes(
                                         MetaClass(),
+ typename MetaClass::base_classes(),
                                         meta_path::make_node_context(
                                                 ClassNodePath(),
                                                 typename MetaClass::base_classes()
@@ -212,6 +213,7 @@
                         {
                                 visitor.leave_base_classes(
                                         MetaClass(),
+ typename MetaClass::base_classes(),
                                         meta_path::make_node_context(
                                                 ClassNodePath(),
                                                 typename MetaClass::base_classes()

Modified: sandbox/mirror/boost/mirror/meta_attributes.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_attributes.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_attributes.hpp 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -20,7 +20,6 @@
 
 namespace boost {
 namespace mirror {
-namespace detail {
 
         /** This is basically the same as the "attributes" structure
          * but allows to work with all member attributes including
@@ -666,7 +665,7 @@
                 typedef typename detail_traits::type traits;
 
         };
-} // 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-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -73,12 +73,12 @@
 
         /** Same as attributes but containing also the inherited attributes
          */
- typedef detail::meta_class_all_attributes<Class, VariantTag >
+ typedef meta_class_all_attributes<Class, VariantTag >
                 all_attributes;
 
         /** Meta data concerning the destructor of the reflected class
          */
- typedef detail::meta_class_destructor<Class, VariantTag>
+ typedef meta_class_destructor<Class, VariantTag>
                 destructor;
 };
 

Modified: sandbox/mirror/boost/mirror/meta_destructor.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_destructor.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_destructor.hpp 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -13,8 +13,6 @@
 
 namespace boost {
 namespace mirror {
-namespace detail {
-
 
 /** Meta class - specializes the meta_type for classes
  */
@@ -29,7 +27,6 @@
 };
 
 
-} // namespace detail
 } // namespace mirror
 } // namespace boost
 

Modified: sandbox/mirror/boost/mirror/meta_path/ancestors.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_path/ancestors.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_path/ancestors.hpp 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -17,6 +17,8 @@
 #include <boost/mpl/pop_front.hpp>
 #include <boost/mpl/back.hpp>
 #include <boost/mpl/push_back.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/empty.hpp>
 
 namespace boost {
 namespace mirror {
@@ -58,25 +60,41 @@
                         template <class PathsAndNodes, class Pair>
                         struct apply
                         {
- typedef typename mpl::accumulate<
- // the given paths and nodes without the
- // the root
- typename mpl::pop_front<
- typename mpl::first<Pair>::type
- >::type,
- // a pair containing an empty path and
- // the root node
- typename mpl::push_back<
- PathsAndNodes,
- mpl::pair<
- mpl::vector0<>,
- mpl::front<
+ struct if_empty
+ {
+ typedef PathsAndNodes type;
+ };
+
+ struct if_not_empty
+ {
+ typedef typename mpl::accumulate<
+ // the given paths and nodes without the
+ // the root
+ typename mpl::pop_front<
                                                                 typename mpl::first<Pair>::type
- >
- >
- >::type,
- // appends a new path/node pair to the state
- append_path_and_node
+ >::type,
+ // append a pair containing an empty path and
+ // the root node
+ typename mpl::push_back<
+ PathsAndNodes,
+ mpl::pair<
+ mpl::vector0<>,
+ typename mpl::front<
+ typename mpl::first<Pair>::type
+ >::type
+ >
+ >::type,
+ // appends a new path/node pair to the state
+ append_path_and_node
+ >::type type;
+ };
+
+ typedef typename mpl::eval_if<
+ mpl::empty<
+ typename mpl::first<Pair>::type
+ >,
+ if_empty,
+ if_not_empty
>::type type;
                         };
                 };

Added: sandbox/mirror/boost/mirror/meta_path/export_nodes.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/meta_path/export_nodes.hpp 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -0,0 +1,34 @@
+/**
+ * \file boost/mirror/meta_path/export_nodes.hpp
+ *
+ * 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_PATH_EXPORT_NODES_HPP
+#define BOOST_MIRROR_META_PATH_EXPORT_NODES_HPP
+
+#include <boost/mirror/meta_path/node_context.hpp>
+
+namespace boost {
+namespace mirror {
+
+namespace meta_path {
+
+/** Returns a mpl::vector containing the list of nodes
+ * in a node context
+ */
+template <class NodeContext>
+struct export_nodes
+{
+ typedef typename node_set<NodeContext>::nodes
+ type;
+};
+
+} // namespace meta_path
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/meta_path/export_paths_and_nodes.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/meta_path/export_paths_and_nodes.hpp 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -0,0 +1,35 @@
+/**
+ * \file boost/mirror/meta_path/export_paths_and_nodes.hpp
+ *
+ * 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_PATH_EXPORT_PATHS_AND_NODES_HPP
+#define BOOST_MIRROR_META_PATH_EXPORT_PATHS_AND_NODES_HPP
+
+#include <boost/mirror/meta_path/node_context.hpp>
+
+namespace boost {
+namespace mirror {
+
+namespace meta_path {
+
+/** Returns a mpl::vector containing the list of pairs
+ * of paths and nodes in the node set. The paths are
+ * mpl::vectors containing nodes (MetaObjects)
+ */
+template <class NodeContext>
+struct export_paths_and_nodes
+{
+ typedef typename node_set<NodeContext>::paths_and_nodes
+ type;
+};
+
+} // namespace meta_path
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/meta_path/for_each.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/meta_path/for_each.hpp 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -0,0 +1,85 @@
+/**
+ * \file boost/mirror/meta_path/for_each.hpp
+ *
+ * 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_PATH_FOR_EACH_HPP
+#define BOOST_MIRROR_META_PATH_FOR_EACH_HPP
+
+#include <boost/mirror/meta_path/node_context.hpp>
+#include <boost/mpl/for_each.hpp>
+#include <boost/ref.hpp>
+
+namespace boost {
+namespace mirror {
+
+namespace meta_path {
+
+/** Execute a functor on nodes in the given nodeset
+ */
+template <
+ class NodeSet,
+ class Functor
+>
+void for_each(Functor f)
+{
+ mpl::for_each<
+ typename NodeSet::paths_and_nodes,
+ >(f);
+}
+
+
+/** Execute a functor on the transformed nodes in the given nodeset
+ */
+template <
+ class NodeSet,
+ class TransformOp,
+ class Functor
+>
+void for_each(Functor f)
+{
+ mpl::for_each<
+ typename NodeSet::paths_and_nodes,
+ TransformOp
+ >(f);
+}
+
+/** Execute a functor on nodes in the given nodeset
+ */
+template <
+ class NodeSet,
+ class Functor
+>
+void for_each(boost::reference_wrapper<Functor> f_ref)
+{
+ mpl::for_each<
+ typename NodeSet::paths_and_nodes,
+ >(f_ref);
+}
+
+
+/** Execute a functor on the transformed nodes in the given nodeset
+ */
+template <
+ class NodeSet,
+ class TransformOp,
+ class Functor
+>
+void for_each(boost::reference_wrapper<Functor> f_ref)
+{
+ mpl::for_each<
+ typename NodeSet::paths_and_nodes,
+ TransformOp
+ >(f_ref);
+}
+
+
+} // namespace meta_path
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Modified: sandbox/mirror/boost/mirror/meta_path/node_context.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_path/node_context.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_path/node_context.hpp 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -45,9 +45,12 @@
 template <class NodeContext>
 struct node_set
 {
+ typedef typename NodeContext::paths_and_nodes
+ paths_and_nodes;
+
         typedef typename mpl::transform_view<
                 typename NodeContext::paths_and_nodes,
- mpl::first< mpl::_ >
+ mpl::second< mpl::_1 >
>::type nodes;
 };
 

Added: sandbox/mirror/boost/mirror/meta_path/parent.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/meta_path/parent.hpp 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -0,0 +1,93 @@
+/**
+ * \file boost/mirror/meta_path/parent.hpp
+ *
+ * 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_PATH_PARENT_HPP
+#define BOOST_MIRROR_META_PATH_PARENT_HPP
+
+#include <boost/mirror/meta_path/node_context.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/pair.hpp>
+#include <boost/mpl/accumulate.hpp>
+#include <boost/mpl/pop_back.hpp>
+#include <boost/mpl/back.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/empty.hpp>
+
+namespace boost {
+namespace mirror {
+namespace meta_path {
+
+namespace detail {
+
+ template <class NodeContext>
+ struct parent_base
+ {
+ private:
+ typedef typename NodeContext::paths_and_nodes
+ passed_paths_and_nodes;
+ struct process_single_path_and_node
+ {
+ template <class PathsAndNodes, class Pair>
+ struct apply
+ {
+ struct if_empty
+ {
+ typedef PathsAndNodes type;
+ };
+
+ struct if_not_empty
+ {
+ typedef typename mpl::push_back<
+ PathsAndNodes,
+ mpl::pair<
+ typename mpl::pop_back<
+ typename mpl::first<Pair>::type
+ >::type,
+ typename mpl::back<
+ typename mpl::first<Pair>::type
+ >::type
+ >
+ >::type type;
+ };
+
+ typedef typename mpl::eval_if<
+ mpl::empty<
+ typename mpl::first<Pair>::type
+ >,
+ if_empty,
+ if_not_empty
+ >::type type;
+ };
+ };
+
+ public:
+ typedef typename mpl::accumulate<
+ passed_paths_and_nodes,
+ mpl::vector0<>,
+ process_single_path_and_node
+ >::type paths_and_nodes;
+ };
+
+} // namespace detail
+
+/** A nodeset containing parent node of the
+ * given node context
+ */
+template <class NodeContext>
+struct parent : node_set<detail::parent_base<NodeContext> >
+{
+ typedef parent<NodeContext> type;
+};
+
+} // namespace meta_path
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/visitors/meta_path_sample.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/visitors/meta_path_sample.hpp 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -0,0 +1,235 @@
+/**
+ * \file boost/mirror/visitors/meta_path_sample.hpp
+ * Sample implementation of a meta-object visitor
+ * showing how traversal contexts and meta-paths work
+ *
+ * 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_VISITORS_META_PATH_SAMPLE
+#define BOOST_MIRROR_VISITORS_META_PATH_SAMPLE
+
+// meta namespaces (includes boost/char_type_switch/string.hpp)
+#include <boost/mirror/meta_namespace.hpp>
+// meta types
+#include <boost/mirror/meta_class.hpp>
+// traits
+#include <boost/mirror/traits/reflects_virtual_inheritance.hpp>
+#include <boost/mirror/traits/reflects_global_scope.hpp>
+// container size
+#include <boost/mirror/algorithm/size.hpp>
+//
+// meta-path related stuff
+#include <boost/mirror/meta_path/export_paths_and_nodes.hpp>
+#include <boost/mirror/meta_path/for_each.hpp>
+#include <boost/mirror/meta_path/self.hpp>
+#include <boost/mirror/meta_path/parent.hpp>
+#include <boost/mirror/meta_path/ancestors.hpp>
+#include <boost/mirror/meta_path/size.hpp>
+
+//
+#include <boost/type_traits/is_fundamental.hpp>
+
+namespace boost {
+namespace mirror {
+
+namespace detail {
+
+ struct node_printer
+ {
+ bool simple;
+
+ node_printer(void):simple(true){ }
+ node_printer(const node_printer&):simple(false){ }
+
+ void print_indent(void) const
+ {
+ if(!simple) bcout << ::std::endl << "\t\t";
+ }
+
+ template <
+ class ReflectedType,
+ class VariantTag,
+ class MetaAttributes,
+ class AttribPos
+ >
+ void operator()(meta_class_attribute<
+ ReflectedType,
+ VariantTag,
+ MetaAttributes,
+ AttribPos
+ > mca) const
+ {
+ bcout << "|attribute '" << mca.base_name() << "'|";
+ print_indent();
+ }
+
+ template <
+ class ReflectedType,
+ class VariantTag
+ >
+ void operator()(meta_class_attributes<
+ ReflectedType,
+ VariantTag
+ > mca) const
+ {
+ bcout << "|attributes|";
+ print_indent();
+ }
+
+ template <
+ class ReflectedType,
+ class VariantTag
+ >
+ void operator()(meta_class_all_attributes<
+ ReflectedType,
+ VariantTag
+ > mca) const
+ {
+ bcout << "|all_attributes|";
+ print_indent();
+ }
+
+ template <
+ class ReflectedType,
+ class VariantTag
+ >
+ void operator()(meta_base_classes<
+ ReflectedType,
+ VariantTag
+ > mca) const
+ {
+ bcout << "|base_classes|";
+ print_indent();
+ }
+
+ template <
+ class Position,
+ class BaseClass,
+ typename AccessSpec,
+ typename InheritanceSpec
+ >
+ void operator()(meta_inheritance<
+ Position,
+ BaseClass,
+ AccessSpec,
+ InheritanceSpec
+ > mi) const
+ {
+ bcout << "|base_class|";
+ print_indent();
+ }
+
+ template <class Class>
+ void operator()(meta_class<Class> mc) const
+ {
+ bcout << "|type '" << mc.base_name() << "'|";
+ print_indent();
+ }
+ };
+
+} // namespace detail
+
+class meta_path_sample_visitor
+{
+public:
+ typedef mpl::bool_<false> works_on_instances;
+
+ // enter a class/type
+ template <class MetaClass, class Context>
+ void enter_type(MetaClass, Context)
+ {
+ print_node(MetaClass(), Context());
+ }
+
+ // leave the class/type
+ template <class MetaClass, class Context>
+ void leave_type(MetaClass, Context) const { }
+
+ template <class MetaClass, class BaseClasses, class Context>
+ inline void enter_base_classes(MetaClass, BaseClasses, Context)
+ {
+ if(!mpl::empty<BaseClasses>::value)
+ print_node(BaseClasses(), Context());
+ }
+
+ template <class MetaClass, class BaseClasses, class Context>
+ inline void leave_base_classes(MetaClass, BaseClasses, Context){ }
+
+
+ // enter a base class
+ template <class MetaInheritance, class Context>
+ void enter_base_class(MetaInheritance, Context)
+ {
+ print_node(MetaInheritance(), Context());
+ }
+
+ // leave base class
+ template <class MetaInheritance, class Context>
+ void leave_base_class(MetaInheritance, Context){ }
+
+
+ template <class MetaClass, class MetaAttributes, class Context>
+ void enter_attributes(MetaClass, MetaAttributes, Context)
+ {
+ if(!mpl::empty<MetaAttributes>::value)
+ print_node(MetaAttributes(), Context());
+ }
+
+ template <class MetaClass, class MetaAttributes, class Context>
+ void leave_attributes(MetaClass, MetaAttributes, Context){ }
+
+ template <class MetaAttribute, class Context>
+ inline void enter_attribute(MetaAttribute, Context)
+ {
+ print_node(MetaAttribute(), Context());
+ }
+
+ template <class MetaAttribute, class Context>
+ void leave_attribute(MetaAttribute, Context){ }
+
+ template <class MetaClass, class Context, typename InstanceType>
+ void visit_instance(MetaClass, Context ctx, InstanceType* ptr_to_inst)
+ {
+ }
+
+private:
+
+ template <template <class> class Axis, class MetaObject, class Context>
+ void print_node_set(const char* name, MetaObject mo, Context ctx)
+ {
+ using ::std::endl;
+ //
+ bcout << "\t" << name << ": ";
+ meta_path::for_each<
+ Axis<Context>,
+ mpl::lambda<mpl::second<mpl::_1> >
+ >(detail::node_printer());
+ bcout << endl;
+ }
+
+ template <class MetaObject, class Context>
+ void print_node(MetaObject mo, Context ctx)
+ {
+ using ::std::endl;
+ //
+ detail::node_printer p;
+ bcout << "node ";
+ p(mo);
+ bcout << ":" << endl;
+ //
+ print_node_set<meta_path::self>("self", mo, ctx);
+ print_node_set<meta_path::parent>("parent", mo, ctx);
+ print_node_set<meta_path::ancestors>("ancestors", mo, ctx);
+ }
+
+};
+
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Modified: sandbox/mirror/boost/mirror/visitors/sample.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/visitors/sample.hpp (original)
+++ sandbox/mirror/boost/mirror/visitors/sample.hpp 2008-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -20,10 +20,6 @@
 // container size
 #include <boost/mirror/algorithm/size.hpp>
 //
-// meta-path related stuff
-#include <boost/mirror/meta_path/self.hpp>
-#include <boost/mirror/meta_path/ancestors.hpp>
-#include <boost/mirror/meta_path/size.hpp>
 
 //
 #include <boost/type_traits/is_fundamental.hpp>
@@ -72,10 +68,33 @@
                 bcout << "</type>" << endl;
         }
 
- template <class MetaClass, class Context>
- inline void enter_base_classes(MetaClass, Context){ }
- template <class MetaClass, class Context>
- inline void leave_base_classes(MetaClass, Context){ }
+ template <class MetaClass, class BaseClasses, class Context>
+ inline void enter_base_classes(MetaClass, BaseClasses, Context)
+ {
+ using namespace ::std;
+ using namespace ::boost;
+ if(mirror::size<MetaClass::base_classes>::value > 0)
+ {
+ print_indentation();
+ ++indent;
+ bcout <<
+ "<base_classes>" <<
+ endl;
+ }
+ }
+
+ template <class MetaClass, class BaseClasses, class Context>
+ inline void leave_base_classes(MetaClass, BaseClasses, Context)
+ {
+ using namespace ::std;
+ using namespace ::boost;
+ if(mirror::size<MetaClass::base_classes>::value > 0)
+ {
+ --indent;
+ print_indentation();
+ bcout << "</base_classes>" << endl;
+ }
+ }
 
 
         // enter a base class

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-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -195,5 +195,14 @@
                         - Tested with gcc 4.3.0 on SuSE
                         - Tested with intel 10.1 on SuSE
                 </revision>
+ <revision id="20080620" major="0" minor="1" micro="30" author="m_ch">
+ - Minor update of class traversals
+ - Fixed some bugs in the meta-path related templates
+ - Added a new meta-path axis (parent)
+ - The interface of the visitors has been updated
+ - Added a new sample visitor showing what meta-path
+ expressions can currently do
+ - Tested with MSVC++ 2008 EE On Vista
+ </revision>
         </revisions>
 </library>

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-06-20 08:15:42 EDT (Fri, 20 Jun 2008)
@@ -22,7 +22,11 @@
 #include <boost/mirror/meta_types/boost_tuple.hpp>
 #include <boost/mirror/meta_classes/boost_tuple.hpp>
 
+#include <boost/mirror/meta_path/ancestors.hpp>
+#include <boost/mirror/meta_path/size.hpp>
+
 #include <boost/mirror/visitors/sample.hpp>
+#include <boost/mirror/visitors/meta_path_sample.hpp>
 #include <boost/mirror/traversal.hpp>
 
 /** First declare some namespaces and classes
@@ -186,6 +190,10 @@
         bcout << "--------------------------------------------" << endl;
         flat_traversal_of<meta_H>::accept(sample_visitor<true>(), &h);
         bcout << "--------------------------------------------" << endl;
+ deep_traversal_of<meta_H>::accept(meta_path_sample_visitor());
+ bcout << "--------------------------------------------" << endl;
+ flat_traversal_of<meta_H>::accept(meta_path_sample_visitor());
+ bcout << "--------------------------------------------" << endl;
         //
         //
         typedef pair<int volatile, long const> T1;


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