|
Boost-Commit : |
From: chochlik_at_[hidden]
Date: 2008-04-26 10:44:07
Author: matus.chochlik
Date: 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
New Revision: 44776
URL: http://svn.boost.org/trac/boost/changeset/44776
Log:
- Added meta_type for boost::tuple
Added meta_type for std::vector
Added meta_type for std::map
Added meta_type for std::list
Added meta_type for std::set
Modified several other internal headers
Added:
sandbox/mirror/boost/mirror/meta_namespaces/
sandbox/mirror/boost/mirror/meta_namespaces/boost_tuples.hpp (contents, props changed)
sandbox/mirror/boost/mirror/meta_types/std_list.hpp (contents, props changed)
sandbox/mirror/boost/mirror/meta_types/std_map.hpp (contents, props changed)
sandbox/mirror/boost/mirror/meta_types/std_set.hpp (contents, props changed)
sandbox/mirror/boost/mirror/meta_types/std_slist.hpp (contents, props changed)
sandbox/mirror/boost/mirror/meta_types/std_vector.hpp (contents, props changed)
sandbox/mirror/libs/examples/special/boost_tuple.cpp (contents, props changed)
Text files modified:
sandbox/mirror/boost/mirror/detail/nontrivial_type_name.hpp | 28 +
sandbox/mirror/boost/mirror/detail/template_name.hpp | 17 +
sandbox/mirror/boost/mirror/meta_type.hpp | 3
sandbox/mirror/boost/mirror/meta_types/boost_tuple.hpp | 514 +++++----------------------------------
sandbox/mirror/libs/doc/xml/mirror/_library.xml | 9
sandbox/mirror/libs/examples/special/std_pair.cpp | 10
6 files changed, 123 insertions(+), 458 deletions(-)
Modified: sandbox/mirror/boost/mirror/detail/nontrivial_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/nontrivial_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/nontrivial_type_name.hpp 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -10,6 +10,9 @@
#ifndef BOOST_MIRROR_META_DETAIL_NONTRIVIAL_TYPE_NAME_HPP
#define BOOST_MIRROR_META_DETAIL_NONTRIVIAL_TYPE_NAME_HPP
+#ifndef BOOST_MIRROR_USE_STATIC_NAME_STRINGS
+# include <memory> // ::std::auto ptr
+#endif
namespace boost {
namespace mirror {
namespace detail {
@@ -58,14 +61,33 @@
typedef typename implementation<meta_type, meta_data, true> implementation_base_name;
typedef typename implementation<meta_type, meta_data, false> implementation_full_name;
+#ifndef BOOST_MIRROR_USE_STATIC_NAME_STRINGS
+ inline static bchar* new_string(const size_t size)
+ {
+ assert(size != 0);
+ bchar* result = new bchar[size];
+ result[0] = 0;
+ return result;
+ }
+#endif
+
+ inline static bool name_not_initialized(const bchar* str)
+ {
+ return !str[0];
+ }
+
template <bool base_name>
static const bchar* get_name(mpl::bool_<base_name>)
{
typedef typename implementation<meta_type, meta_data, base_name>
impl;
- static bchar the_name[impl::name_length+1]
- = {BOOST_STR_LIT("")};
- if(!the_name[0])
+#ifdef BOOST_MIRROR_USE_STATIC_NAME_STRINGS
+ static bchar the_name[impl::name_length+1] = {BOOST_STR_LIT("")};
+#else
+ static ::std::auto_ptr<bchar> the_name_holder(new_string(impl::name_length+1));
+ bchar* the_name = the_name_holder.get();
+#endif
+ if(name_not_initialized(the_name))
impl::init_name(the_name);
return the_name;
}
Modified: sandbox/mirror/boost/mirror/detail/template_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/template_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/template_name.hpp 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -16,6 +16,7 @@
#include <boost/mpl/accumulate.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/at.hpp>
+#include <boost/mpl/remove_if.hpp>
#include <boost/mirror/detail/nontrivial_type_name.hpp>
@@ -57,11 +58,25 @@
>::type type;
};
+/** Specializations of this template
+ */
+
+template <typename a_type>
+struct is_typelist_null_type : ::boost::false_type { };
+
-template <class meta_type, class typelist, bool base_name>
+template <class meta_type, class full_typelist, bool base_name>
struct static_template_name_base
{
protected:
+ /** A typelist that contains all types from full_type_list
+ * except those that are typelist_null_types
+ */
+ typedef typename mpl::remove_if<
+ full_typelist,
+ is_typelist_null_type<mpl::_1>
+ >::type typelist;
+
/** The 'position' of the last type in the template
* type list.
*/
Added: sandbox/mirror/boost/mirror/meta_namespaces/boost_tuples.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/meta_namespaces/boost_tuples.hpp 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -0,0 +1,24 @@
+/**
+ * \file boost/mirror/meta_namespaces/boost_tuples.hpp
+ * Meta-namespace for the boost::tuples 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_NAMESPACES_BOOST_TUPLES_HPP
+#define BOOST_MIRROR_META_NAMESPACES_BOOST_TUPLES_HPP
+
+#include <boost/mirror/meta_namespace.hpp>
+
+namespace boost {
+namespace mirror {
+
+BOOST_MIRROR_REG_META_NAMESPACE(_boost, tuples)
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+
Modified: sandbox/mirror/boost/mirror/meta_type.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_type.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_type.hpp 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -152,8 +152,9 @@
#define BOOST_MIRROR_NATIVE_TYPES \
BOOST_PP_TUPLE_TO_LIST( \
- 14, \
+ 15, \
( \
+ void, \
bool, \
char, signed char, unsigned char, wchar_t, \
unsigned short int, short, \
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-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -11,465 +11,83 @@
#define BOOST_MIRROR_META_TYPES_BOOST_TUPLE_HPP
#include <boost/mirror/meta_type.hpp>
+#include <boost/mirror/detail/template_name.hpp>
+#include <boost/mirror/meta_namespaces/boost_tuples.hpp>
+#include <boost/tuple/tuple.hpp>
namespace boost {
namespace mirror {
-/** Meta class - specializes the meta_type for classes
- */
-template <
- class reflected_class,
- class variant_tag
+#define BOOST_MIRROR_TMP_BOOST_TUPLE_TEMPL_DECL() \
+template < \
+ class T0, \
+ class T1, \
+ class T2, \
+ class T3, \
+ class T4, \
+ class T5, \
+ class T6, \
+ class T7, \
+ class T8, \
+ class T9 \
>
-struct meta_class : public meta_type<reflected_class>
+
+#define BOOST_MIRROR_TMP_BOOST_TUPLE_TEMPL_ARG_NAMES() \
+ T0, T1, T2, T3, T4, T5, T6, T7, T8, T9
+
+
+namespace detail {
+
+BOOST_MIRROR_TMP_BOOST_TUPLE_TEMPL_DECL()
+struct meta_type_boost_tuple
{
- /** The base classes of a class.
- * The member base_classes::list is a mpl::vector of
- * meta_inheritance<> specializations, one for every
- * base class.
- */
- typedef meta_base_classes<reflected_class, variant_tag> base_classes;
-
- /** The member attributes of the class (not includeing the inherited
- * member attribs.
- * The attributes::type_list is a mpl::vector of types
- * of the attributes.
- *
- * The attributes::get(mpl::int_<I>) functions allow to get the value
- * of the I-th attribute, if the attribute is not write-only, where:
- * 0 <= I < N; N = $mpl::size<attributes::type_list>::value
- *
- * The attributes::set(mpl::int_<I>), T val) functions allow to set
- * the value of the I-th attribute, if it's not read-only, where
- * 0 <= I < N; N = $mpl::size<attributes::type_list>::value
- *
- */
- typedef meta_class_attributes<reflected_class, variant_tag> attributes;
-
- /** This is basically the same as the "attributes" structure
- * but allows to work with all member attributes including
- * the inherited ones.
- */
- struct all_attributes
- {
- /** This struct "hides" the internal helpers
- */
- struct detail
- {
- /** The list of non-virtual base classes in the same
- * order as they were registered.
- */
- typedef typename mpl::remove_if<
- typename base_classes::list,
- mpl::lambda<
- reflects_virtual_inheritance<mpl::_1>
- >::type
- >::type list_of_regular_base_classes;
-
- /** The list of directly inhertied virtual base classes.
- */
- typedef typename mpl::remove_if<
- typename base_classes::list,
- mpl::lambda<
- mpl::not_<reflects_virtual_inheritance<mpl::_1> >
- >::type
- >::type list_of_virtual_base_classes;
-
- /** This template gets the regular_base_class_layout
- * of a base class when given a meta_inheritance
- * specialization for this base class.
- */
- template <class meta_inheritance>
- struct get_base_class_regular_layout
- {
- typedef typename
- meta_inheritance::
- meta_class::
- all_attributes::
- detail::
- regular_base_class_layout type;
- };
-
- /** The layout of non-virtual base classes
- * of this class, stored as a mpl::vector
- * of meta_inheritances.
- */
- typedef typename mpl::accumulate<
- list_of_regular_base_classes,
- mpl::vector0<>,
- mpl::push_back<
- mpl::insert_range<
- mpl::_1,
- mpl::end<mpl::_1>,
- get_base_class_regular_layout<
- mpl::_2
- >
- >,
- mpl::_2
- >
- >::type regular_base_class_layout;
-
- /** This template gets the virtual_base_class_layout
- * of a base class when given a meta_inheritance
- * specialization for this base class.
- */
- template <class meta_inheritance>
- struct get_base_class_virtual_layout
- {
- typedef typename
- meta_inheritance::
- meta_class::
- all_attributes::
- detail::
- virtual_base_class_layout type;
- };
-
- /** This template gets the base_class_layout
- * of a base class when given a meta_inheritance
- * specialization for this base class.
- */
- template <class meta_inheritance>
- struct get_base_class_layout
- {
- typedef typename
- meta_inheritance::
- meta_class::
- all_attributes::
- detail::
- base_class_layout type;
- };
-
- /** The list of vitual base classes of this class.
- * This list still contains dupplicates, that are
- * removed to form virtual_base_class_layout
- */
- typedef typename mpl::accumulate<
- typename base_classes::list,
- mpl::vector0<>,
- mpl::if_<
- reflects_virtual_inheritance<
- mpl::_2
- >,
- mpl::push_back<
- mpl::insert_range<
- mpl::_1,
- mpl::end<mpl::_1>,
- get_base_class_layout<
- mpl::_2
- >
- >,
- mpl::_2
- >,
- mpl::insert_range<
- mpl::_1,
- mpl::end<mpl::_1>,
- get_base_class_virtual_layout<
- mpl::_2
- >
- >
- >
- >::type virtual_base_class_layout_w_dups;
-
- /** The layout of virtual base classes
- * of this class, stored as a mpl::vector
- * of meta_inheritances.
- */
- typedef typename mpl::fold<
- virtual_base_class_layout_w_dups,
- mpl::vector0<>,
- mpl::if_<
- mpl::contains<
- mpl::_1,
- mpl::_2
- >,
- mpl::_1,
- mpl::push_back<
- mpl::_1,
- mpl::_2
- >
- >
- >::type virtual_base_class_layout;
-
- /** This template gets the list of member
- * attrbute types of a base class when
- * given a meta_inheritance<> specialization
- */
- template <class meta_inheritance>
- struct get_base_class_attrib_type_list
- {
- typedef typename meta_inheritance::
- meta_class::
- attributes::
- type_list type;
- };
-
- typedef typename mpl::joint_view<
- virtual_base_class_layout,
- regular_base_class_layout
- >::type base_class_layout;
-
- /** The list of inherited member attributes
- * of the reflected class.
- * NOTE: this implementation puts the
- * members of the virtual bases before
- * the other members.
- */
- typedef typename mpl::accumulate<
- base_class_layout,
- mpl::vector0<>,
- mpl::insert_range<
- mpl::_1,
- mpl::end<mpl::_1>,
- get_base_class_attrib_type_list<
- mpl::_2
- >
- >
- >::type inherited_member_attrib_type_list;
-
- /** The list of types of all attributes including
- * the inherited ones.
- */
- typedef typename mpl::joint_view<
- typename detail::inherited_member_attrib_type_list,
- typename meta_class<reflected_class, variant_tag>::attributes::type_list
- >::type member_attrib_type_list;
-
-
- /** This template gets the list of the owner classes
- * for the inherited attributes.
- */
- template <class current_list, class meta_inheritance>
- struct get_base_class_attrib_owner_and_offs
- {
- typedef typename meta_inheritance::
- meta_class base_meta_class;
-
- typedef typename base_meta_class::
- attributes::
- type_list type_list;
-
- typedef typename mpl::size<
- current_list
- >::type offset;
- typedef typename mpl::pair<
- base_meta_class,
- offset
- > pair;
-
- template<typename T>
- struct get_pair
- {
- typedef pair type;
- };
-
- typedef typename mpl::accumulate<
- type_list,
- current_list,
- mpl::push_back<
- mpl::_1,
- get_pair<mpl::_>
- >
- >::type type;
- };
-
- /** This is a list that contains a pair of owner meta_class
- * and the index offset for every inherited attribute.
- */
- typedef typename mpl::accumulate<
- base_class_layout,
- mpl::vector0<>,
- get_base_class_attrib_owner_and_offs<
- mpl::_1,
- mpl::_2
- >
- >::type inherited_attrib_owners_and_offsets;
-
- /** This template is used to query the return value
- * type of the getter for the I-th member attribute
- */
- template <int I>
- struct result_of_get
- {
- typedef typename mpl::at<
- member_attrib_type_list,
- mpl::int_<I>
- >::type type;
- };
-
-
- /** This function is used to get the member attributes
- * from the base classes.
- */
- template <class a_class, int I>
- static typename result_of_get<I>::type
- get(a_class context, mpl::int_<I> pos, mpl::bool_<true>)
- {
- typedef typename mpl::at<
- typename detail::inherited_attrib_owners_and_offsets,
- mpl::int_<I>
- >::type owner_and_offset;
-
- typedef typename owner_and_offset::first meta_class;
- typedef typename mpl::int_<mpl::minus<
- mpl::int_<I>,
- typename owner_and_offset::second
- >::value> new_pos_type;
-
- return meta_class::attributes::get(context, new_pos_type());
-
- }
- template <class a_class, int I>
- static typename result_of_get<I>::type
- get(a_class context, mpl::int_<I> pos, mpl::bool_<false>)
- {
- typedef typename mpl::int_<mpl::minus<
- mpl::int_<I>,
- typename mpl::size<inherited_member_attrib_type_list>::type
- >::value> new_pos_type;
- return meta_class::attributes::get(context, new_pos_type());
- }
-
-
- /** This function is used to query the member attributes
- * from the base classes.
- */
- template <class a_class, int I, typename dest_type>
- static dest_type&
- query(a_class context, mpl::int_<I> pos, dest_type& dest, mpl::bool_<true>)
- {
- typedef typename mpl::at<
- typename detail::inherited_attrib_owners_and_offsets,
- mpl::int_<I>
- >::type owner_and_offset;
-
- typedef typename owner_and_offset::first meta_class;
- typedef typename mpl::int_<mpl::minus<
- mpl::int_<I>,
- typename owner_and_offset::second
- >::value> new_pos_type;
-
- return meta_class::attributes::query(context, new_pos_type(), dest);
-
- }
-
- template <class a_class, int I, typename dest_type>
- static dest_type&
- query(a_class context, mpl::int_<I> pos, dest_type& dest, mpl::bool_<false>)
- {
- typedef typename mpl::int_<mpl::minus<
- mpl::int_<I>,
- typename mpl::size<inherited_member_attrib_type_list>::type
- >::value> new_pos_type;
- return meta_class::attributes::query(context, new_pos_type(), dest);
- }
-
-
- /** This function is used to query the member attributes
- * from the base classes.
- */
- template <class a_class, int I, typename value_type>
- static void
- set(a_class& context, mpl::int_<I> pos, value_type value, mpl::bool_<true>)
- {
- typedef typename mpl::at<
- typename detail::inherited_attrib_owners_and_offsets,
- mpl::int_<I>
- >::type owner_and_offset;
-
- typedef typename owner_and_offset::first meta_class;
- typedef typename mpl::int_<mpl::minus<
- mpl::int_<I>,
- typename owner_and_offset::second
- >::value> new_pos_type;
-
- meta_class::attributes::set(context, new_pos_type(), value);
- }
-
- template <class a_class, int I, typename value_type>
- static void
- set(a_class& context, mpl::int_<I> pos, value_type value, mpl::bool_<false>)
- {
- typedef typename mpl::int_<mpl::minus<
- mpl::int_<I>,
- typename mpl::size<inherited_member_attrib_type_list>::type
- >::value> new_pos_type;
- meta_class::attributes::set(context, new_pos_type(), value);
- }
-
- }; // struct detail
-
- /** The list of inherited attribute types
- */
- typedef typename detail::inherited_member_attrib_type_list inherited_type_list;
-
- /** The size of the type_list, i.e. the count of inherited attributes
- */
- struct inherited_size : public mpl::size<inherited_type_list> { };
-
- /** The list of types of all attributes including
- * the inherited ones.
- */
- typedef typename detail::member_attrib_type_list type_list;
-
- /** The size of the type_list, i.e. the count of all attributes
- */
- struct size : public mpl::size<type_list> { };
-
- /** Gets the value of the I-th member (including
- * the inherited ones)
- */
- template <class a_class, int I>
- static typename detail::template result_of_get<I>::type
- get(a_class context, mpl::int_<I> pos)
- {
- typedef typename mpl::less<
- mpl::int_<I>,
- inherited_size
- >::type is_inherited;
-
- return detail::get(context, pos, is_inherited());
- }
-
- /** Queries the value of the I-th member (including
- * the inherited ones)
- */
- template <class a_class, int I, typename dest_type>
- static dest_type&
- query(a_class context, mpl::int_<I> pos, dest_type& dest)
- {
- typedef typename mpl::less<
- mpl::int_<I>,
- inherited_size
- >::type is_inherited;
-
- return detail::query(context, pos, dest, is_inherited());
- }
-
- /** Sets the value of the I-th member (including
- * the inherited ones)
- */
- template <class a_class, int I, typename value_type>
- static void
- set(a_class& context, mpl::int_<I> pos, value_type value)
- {
- typedef typename mpl::less<
- mpl::int_<I>,
- inherited_size
- >::type is_inherited;
-
- detail::set(context, pos, value, is_inherited());
- }
- }; // all_attributes
+ static const bchar* base_name(void){return BOOST_STR_LIT("tuple");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ base_name_length,
+ 5
+ )
+
+ static const bchar* full_name(void){return BOOST_STR_LIT("::boost::tuples::tuple");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ full_name_length,
+ 22
+ )
};
-/** This macro should be included in the definition of every class
- * with private or protected members, that should be refleccted
- */
-#define BOOST_MIRROR_FRIENDLY_CLASS(CLASS_NAME) \
- friend struct ::boost::mirror::meta_class_attributes<CLASS_NAME>;
+// designate tuples::null_type as typelist null type
+template <>
+struct is_typelist_null_type<::boost::tuples::null_type> : ::boost::true_type { };
+
+
+} // namespace detail
+
+
+BOOST_MIRROR_TMP_BOOST_TUPLE_TEMPL_DECL()
+struct meta_type<
+ ::boost::tuples::tuple< BOOST_MIRROR_TMP_BOOST_TUPLE_TEMPL_ARG_NAMES() >
+>
+: detail::static_template_name<
+ detail::meta_type_boost_tuple<
+ BOOST_MIRROR_TMP_BOOST_TUPLE_TEMPL_ARG_NAMES()
+ >,
+ mpl::vector<
+ BOOST_MIRROR_TMP_BOOST_TUPLE_TEMPL_ARG_NAMES()
+ >
+>
+{
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_boost_tuples) scope;
+ typedef ::boost::tuples::tuple<
+ BOOST_MIRROR_TMP_BOOST_TUPLE_TEMPL_ARG_NAMES()
+ > base_type;
+};
+// undefine the helper macros
+#undef BOOST_MIRROR_TMP_BOOST_TUPLE_TEMPL_DECL
+#undef BOOST_MIRROR_TMP_BOOST_TUPLE_TEMPL_ARG_NAMES
} // namespace mirror
Added: sandbox/mirror/boost/mirror/meta_types/std_list.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/meta_types/std_list.hpp 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -0,0 +1,60 @@
+/**
+ * \file boost/mirror/meta_types/std_list.hpp
+ * Meta-type for std::list<T, ...>
+ *
+ * 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_TYPES_STD_LIST_HPP
+#define BOOST_MIRROR_META_TYPES_STD_LIST_HPP
+
+#include <boost/mirror/meta_type.hpp>
+#include <boost/mirror/detail/template_name.hpp>
+#include <list>
+
+namespace boost {
+namespace mirror {
+
+namespace detail {
+
+template <typename T, class Allocator>
+struct meta_type_std_list
+{
+
+ static const bchar* base_name(void){return BOOST_STR_LIT("list");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ base_name_length,
+ 4
+ )
+
+ static const bchar* full_name(void){return BOOST_STR_LIT("::std::list");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ full_name_length,
+ 11
+ )
+};
+
+} // namespace detail
+
+
+template <typename T, class Allocator>
+struct meta_type< ::std::list<T, Allocator> >
+: detail::static_template_name<
+ detail::meta_type_std_list<T, Allocator> ,
+ mpl::vector1<T>
+>
+{
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
+ typedef ::std::list<T, Allocator> base_type;
+};
+
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+
Added: sandbox/mirror/boost/mirror/meta_types/std_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/meta_types/std_map.hpp 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -0,0 +1,60 @@
+/**
+ * \file boost/mirror/meta_types/std_map.hpp
+ * Meta-type for std::map<K, T, ...>
+ *
+ * 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_TYPES_STD_MAP_HPP
+#define BOOST_MIRROR_META_TYPES_STD_MAP_HPP
+
+#include <boost/mirror/meta_type.hpp>
+#include <boost/mirror/detail/template_name.hpp>
+#include <map>
+
+namespace boost {
+namespace mirror {
+
+namespace detail {
+
+template <typename K, typename T, class Comp, class Allocator>
+struct meta_type_std_map
+{
+
+ static const bchar* base_name(void){return BOOST_STR_LIT("map");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ base_name_length,
+ 3
+ )
+
+ static const bchar* full_name(void){return BOOST_STR_LIT("::std::map");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ full_name_length,
+ 10
+ )
+};
+
+} // namespace detail
+
+
+template <typename K, typename T, class Comp, class Allocator>
+struct meta_type< ::std::map<K, T, Comp, Allocator> >
+: detail::static_template_name<
+ detail::meta_type_std_map<K, T, Comp, Allocator> ,
+ mpl::vector2<K, T> // TODO add Comp too
+>
+{
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
+ typedef ::std::map<K, T, Comp, Allocator> base_type;
+};
+
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+
Added: sandbox/mirror/boost/mirror/meta_types/std_set.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/meta_types/std_set.hpp 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -0,0 +1,60 @@
+/**
+ * \file boost/mirror/meta_types/std_set.hpp
+ * Meta-type for std::set<K,, ...>
+ *
+ * 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_TYPES_STD_SET_HPP
+#define BOOST_MIRROR_META_TYPES_STD_SET_HPP
+
+#include <boost/mirror/meta_type.hpp>
+#include <boost/mirror/detail/template_name.hpp>
+#include <set>
+
+namespace boost {
+namespace mirror {
+
+namespace detail {
+
+template <typename K, class Comp, class Allocator>
+struct meta_type_std_set
+{
+
+ static const bchar* base_name(void){return BOOST_STR_LIT("set");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ base_name_length,
+ 3
+ )
+
+ static const bchar* full_name(void){return BOOST_STR_LIT("::std::set");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ full_name_length,
+ 10
+ )
+};
+
+} // namespace detail
+
+
+template <typename K, class Comp, class Allocator>
+struct meta_type< ::std::set<K, Comp, Allocator> >
+: detail::static_template_name<
+ detail::meta_type_std_set<K, Comp, Allocator> ,
+ mpl::vector1<K> // TODO add Comp too
+>
+{
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
+ typedef ::std::set<K, Comp, Allocator> base_type;
+};
+
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+
Added: sandbox/mirror/boost/mirror/meta_types/std_slist.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/meta_types/std_slist.hpp 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -0,0 +1,60 @@
+/**
+ * \file boost/mirror/meta_types/std_slist.hpp
+ * Meta-type for std::list<T, ...>
+ *
+ * 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_TYPES_STD_SLIST_HPP
+#define BOOST_MIRROR_META_TYPES_STD_SLIST_HPP
+
+#include <boost/mirror/meta_type.hpp>
+#include <boost/mirror/detail/template_name.hpp>
+#include <slist>
+
+namespace boost {
+namespace mirror {
+
+namespace detail {
+
+template <typename T, class Allocator>
+struct meta_type_std_slist
+{
+
+ static const bchar* base_name(void){return BOOST_STR_LIT("slist");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ base_name_length,
+ 5
+ )
+
+ static const bchar* full_name(void){return BOOST_STR_LIT("::std::slist");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ full_name_length,
+ 12
+ )
+};
+
+} // namespace detail
+
+
+template <typename T, class Allocator>
+struct meta_type< ::std::slist<T, Allocator> >
+: detail::static_template_name<
+ detail::meta_type_std_slist<T, Allocator> ,
+ mpl::vector1<T>
+>
+{
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
+ typedef ::std::slist<T, Allocator> base_type;
+};
+
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+
Added: sandbox/mirror/boost/mirror/meta_types/std_vector.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/meta_types/std_vector.hpp 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -0,0 +1,60 @@
+/**
+ * \file boost/mirror/meta_types/std_vector.hpp
+ * Meta-type for std::vector<T, ...>
+ *
+ * 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_TYPES_STD_VECTOR_HPP
+#define BOOST_MIRROR_META_TYPES_STD_VECTOR_HPP
+
+#include <boost/mirror/meta_type.hpp>
+#include <boost/mirror/detail/template_name.hpp>
+#include <vector>
+
+namespace boost {
+namespace mirror {
+
+namespace detail {
+
+template <typename T, class Allocator>
+struct meta_type_std_vector
+{
+
+ static const bchar* base_name(void){return BOOST_STR_LIT("vector");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ base_name_length,
+ 6
+ )
+
+ static const bchar* full_name(void){return BOOST_STR_LIT("::std::vector");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ full_name_length,
+ 13
+ )
+};
+
+} // namespace detail
+
+
+template <typename T, class Allocator>
+struct meta_type< ::std::vector<T, Allocator> >
+: detail::static_template_name<
+ detail::meta_type_std_vector<T, Allocator> ,
+ mpl::vector1<T>
+>
+{
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
+ typedef ::std::vector<T, Allocator> base_type;
+};
+
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+
Modified: sandbox/mirror/libs/doc/xml/mirror/_library.xml
==============================================================================
--- sandbox/mirror/libs/doc/xml/mirror/_library.xml (original)
+++ sandbox/mirror/libs/doc/xml/mirror/_library.xml 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -72,5 +72,14 @@
- Updated example showing the reflection of std::pair
- NOTE: tested only with MSVC++ 2008 EE
</revision>
+ <revision id="20080426" major="0" minor="1" micro="12" author="m_ch">
+ - Added meta_type for boost::tuple
+ - Added meta_type for std::vector
+ - Added meta_type for std::map
+ - Added meta_type for std::list
+ - Added meta_type for std::set
+ - Modified several other internal headers
+ - NOTE: tested only with MSVC++ 2008 EE
+ </revision>
</revisions>
</library>
Added: sandbox/mirror/libs/examples/special/boost_tuple.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/examples/special/boost_tuple.cpp 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -0,0 +1,58 @@
+/**
+ * \file examples/special/boost_tuple.cpp
+ *
+ * Example showing reflection of boost::tuples
+ *
+ * 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/string.hpp>
+#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/utils/name_to_stream.hpp>
+
+#include <boost/mirror/meta_types/std_pair.hpp>
+#include <boost/mirror/meta_types/boost_tuple.hpp>
+#include <boost/mirror/meta_types/std_vector.hpp>
+#include <boost/mirror/meta_types/std_list.hpp>
+#include <boost/mirror/meta_types/std_map.hpp>
+#include <boost/mirror/meta_types/std_set.hpp>
+
+int main(void)
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ // hold on to yer butts ;)
+ typedef tuple<int, double, const string*> T1;
+ typedef tuple<const bool, volatile float, void * const, char> T2;
+ typedef pair<T1, T2> T3;
+ typedef tuple<void*, const wstring& , const string&> T4;
+ typedef tuple<char, wchar_t, short int const> T5;
+ typedef pair<T4, T5> T6;
+ typedef vector<tuple<T1, T2, T3, T4, T5, T6> > T7;
+ typedef set<map<list<T1>, T7> > T;
+ //
+ typedef BOOST_MIRROR_REFLECT_TYPE(T) meta_T;
+ //
+ //
+ bcout << "The type name length = " << meta_T::base_name_length << " characters" << endl;
+ bcout << "---------------------------------------------------" << endl;
+ bcout << "The type name is: "<< meta_T::base_name() << endl;
+ bcout << "---------------------------------------------------" << endl;
+ bcout << "The full type name length = " << meta_T::full_name_length << " characters" << endl;
+ bcout << "---------------------------------------------------" << endl;
+ bcout << "The full type name is: "<< meta_T::full_name() << endl;
+ bcout << "---------------------------------------------------" << endl;
+ //
+ return 0;
+}
+
Modified: sandbox/mirror/libs/examples/special/std_pair.cpp
==============================================================================
--- sandbox/mirror/libs/examples/special/std_pair.cpp (original)
+++ sandbox/mirror/libs/examples/special/std_pair.cpp 2008-04-26 10:44:05 EDT (Sat, 26 Apr 2008)
@@ -26,11 +26,11 @@
using namespace ::boost::mirror;
//
//
- typedef ::std::pair<const int*, double [321]> T1;
- typedef ::std::pair<float, const long&> T2;
- typedef ::std::pair<T1 const volatile, T2 volatile const> T3;
- typedef ::std::pair<T2, T1 volatile> T4;
- typedef ::std::pair<T3 const * volatile, const T4&> T;
+ typedef pair<const int*, double [321]> T1;
+ typedef pair<float, const ::std::string&> T2;
+ typedef pair<T1 const volatile, T2 volatile const> T3;
+ typedef pair<T2, T1 volatile> T4;
+ typedef pair<T3 const * volatile *, const T4&> T;
//
typedef BOOST_MIRROR_REFLECT_TYPE(T) meta_T;
//
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