|
Boost-Commit : |
From: chochlik_at_[hidden]
Date: 2008-04-25 14:54:36
Author: matus.chochlik
Date: 2008-04-25 14:54:34 EDT (Fri, 25 Apr 2008)
New Revision: 44769
URL: http://svn.boost.org/trac/boost/changeset/44769
Log:
Finished full name getters
Modified meta_type for std::pair
Updated example showing the reflection of std::pair
NOTE: tested only with MSVC++ 2008 EE
Text files modified:
sandbox/mirror/boost/mirror/detail/array_type_name.hpp | 35 ++++++++---------
sandbox/mirror/boost/mirror/detail/const_type_name.hpp | 27 ++++++++-----
sandbox/mirror/boost/mirror/detail/cv_type_name.hpp | 29 ++++++++------
sandbox/mirror/boost/mirror/detail/nontrivial_type_name.hpp | 77 +++++++++++++++++++++++++++++++++++---
sandbox/mirror/boost/mirror/detail/pointer_type_name.hpp | 5 +-
sandbox/mirror/boost/mirror/detail/ptr_ref_type_name.hpp | 43 +++++++++++++++------
sandbox/mirror/boost/mirror/detail/reference_type_name.hpp | 4 +-
sandbox/mirror/boost/mirror/detail/template_name.hpp | 80 +++++++++++++++++++++++----------------
sandbox/mirror/boost/mirror/detail/volatile_type_name.hpp | 29 ++++++++------
sandbox/mirror/boost/mirror/meta_type.hpp | 7 ++-
sandbox/mirror/boost/mirror/meta_types/std_pair.hpp | 34 ++++++++++++++---
sandbox/mirror/libs/doc/xml/mirror/_library.xml | 6 +++
sandbox/mirror/libs/examples/registering/types.cpp | 3 +
sandbox/mirror/libs/examples/special/std_pair.cpp | 11 ++++-
14 files changed, 267 insertions(+), 123 deletions(-)
Modified: sandbox/mirror/boost/mirror/detail/array_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/array_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/array_type_name.hpp 2008-04-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -19,53 +19,52 @@
namespace detail {
-template <class meta_type, size_t array_size>
+template <class meta_type, class array_size, bool base_name>
struct static_array_type_name_base
{
protected:
- typedef detail::static_int_to_str<array_size>
+ typedef typename detail::static_int_to_str<array_size::value>
size_as_string;
-public:
+
+ typedef nontrivial_type_base_or_full_name<meta_type, base_name>
+ name_info;
+
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(size_t, difference, 3 + size_as_string::length::value)
+
BOOST_MIRROR_CONST_MEMBER_ATTRIB(
size_t,
- base_name_length,
- (
- meta_type::base_name_length + 3 +
- size_as_string::length::value
- )
+ name_length,
+ name_info::name_length + difference
)
-protected:
- static void init_base_name(bchar* the_base_name)
+ static void init_name(bchar* the_name)
{
- bchar* cur_pos = the_base_name;
+ bchar* cur_pos = the_name;
//
// copy the name of the template
- bstrcpy(cur_pos, meta_type::base_name());
- cur_pos += meta_type::base_name_length;
+ bstrcpy(cur_pos, name_info::name());
+ cur_pos += name_info::name_length;
//
// append the " ["
*(cur_pos++) = BOOST_STR_LIT(' ');
*(cur_pos++) = BOOST_STR_LIT('[');
- // append the index$
- assert((cur_pos + size_as_string::length::value) < (the_base_name + base_name_length));
+ // append the index
size_as_string::convert(cur_pos, size_as_string::length::value + 1);
cur_pos += size_as_string::length::value;
// append the "]"
*(cur_pos++) = BOOST_STR_LIT(']');
//
// finalize the string
- assert(cur_pos == (the_base_name + base_name_length));
+ assert(cur_pos == (the_name + name_length));
*cur_pos = BOOST_STR_LIT('\0');
}
};
template <class meta_type, size_t array_size>
struct static_array_type_name : static_nontrivial_type_name<
- static_array_type_name_base<meta_type, array_size>
+ meta_type, mpl::int_<array_size>, static_array_type_name_base
>{ };
-
} // namespace detail
} // namespace mirror
} // namespace boost
Modified: sandbox/mirror/boost/mirror/detail/const_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/const_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/const_type_name.hpp 2008-04-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -17,37 +17,42 @@
namespace mirror {
namespace detail {
-template <class meta_type>
+template <class meta_type, typename dummy, bool base_type>
struct static_const_type_name_base
{
+protected:
+ typedef nontrivial_type_base_or_full_name<meta_type, base_type>
+ name_info;
+
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(size_t, difference, 6)
+
BOOST_MIRROR_CONST_MEMBER_ATTRIB(
size_t,
- base_name_length,
- (meta_type::base_name_length + 6)
+ name_length,
+ name_info::name_length + difference
)
-protected:
- static void init_base_name(bchar* the_base_name)
+ static void init_name(bchar* the_name)
{
- bchar* cur_pos = the_base_name;
+ bchar* cur_pos = the_name;
//
// copy the name of the base type
- bstrcpy(cur_pos, meta_type::base_name());
- cur_pos += meta_type::base_name_length;
+ bstrcpy(cur_pos, name_info::name());
+ cur_pos += name_info::name_length;
//
// append the const keyword
bstrcpy(cur_pos, BOOST_STR_LIT(" const"));
- cur_pos += 6;
+ cur_pos += difference;
//
// finalize the string
- assert(cur_pos == (the_base_name + base_name_length));
+ assert(cur_pos == (the_name + name_length));
*cur_pos = BOOST_STR_LIT('\0');
}
};
template <class meta_type>
struct static_const_type_name : static_nontrivial_type_name<
- static_const_type_name_base<meta_type>
+ meta_type, void, static_const_type_name_base
>{ };
Modified: sandbox/mirror/boost/mirror/detail/cv_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/cv_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/cv_type_name.hpp 2008-04-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -17,37 +17,42 @@
namespace mirror {
namespace detail {
-template <class meta_type>
+template <class meta_type, typename dummy, bool base_type>
struct static_cv_type_name_base
{
+protected:
+ typedef nontrivial_type_base_or_full_name<meta_type, base_type>
+ name_info;
+
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(size_t, difference, 15)
+
BOOST_MIRROR_CONST_MEMBER_ATTRIB(
size_t,
- base_name_length,
- (meta_type::base_name_length + 15)
+ name_length,
+ name_info::name_length + difference
)
-protected:
- static void init_base_name(bchar* the_base_name)
+ static void init_name(bchar* the_name)
{
- bchar* cur_pos = the_base_name;
+ bchar* cur_pos = the_name;
//
// copy the name of the base type
- bstrcpy(cur_pos, meta_type::base_name());
- cur_pos += meta_type::base_name_length;
+ bstrcpy(cur_pos, name_info::name());
+ cur_pos += name_info::name_length;
//
- // append the const keyword
+ // append the cv keyword
bstrcpy(cur_pos, BOOST_STR_LIT(" const volatile"));
- cur_pos += 15;
+ cur_pos += difference;
//
// finalize the string
- assert(cur_pos == (the_base_name + base_name_length));
+ assert(cur_pos == (the_name + name_length));
*cur_pos = BOOST_STR_LIT('\0');
}
};
template <class meta_type>
struct static_cv_type_name : static_nontrivial_type_name<
- static_cv_type_name_base<meta_type>
+ meta_type, void, static_cv_type_name_base
>{ };
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-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -14,16 +14,79 @@
namespace mirror {
namespace detail {
-template <class implementation>
-struct static_nontrivial_type_name : implementation
+template <class meta_type, bool true_or_false>
+struct nontrivial_type_base_or_full_name;
+
+/** Base name
+ */
+template <class meta_type>
+struct nontrivial_type_base_or_full_name<meta_type, true>
{
- static const bchar* base_name(void)
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ name_length,
+ meta_type::base_name_length
+ )
+ inline static const bchar* name(void)
+ {
+ return meta_type::base_name();
+ }
+};
+
+/** Full name
+ */
+template <class meta_type>
+struct nontrivial_type_base_or_full_name<meta_type, false>
+{
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ name_length,
+ meta_type::full_name_length
+ )
+ inline static const bchar* name(void)
+ {
+ return meta_type::full_name();
+ }
+};
+
+template <class meta_type, typename meta_data, template <class, typename, bool> class implementation>
+struct static_nontrivial_type_name
+: implementation<meta_type, meta_data, true>
+, implementation<meta_type, meta_data, false>
+{
+private:
+ typedef typename implementation<meta_type, meta_data, true> implementation_base_name;
+ typedef typename implementation<meta_type, meta_data, false> implementation_full_name;
+
+ template <bool base_name>
+ static const bchar* get_name(mpl::bool_<base_name>)
{
- static bchar the_base_name[implementation::base_name_length+1]
+ typedef typename implementation<meta_type, meta_data, base_name>
+ impl;
+ static bchar the_name[impl::name_length+1]
= {BOOST_STR_LIT("")};
- if(!the_base_name[0])
- implementation::init_base_name(the_base_name);
- return the_base_name;
+ if(!the_name[0])
+ impl::init_name(the_name);
+ return the_name;
+ }
+public:
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ base_name_length,
+ implementation_base_name::name_length
+ )
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ full_name_length,
+ implementation_full_name::name_length
+ )
+ static const bchar* base_name(void)
+ {
+ return get_name(mpl::bool_<true>());
+ }
+ static const bchar* full_name(void)
+ {
+ return get_name(mpl::bool_<false>());
}
};
Modified: sandbox/mirror/boost/mirror/detail/pointer_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/pointer_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/pointer_type_name.hpp 2008-04-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -17,10 +17,9 @@
namespace mirror {
namespace detail {
-
template <class meta_type>
-struct static_pointer_type_name : static_ptr_ref_type_name<
- meta_type, BOOST_STR_LIT('*')
+struct static_pointer_type_name : static_nontrivial_type_name<
+ meta_type, void, static_pointer_type_name_base
>{ };
Modified: sandbox/mirror/boost/mirror/detail/ptr_ref_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/ptr_ref_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/ptr_ref_type_name.hpp 2008-04-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -17,41 +17,58 @@
namespace mirror {
namespace detail {
-template <class meta_type, bchar token, bchar token2>
+template <class meta_type, bool base_name, bchar token, bchar token2>
struct static_ptr_ref_type_name_base
{
+protected:
+ typedef nontrivial_type_base_or_full_name<meta_type, base_name>
+ name_info;
+
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(size_t, difference, 3)
+
BOOST_MIRROR_CONST_MEMBER_ATTRIB(
size_t,
- base_name_length,
- (meta_type::base_name_length + 3)
+ name_length,
+ name_info::name_length + difference
)
-protected:
- static void init_base_name(bchar* the_base_name)
+ static void init_name(bchar* the_name)
{
- bchar* cur_pos = the_base_name;
+ bchar* cur_pos = the_name;
//
// copy the name of the template
- bstrcpy(cur_pos, meta_type::base_name());
- cur_pos += meta_type::base_name_length;
+ bstrcpy(cur_pos, name_info::name());
+ cur_pos += name_info::name_length;
//
// append the " * " or " & "
- assert(cur_pos+3 == (the_base_name + base_name_length));
+ assert(cur_pos == (the_name + name_info::name_length));
*(cur_pos++) = BOOST_STR_LIT(' ');
*(cur_pos++) = token;
*(cur_pos++) = token2;
//
// finalize the string
- assert(cur_pos == (the_base_name + base_name_length));
+ assert(cur_pos == (the_name + name_length));
*cur_pos = BOOST_STR_LIT('\0');
}
};
-template <class meta_type, bchar token, bchar token2 = BOOST_STR_LIT(' ')>
-struct static_ptr_ref_type_name : static_nontrivial_type_name<
- static_ptr_ref_type_name_base<meta_type, token, token2>
+template <class meta_type, typename dummy, bool base_name>
+struct static_pointer_type_name_base
+: static_ptr_ref_type_name_base<
+ meta_type,
+ base_name,
+ BOOST_STR_LIT(' '),
+ BOOST_STR_LIT('*')
>{ };
+template <class meta_type, typename dummy, bool base_name>
+struct static_reference_type_name_base
+: static_ptr_ref_type_name_base<
+ meta_type,
+ base_name,
+ BOOST_STR_LIT(' '),
+ BOOST_STR_LIT('&')
+>{ };
} // namespace detail
} // namespace mirror
Modified: sandbox/mirror/boost/mirror/detail/reference_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/reference_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/reference_type_name.hpp 2008-04-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -19,8 +19,8 @@
template <class meta_type>
-struct static_reference_type_name : static_ptr_ref_type_name<
- meta_type, BOOST_STR_LIT('&')
+struct static_reference_type_name : static_nontrivial_type_name<
+ meta_type, void, static_reference_type_name_base
>{ };
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-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -23,29 +23,34 @@
namespace mirror {
namespace detail {
-template <typename base_type>
-struct get_base_type_name_length_type
-{
- typedef typename mpl::int_<
- BOOST_MIRROR_REFLECT_TYPE(base_type)::base_name_length
- > type;
-};
-
/** The length is calculated assuming that the string is
* going to be formatted like this:
* template_name|< |T1|, |T2|, |...|Tn| > (without the
* delimiting '|'s.
*/
-template <class meta_type, class typelist, int template_name_length>
+template <class typelist, bool base_name>
struct static_template_name_length
{
+ template <typename a_type>
+ struct get_type_name_length_type
+ {
+ typedef BOOST_MIRROR_REFLECT_TYPE(a_type) meta_type;
+
+ typedef nontrivial_type_base_or_full_name<meta_type, base_name>
+ name_info;
+
+ typedef typename mpl::int_<
+ name_info::name_length
+ > type;
+ };
+
typedef typename mpl::accumulate<
typelist,
- mpl::int_<template_name_length+2>,
+ mpl::int_<2>,
mpl::plus<
mpl::_1,
mpl::plus<
- get_base_type_name_length_type<mpl::_2>,
+ get_type_name_length_type<mpl::_2>,
mpl::int_<2>
>
>
@@ -53,19 +58,9 @@
};
-template <class meta_type, class typelist, int template_name_length>
+template <class meta_type, class typelist, bool base_name>
struct static_template_name_base
{
- BOOST_MIRROR_CONST_MEMBER_ATTRIB(
- size_t,
- base_name_length,
- (static_template_name_length<
- meta_type,
- typelist,
- template_name_length
- >::type::value)
- )
-
protected:
/** The 'position' of the last type in the template
* type list.
@@ -79,8 +74,10 @@
{
typedef typename mpl::at<typelist, mpl::int_<I> >::type type;
typedef BOOST_MIRROR_REFLECT_TYPE(type) meta_type;
- bstrcpy(cur_pos, meta_type::base_name());
- cur_pos += meta_type::base_name_length;
+ typedef nontrivial_type_base_or_full_name<meta_type, base_name>
+ local_name_info;
+ bstrcpy(cur_pos, local_name_info::name());
+ cur_pos += local_name_info::name_length;
return cur_pos;
}
@@ -98,16 +95,34 @@
return do_append_type_name(cur_pos, type_pos);
}
- static void init_base_name(bchar* the_base_name)
+ typedef nontrivial_type_base_or_full_name<meta_type, base_name>
+ name_info;
+
+ typedef typename static_template_name_length<typelist, base_name>::type
+ template_param_list_length_type;
+
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ difference,
+ template_param_list_length_type::value
+ )
+
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ name_length,
+ name_info::name_length + difference
+ )
+
+ static void init_name(bchar* the_name)
{
- bchar* cur_pos = the_base_name;
+ bchar* cur_pos = the_name;
//
// copy the name of the template
- bstrcpy(cur_pos, meta_type::template_base_name());
- cur_pos += template_name_length;
+ bstrcpy(cur_pos, name_info::name());
+ cur_pos += name_info::name_length;
//
// append the leading "< "
- assert(cur_pos+2 < (the_base_name + base_name_length));
+ assert(cur_pos+2 < (the_name + name_length));
bstrcpy(cur_pos, BOOST_STR_LIT("< "));
cur_pos += 2;
//
@@ -115,19 +130,18 @@
cur_pos = append_type_name(cur_pos, last_type_pos());
//
// append the final " >"
- assert(cur_pos+2 == (the_base_name + base_name_length));
bstrcpy(cur_pos, BOOST_STR_LIT(" >"));
cur_pos += 2;
//
// finalize the string
- assert(cur_pos == (the_base_name + base_name_length));
+ assert(cur_pos == (the_name + name_length));
*cur_pos = BOOST_STR_LIT('\0');
}
};
-template <class meta_type, class typelist, int template_name_length>
+template <class meta_type, class typelist>
struct static_template_name : static_nontrivial_type_name<
- static_template_name_base<meta_type, typelist, template_name_length>
+ meta_type, typelist, static_template_name_base
>{ };
Modified: sandbox/mirror/boost/mirror/detail/volatile_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/volatile_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/volatile_type_name.hpp 2008-04-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -17,37 +17,42 @@
namespace mirror {
namespace detail {
-template <class meta_type>
+template <class meta_type, typename dummy, bool base_type>
struct static_volatile_type_name_base
{
+protected:
+ typedef nontrivial_type_base_or_full_name<meta_type, base_type>
+ name_info;
+
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(size_t, difference, 9)
+
BOOST_MIRROR_CONST_MEMBER_ATTRIB(
size_t,
- base_name_length,
- (meta_type::base_name_length + 9)
+ name_length,
+ name_info::name_length + difference
)
-protected:
- static void init_base_name(bchar* the_base_name)
+ static void init_name(bchar* the_name)
{
- bchar* cur_pos = the_base_name;
+ bchar* cur_pos = the_name;
//
// copy the name of the base type
- bstrcpy(cur_pos, meta_type::base_name());
- cur_pos += meta_type::base_name_length;
+ bstrcpy(cur_pos, name_info::name());
+ cur_pos += name_info::name_length;
//
- // append the const keyword
+ // append the volatile keyword
bstrcpy(cur_pos, BOOST_STR_LIT(" volatile"));
- cur_pos += 9;
+ cur_pos += difference;
//
// finalize the string
- assert(cur_pos == (the_base_name + base_name_length));
+ assert(cur_pos == (the_name + name_length));
*cur_pos = BOOST_STR_LIT('\0');
}
};
template <class meta_type>
struct static_volatile_type_name : static_nontrivial_type_name<
- static_volatile_type_name_base<meta_type>
+ meta_type, void, static_volatile_type_name_base
>{ };
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-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -18,13 +18,14 @@
#include <boost/preprocessor.hpp>
//
//
-#include <boost/mirror/detail/pointer_type_name.hpp>
-#include <boost/mirror/detail/reference_type_name.hpp>
-#include <boost/mirror/detail/array_type_name.hpp>
#include <boost/mirror/detail/const_type_name.hpp>
#include <boost/mirror/detail/volatile_type_name.hpp>
#include <boost/mirror/detail/cv_type_name.hpp>
+#include <boost/mirror/detail/pointer_type_name.hpp>
+#include <boost/mirror/detail/reference_type_name.hpp>
+#include <boost/mirror/detail/array_type_name.hpp>
+
namespace boost {
namespace mirror {
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-04-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -18,17 +18,39 @@
namespace boost {
namespace mirror {
+namespace detail {
+
+template <typename first_type, typename second_type>
+struct meta_type_std_pair
+{
+
+ static const bchar* base_name(void){return BOOST_STR_LIT("pair");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ base_name_length,
+ 4
+ )
+
+ static const bchar* full_name(void){return BOOST_STR_LIT("::std::pair");}
+ BOOST_MIRROR_CONST_MEMBER_ATTRIB(
+ size_t,
+ full_name_length,
+ 11
+ )
+};
+
+} // namespace detail
+
+
template <typename first_type, typename second_type>
struct meta_type< ::std::pair<first_type, second_type> >
: detail::static_template_name<
- meta_type< ::std::pair<first_type, second_type> > ,
- mpl::vector2<first_type, second_type>,
- BOOST_STR_LIT_LENGTH("pair")
+ detail::meta_type_std_pair<first_type, second_type> ,
+ mpl::vector2<first_type, second_type>
>
-{
+{
typedef BOOST_MIRROR_REFLECT_NAMESPACE(_std) scope;
- typedef ::std::pair<first_type, second_type> base_type;
- static const bchar* template_base_name(void){return BOOST_STR_LIT("pair");}
+ typedef ::std::pair<first_type, second_type> base_type;
};
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-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -66,5 +66,11 @@
- NOTE: full_name getter not available yet for all meta_types
- NOTE: tested only with MSVC++ 2008 EE
</revision>
+ <revision id="20080425_2052CET" major="0" minor="1" micro="11" author="m_ch">
+ - Finished full name getters
+ - Modified meta_type for std::pair
+ - Updated example showing the reflection of std::pair
+ - NOTE: tested only with MSVC++ 2008 EE
+ </revision>
</revisions>
</library>
Modified: sandbox/mirror/libs/examples/registering/types.cpp
==============================================================================
--- sandbox/mirror/libs/examples/registering/types.cpp (original)
+++ sandbox/mirror/libs/examples/registering/types.cpp 2008-04-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -146,6 +146,9 @@
bcout << "|27| " << BOOST_MIRROR_REFLECT_TYPE(bchar) ::full_name() << endl;
bcout << "|28| " << BOOST_MIRROR_REFLECT_TYPEDEFD(_boost, bchar) ::full_name() << endl;
bcout << "|29| " << BOOST_MIRROR_REFLECT_TYPEDEFD(_boost, bstring) ::full_name() << endl;
+ bcout << "|30| " << BOOST_MIRROR_REFLECT_TYPE(int const * const volatile) ::full_name() << endl;
+ bcout << "|31| " << BOOST_MIRROR_REFLECT_TYPE(int volatile * const * volatile) ::full_name() << endl;
+ bcout << "|32| " << BOOST_MIRROR_REFLECT_TYPE(int const * const [321]) ::full_name() << 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-25 14:54:34 EDT (Fri, 25 Apr 2008)
@@ -17,8 +17,6 @@
#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>
int main(void)
@@ -35,8 +33,15 @@
typedef ::std::pair<T3 const * volatile, const T4&> T;
//
typedef BOOST_MIRROR_REFLECT_TYPE(T) meta_T;
- bcout << "The type name length = " << meta_T::base_name_length << endl;
+ //
+ 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;
}
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