Boost logo

Boost-Commit :

From: chochlik_at_[hidden]
Date: 2008-07-04 15:29:53


Author: matus.chochlik
Date: 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
New Revision: 47084
URL: http://svn.boost.org/trac/boost/changeset/47084

Log:
- Changed the return value of base_name and full_name getters from const bchar* to const bstring&
- Replaced BOOST_MIRROR_REG_TYPE_GLOBAL_SCOPE(TYPE) with BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(TYPE) macro

- Added get_name(mpl::bool_<FullName>) function that gets the base name with mpl::false_ and full name with mpl::true_
- Removed the old non-trivial type name meta_types
- Added new meta_type name decorator

Added:
   sandbox/mirror/boost/mirror/detail/decorated_type_name.hpp
      - copied, changed from r47071, /sandbox/mirror/boost/mirror/detail/nontrivial_type_name.hpp
Removed:
   sandbox/mirror/boost/mirror/detail/array_type_name.hpp
   sandbox/mirror/boost/mirror/detail/const_type_name.hpp
   sandbox/mirror/boost/mirror/detail/cv_type_name.hpp
   sandbox/mirror/boost/mirror/detail/nontrivial_type_name.hpp
   sandbox/mirror/boost/mirror/detail/pointer_type_name.hpp
   sandbox/mirror/boost/mirror/detail/ptr_ref_type_name.hpp
   sandbox/mirror/boost/mirror/detail/reference_type_name.hpp
   sandbox/mirror/boost/mirror/detail/volatile_type_name.hpp
Text files modified:
   sandbox/mirror/boost/mirror/detail/decorated_type_name.hpp | 223 +++++++++++++++---------
   sandbox/mirror/boost/mirror/detail/full_name_builder.hpp | 55 ++++-
   sandbox/mirror/boost/mirror/meta_data_fwd.hpp | 37 +++-
   sandbox/mirror/boost/mirror/meta_namespace.hpp | 125 ++++++++++----
   sandbox/mirror/boost/mirror/meta_type.hpp | 353 +++++++++++++++++++--------------------
   sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml | 12 +
   sandbox/mirror/libs/mirror/example/registering/namespaces.cpp | 9
   sandbox/mirror/libs/mirror/example/registering/types.cpp | 37 +++
   8 files changed, 508 insertions(+), 343 deletions(-)

Deleted: sandbox/mirror/boost/mirror/detail/array_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/array_type_name.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
+++ (empty file)
@@ -1,106 +0,0 @@
-/**
- * \file boost/mirror/detail/array_type_name.hpp
- * Helpers for composing array type names
- *
- * 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_DETAIL_ARRAY_TYPE_NAME_HPP
-#define BOOST_MIRROR_META_DETAIL_ARRAY_TYPE_NAME_HPP
-
-#include <assert.h>
-#include <boost/mirror/detail/nontrivial_type_name.hpp>
-#include <boost/mirror/detail/static_int_to_str.hpp>
-
-namespace boost {
-namespace mirror {
-namespace detail {
-
-
-template <class MetaType, class ArraySize, bool BaseName>
-struct static_array_type_name_base
-{
-protected:
- typedef typename detail::static_int_to_str<ArraySize::value>
- size_as_string;
-
- typedef nontrivial_type_base_or_full_name<MetaType, BaseName>
- name_info;
-
- BOOST_STATIC_CONSTANT(size_t, difference = 3 + size_as_string::length::value);
-
- BOOST_STATIC_CONSTANT(
- size_t,
- name_length =
- name_info::name_length + difference
- );
-
- static void init_name(bchar* the_name)
- {
- bchar* cur_pos = the_name;
- //
- // copy the name of the template
- 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
- 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_name + name_length));
- *cur_pos = BOOST_STR_LIT('\0');
- }
-};
-
-template <class MetaType, bool BaseName>
-struct static_array_type_name_base<MetaType, mpl::int_<-1>, BaseName>
-{
-protected:
- typedef nontrivial_type_base_or_full_name<MetaType, BaseName>
- name_info;
-
- BOOST_STATIC_CONSTANT(
- size_t,
- name_length =
- name_info::name_length + 3
- );
-
- static void init_name(bchar* the_name)
- {
- bchar* cur_pos = the_name;
- //
- // copy the name of the template
- bstrcpy(cur_pos, name_info::name());
- cur_pos += name_info::name_length;
- //
- // append the " []"
- *(cur_pos++) = BOOST_STR_LIT(' ');
- *(cur_pos++) = BOOST_STR_LIT('[');
- *(cur_pos++) = BOOST_STR_LIT(']');
- //
- // finalize the string
- assert(cur_pos == (the_name + name_length));
- *cur_pos = BOOST_STR_LIT('\0');
- }
-};
-
-
-template <class MetaType, int ArraySize>
-struct static_array_type_name : static_nontrivial_type_name<
- MetaType, mpl::int_<ArraySize>, static_array_type_name_base
->{ };
-
-} // namespace detail
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Deleted: sandbox/mirror/boost/mirror/detail/const_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/const_type_name.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
+++ (empty file)
@@ -1,64 +0,0 @@
-/**
- * \file boost/mirror/detail/const_type_name.hpp
- * Helpers for composing const type names
- *
- * 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_DETAIL_CONST_TYPE_NAME_HPP
-#define BOOST_MIRROR_META_DETAIL_CONST_TYPE_NAME_HPP
-
-#include <assert.h>
-#include <boost/mirror/detail/nontrivial_type_name.hpp>
-
-namespace boost {
-namespace mirror {
-namespace detail {
-
-template <class MetaType, typename Dummy, bool BaseName>
-struct static_const_type_name_base
-{
-protected:
- typedef nontrivial_type_base_or_full_name<MetaType, BaseName>
- name_info;
-
- BOOST_STATIC_CONSTANT(int, difference = 6);
-
- BOOST_STATIC_CONSTANT(
- int,
- name_length =
- name_info::name_length + difference
- );
-
- static void init_name(bchar* the_name)
- {
- bchar* cur_pos = the_name;
- //
- // copy the name of the base type
- 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 += difference;
- //
- // finalize the string
- assert(cur_pos == (the_name + name_length));
- *cur_pos = BOOST_STR_LIT('\0');
- }
-};
-
-template <class MetaType>
-struct static_const_type_name : static_nontrivial_type_name<
- MetaType, void, static_const_type_name_base
->{ };
-
-
-} // namespace detail
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Deleted: sandbox/mirror/boost/mirror/detail/cv_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/cv_type_name.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
+++ (empty file)
@@ -1,64 +0,0 @@
-/**
- * \file boost/mirror/detail/cv_type_name.hpp
- * Helpers for composing a const volatile type name
- *
- * 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_DETAIL_CV_TYPE_NAME_HPP
-#define BOOST_MIRROR_META_DETAIL_CV_TYPE_NAME_HPP
-
-#include <assert.h>
-#include <boost/mirror/detail/nontrivial_type_name.hpp>
-
-namespace boost {
-namespace mirror {
-namespace detail {
-
-template <class MetaType, typename Dummy, bool BaseName>
-struct static_cv_type_name_base
-{
-protected:
- typedef nontrivial_type_base_or_full_name<MetaType, BaseName>
- name_info;
-
- BOOST_STATIC_CONSTANT(int, difference = 15);
-
- BOOST_STATIC_CONSTANT(
- int,
- name_length =
- name_info::name_length + difference
- );
-
- static void init_name(bchar* the_name)
- {
- bchar* cur_pos = the_name;
- //
- // copy the name of the base type
- bstrcpy(cur_pos, name_info::name());
- cur_pos += name_info::name_length;
- //
- // append the cv keyword
- bstrcpy(cur_pos, BOOST_STR_LIT(" const volatile"));
- cur_pos += difference;
- //
- // finalize the string
- assert(cur_pos == (the_name + name_length));
- *cur_pos = BOOST_STR_LIT('\0');
- }
-};
-
-template <class MetaType>
-struct static_cv_type_name : static_nontrivial_type_name<
- MetaType, void, static_cv_type_name_base
->{ };
-
-
-} // namespace detail
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Copied: sandbox/mirror/boost/mirror/detail/decorated_type_name.hpp (from r47071, /sandbox/mirror/boost/mirror/detail/nontrivial_type_name.hpp)
==============================================================================
--- /sandbox/mirror/boost/mirror/detail/nontrivial_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/decorated_type_name.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
@@ -1,121 +1,174 @@
 /**
- * \file boost/mirror/detail/nontrivial_type_name.hpp
- * Helpers for composing a nontrivial typenames
+ * \file boost/mirror/detail/decorated_type_name.hpp
+ *
+ * Helpers for composing nontrivial typenames
  *
  * 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_DETAIL_NONTRIVIAL_TYPE_NAME_HPP
-#define BOOST_MIRROR_META_DETAIL_NONTRIVIAL_TYPE_NAME_HPP
+#ifndef BOOST_MIRROR_META_DETAIL_DECORATED_TYPE_NAME_HPP
+#define BOOST_MIRROR_META_DETAIL_DECORATED_TYPE_NAME_HPP
+
+#include <boost/mpl/plus.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mirror/detail/static_int_to_str.hpp>
 
-#ifndef BOOST_MIRROR_USE_STATIC_NAME_STRINGS
-# include <memory> // ::std::auto ptr
-#endif
 namespace boost {
 namespace mirror {
 namespace detail {
 
-template <class MetaType, bool BaseOrFull>
-struct nontrivial_type_base_or_full_name;
-
-/** Base name
- */
-template <class MetaType>
-struct nontrivial_type_base_or_full_name<MetaType, true>
+template <class MetaType, class Decorator>
+struct decorated_type_name
 {
- BOOST_STATIC_CONSTANT(
- int,
- name_length =
- MetaType::base_name_length
- );
- inline static const bchar* name(void)
+private:
+ template <bool FullName>
+ inline static bstring init_name(
+ mpl::bool_<FullName> _full,
+ const bstring& left,
+ const bstring& right
+ )
+ {
+ bstring res(Decorator::prefix());
+ res.append(MetaType::get_name(_full));
+ res.append(Decorator::postfix());
+ return res;
+ }
+public:
+ template <bool FullName>
+ static const bstring& get_name(
+ mpl::bool_<FullName> _full,
+ const bstring& left = bstring(),
+ const bstring& right = bstring()
+ )
+ {
+ static bstring s_name(
+ init_name(_full, left, right)
+ );
+ return s_name;
+ }
+
+ inline static const bstring& base_name(void)
+ {
+ return get_name(mpl::false_());
+ }
+
+ inline static const bstring& full_name(void)
         {
- return MetaType::base_name();
+ return get_name(mpl::true_());
         }
+
 };
 
-/** Full name
- */
-template <class MetaType>
-struct nontrivial_type_base_or_full_name<MetaType, false>
+// no-op decorator
+template <typename T>
+struct type_name_decorator
 {
- BOOST_STATIC_CONSTANT(
- int,
- name_length =
- MetaType::full_name_length
- );
- inline static const bchar* name(void)
+ inline static bstring prefix(void){return bstring();}
+ inline static bstring postfix(void){return bstring();}
+};
+
+// pointer decorator
+template <typename T>
+struct type_name_decorator<T*>
+{
+ inline static bstring prefix(void){return bstring();}
+ inline static bstring postfix(void)
         {
- return MetaType::full_name();
+ return bstring(BOOST_STR_LIT(" *"));
         }
 };
 
-template <class MetaType, typename MetaData, template <class, typename, bool> class Implementation>
-struct static_nontrivial_type_name
-: Implementation<MetaType, MetaData, true>
-, Implementation<MetaType, MetaData, false>
+// array decorator
+template <typename T, size_t Size>
+struct type_name_decorator< T[ Size ] >
 {
 private:
- typedef Implementation<MetaType, MetaData, true> implementation_base_name;
- typedef Implementation<MetaType, MetaData, false> implementation_full_name;
-
- inline static bchar* new_string(const size_t size)
+ inline static bstring init_postfix(void)
         {
- assert(size != 0);
- bchar* result = new bchar[size];
- result[0] = 0;
- return result;
- }
-
- inline static bool name_not_initialized(const bchar* str)
- {
- return !str[0];
- }
-
- template <bool FormatBaseName>
- static const bchar* get_name(mpl::bool_<FormatBaseName>)
- {
- typedef Implementation<MetaType, MetaData, FormatBaseName>
- impl;
- const int name_len(impl::name_length);
-#ifndef BOOST_MIRROR_USE_DYNAMIC_NAME_STRINGS
- //static bchar the_name[name_len + 1] = {BOOST_STR_LIT("")};
- // TODO: the previews line won't compile since
- // name_len is not an integral constant.
- // Thus we need to find some better workaround
- // because this one will cause memory leaks.
- static bchar* the_name = new_string(name_len+1);
-#else
- static ::std::auto_ptr<bchar> the_name_holder(new_string(name_len+1));
- bchar* the_name = the_name_holder.get();
-#endif
- if(name_not_initialized(the_name))
- impl::init_name(the_name);
- return the_name;
+ typedef typename detail::static_int_to_str<Size>
+ size_string;
+ // init with '['
+ bstring res(BOOST_STR_LIT(" ["));
+ //
+ // setup a buffer for the number
+ const size_t max_size = size_string::length::value+1;
+ bchar buffer[max_size];
+ // put it into the buffer
+ size_string::convert(buffer, max_size);
+ // append the buffer
+ res.append(bstring(buffer));
+ // append ']'
+ res.append(bstring(BOOST_STR_LIT("]")));
+ return res;
         }
 public:
- BOOST_STATIC_CONSTANT(
- int,
- base_name_length =
- implementation_base_name::name_length
- );
- BOOST_STATIC_CONSTANT(
- int,
- full_name_length =
- implementation_full_name::name_length
- );
- static const bchar* base_name(void)
+ inline static bstring prefix(void){return bstring();}
+ inline static const bstring& postfix(void)
+ {
+ static bstring s_postfix(init_postfix());
+ return s_postfix;
+ }
+};
+
+// array decorator
+template <typename T>
+struct type_name_decorator< T[] >
+{
+ inline static bstring prefix(void){return bstring();}
+ inline static bstring postfix(void)
+ {
+ return bstring(BOOST_STR_LIT(" []"));
+ }
+};
+
+
+// reference decorator
+template <typename T>
+struct type_name_decorator<T&>
+{
+ inline static bstring prefix(void){return bstring();}
+ inline static bstring postfix(void)
+ {
+ return bstring(BOOST_STR_LIT(" &"));
+ }
+};
+
+// const type decorator
+template <typename T>
+struct type_name_decorator<const T>
+{
+ inline static bstring prefix(void){return bstring();}
+ inline static bstring postfix(void)
         {
- return get_name(mpl::bool_<true>());
+ return bstring(BOOST_STR_LIT(" const"));
         }
- static const bchar* full_name(void)
+};
+
+// volatile type decorator
+template <typename T>
+struct type_name_decorator<volatile T>
+{
+ inline static bstring prefix(void){return bstring();}
+ inline static bstring postfix(void)
         {
- return get_name(mpl::bool_<false>());
+ return bstring(BOOST_STR_LIT(" volatile"));
         }
 };
 
+// const volatile type decorator
+template <typename T>
+struct type_name_decorator<const volatile T>
+{
+ inline static bstring prefix(void){return bstring();}
+ inline static bstring postfix(void)
+ {
+ return bstring(BOOST_STR_LIT(" const volatile"));
+ }
+};
+
+
 } // namespace detail
 } // namespace mirror
 } // namespace boost

Modified: sandbox/mirror/boost/mirror/detail/full_name_builder.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/full_name_builder.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/full_name_builder.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
@@ -16,6 +16,8 @@
 // template meta programming
 #include <boost/mpl/int.hpp>
 #include <boost/mpl/plus.hpp>
+#include <boost/mpl/identity.hpp>
+
 
 // forward declarations and common mirror defs
 #include <boost/mirror/common_defs.hpp>
@@ -27,6 +29,8 @@
 namespace boost {
 namespace mirror {
 
+namespace namespace_ {struct _;}
+
 namespace detail {
         
         /** Helper template that builds the fully qualified names
@@ -36,28 +40,51 @@
         struct full_name_builder : public BaseMetaObject
         {
         private:
+ template <typename AnyScope, class AnyMO>
+ inline static void append_separator(
+ bstring& _str,
+ mpl::identity<AnyScope>,
+ mpl::identity<AnyMO>
+ )
+ {
+ static const bstring separator(BOOST_STR_LIT("::"));
+ _str.append(separator);
+ }
+
+ // don't prepend '::' to types on global scope
+ template <typename Type>
+ inline static void append_separator(
+ bstring& _str,
+ mpl::identity<meta_namespace<namespace_::_> >,
+ mpl::identity<detail::registered_type_info<Type> >
+ )
+ { }
+
+
                 // initializes the full names
- inline static bstring init_full_name(void)
+ inline static bstring init_name(void)
                 {
- bstring res(Scope::full_name());
- res.append(bstring(BOOST_STR_LIT("::")));
- res.append(bstring(BaseMetaObject::base_name()));
+ bstring res(Scope::get_name(mpl::true_()));
+ append_separator(
+ res,
+ mpl::identity<Scope>(),
+ mpl::identity<BaseMetaObject>()
+ );
+ res.append(BaseMetaObject::get_name(mpl::false_()));
                         return res;
                 }
         public:
+ // base name getter
+ inline static const bstring& get_name(mpl::false_ _base)
+ {
+ return BaseMetaObject::get_name(_base);
+ }
                 // full name getter
- inline static const bchar* full_name(void)
+ inline static const bstring& get_name(mpl::true_)
                 {
- static bstring s_full_name(init_full_name());
- return s_full_name.c_str();
+ static bstring s_name(init_name());
+ return s_name;
                 }
-
- // the full name length
- typedef typename ::boost::mpl::plus<
- typename Scope::full_name_length,
- typename ::boost::mpl::int_<2>::type,
- typename BaseMetaObject::base_name_length
- >::type full_name_length;
         };
         
         

Deleted: sandbox/mirror/boost/mirror/detail/nontrivial_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/nontrivial_type_name.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
+++ (empty file)
@@ -1,124 +0,0 @@
-/**
- * \file boost/mirror/detail/nontrivial_type_name.hpp
- * Helpers for composing a nontrivial typenames
- *
- * 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_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 {
-
-template <class MetaType, bool BaseOrFull>
-struct nontrivial_type_base_or_full_name;
-
-/** Base name
- */
-template <class MetaType>
-struct nontrivial_type_base_or_full_name<MetaType, true>
-{
- BOOST_STATIC_CONSTANT(
- int,
- name_length =
- MetaType::base_name_length
- );
- inline static const bchar* name(void)
- {
- return MetaType::base_name();
- }
-};
-
-/** Full name
- */
-template <class MetaType>
-struct nontrivial_type_base_or_full_name<MetaType, false>
-{
- BOOST_STATIC_CONSTANT(
- int,
- name_length =
- MetaType::full_name_length
- );
- inline static const bchar* name(void)
- {
- return MetaType::full_name();
- }
-};
-
-template <class MetaType, typename MetaData, template <class, typename, bool> class Implementation>
-struct static_nontrivial_type_name
-: Implementation<MetaType, MetaData, true>
-, Implementation<MetaType, MetaData, false>
-{
-private:
- typedef Implementation<MetaType, MetaData, true> implementation_base_name;
- typedef Implementation<MetaType, MetaData, false> implementation_full_name;
-
- inline static bchar* new_string(const size_t size)
- {
- assert(size != 0);
- bchar* result = new bchar[size];
- result[0] = 0;
- return result;
- }
-
- inline static bool name_not_initialized(const bchar* str)
- {
- return !str[0];
- }
-
- template <bool FormatBaseName>
- static const bchar* get_name(mpl::bool_<FormatBaseName>)
- {
- typedef Implementation<MetaType, MetaData, FormatBaseName>
- impl;
- const int name_len(impl::name_length);
-#ifndef BOOST_MIRROR_USE_DYNAMIC_NAME_STRINGS
- //static bchar the_name[name_len + 1] = {BOOST_STR_LIT("")};
- // TODO: the previews line won't compile since
- // name_len is not an integral constant.
- // Thus we need to find some better workaround
- // because this one will cause memory leaks.
- static bchar* the_name = new_string(name_len+1);
-#else
- static ::std::auto_ptr<bchar> the_name_holder(new_string(name_len+1));
- bchar* the_name = the_name_holder.get();
-#endif
- if(name_not_initialized(the_name))
- impl::init_name(the_name);
- return the_name;
- }
-public:
- BOOST_STATIC_CONSTANT(
- int,
- base_name_length =
- implementation_base_name::name_length
- );
- BOOST_STATIC_CONSTANT(
- int,
- 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>());
- }
-};
-
-} // namespace detail
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Deleted: sandbox/mirror/boost/mirror/detail/pointer_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/pointer_type_name.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
+++ (empty file)
@@ -1,31 +0,0 @@
-/**
- * \file boost/mirror/detail/pointer_type_name.hpp
- * Helpers for composing a pointer type name
- *
- * 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_DETAIL_POINTER_TYPE_NAME_HPP
-#define BOOST_MIRROR_META_DETAIL_POINTER_TYPE_NAME_HPP
-
-#include <assert.h>
-#include <boost/mirror/detail/ptr_ref_type_name.hpp>
-
-namespace boost {
-namespace mirror {
-namespace detail {
-
-template <class MetaType>
-struct static_pointer_type_name : static_nontrivial_type_name<
- MetaType, void, static_pointer_type_name_base
->{ };
-
-
-} // namespace detail
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Deleted: sandbox/mirror/boost/mirror/detail/ptr_ref_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/ptr_ref_type_name.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
+++ (empty file)
@@ -1,78 +0,0 @@
-/**
- * \file boost/mirror/detail/ptr_ref_type_name.hpp
- * Helpers for composing pointer and reference type names
- *
- * 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_DETAIL_PTRREF_TYPE_NAME_HPP
-#define BOOST_MIRROR_META_DETAIL_PTRREF_TYPE_NAME_HPP
-
-#include <assert.h>
-#include <boost/mirror/detail/nontrivial_type_name.hpp>
-
-namespace boost {
-namespace mirror {
-namespace detail {
-
-template <class MetaType, bool BaseName, bchar Token, bchar Token2>
-struct static_ptr_ref_type_name_base
-{
-protected:
- typedef nontrivial_type_base_or_full_name<MetaType, BaseName>
- name_info;
-
- BOOST_STATIC_CONSTANT(int, difference = 3);
-
- BOOST_STATIC_CONSTANT(
- int,
- name_length =
- name_info::name_length + difference
- );
-
- static void init_name(bchar* the_name)
- {
- bchar* cur_pos = the_name;
- //
- // copy the name of the template
- bstrcpy(cur_pos, name_info::name());
- cur_pos += name_info::name_length;
- //
- // append the " * " or " & "
- 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_name + name_length));
- *cur_pos = BOOST_STR_LIT('\0');
- }
-};
-
-template <class MetaType, typename Dummy, bool BaseName>
-struct static_pointer_type_name_base
-: static_ptr_ref_type_name_base<
- MetaType,
- BaseName,
- BOOST_STR_LIT(' '),
- BOOST_STR_LIT('*')
->{ };
-
-template <class MetaType, typename Dummy, bool BaseName>
-struct static_reference_type_name_base
-: static_ptr_ref_type_name_base<
- MetaType,
- BaseName,
- BOOST_STR_LIT(' '),
- BOOST_STR_LIT('&')
->{ };
-
-} // namespace detail
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Deleted: sandbox/mirror/boost/mirror/detail/reference_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/reference_type_name.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
+++ (empty file)
@@ -1,32 +0,0 @@
-/**
- * \file boost/mirror/detail/reference_type_name.hpp
- * Helpers for composing a reference type name
- *
- * 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_DETAIL_REFERENCE_TYPE_NAME_HPP
-#define BOOST_MIRROR_META_DETAIL_REFERENCE_TYPE_NAME_HPP
-
-#include <assert.h>
-#include <boost/mirror/detail/ptr_ref_type_name.hpp>
-
-namespace boost {
-namespace mirror {
-namespace detail {
-
-
-template <class MetaType>
-struct static_reference_type_name : static_nontrivial_type_name<
- MetaType, void, static_reference_type_name_base
->{ };
-
-
-} // namespace detail
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Deleted: sandbox/mirror/boost/mirror/detail/volatile_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/volatile_type_name.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
+++ (empty file)
@@ -1,64 +0,0 @@
-/**
- * \file boost/mirror/detail/volatile_type_name.hpp
- * Helpers for composing volatile type names
- *
- * 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_DETAIL_VOLATILE_TYPE_NAME_HPP
-#define BOOST_MIRROR_META_DETAIL_VOLATILE_TYPE_NAME_HPP
-
-#include <assert.h>
-#include <boost/mirror/detail/nontrivial_type_name.hpp>
-
-namespace boost {
-namespace mirror {
-namespace detail {
-
-template <class MetaType, typename Dummy, bool BaseType>
-struct static_volatile_type_name_base
-{
-protected:
- typedef nontrivial_type_base_or_full_name<MetaType, BaseType>
- name_info;
-
- BOOST_STATIC_CONSTANT(int, difference = 9);
-
- BOOST_STATIC_CONSTANT(
- int,
- name_length =
- name_info::name_length + difference
- );
-
- static void init_name(bchar* the_name)
- {
- bchar* cur_pos = the_name;
- //
- // copy the name of the base type
- bstrcpy(cur_pos, name_info::name());
- cur_pos += name_info::name_length;
- //
- // append the volatile keyword
- bstrcpy(cur_pos, BOOST_STR_LIT(" volatile"));
- cur_pos += difference;
- //
- // finalize the string
- assert(cur_pos == (the_name + name_length));
- *cur_pos = BOOST_STR_LIT('\0');
- }
-};
-
-template <class MetaType>
-struct static_volatile_type_name : static_nontrivial_type_name<
- MetaType, void, static_volatile_type_name_base
->{ };
-
-
-} // namespace detail
-} // namespace mirror
-} // namespace boost
-
-#endif //include guard
-

Modified: sandbox/mirror/boost/mirror/meta_data_fwd.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_data_fwd.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_data_fwd.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
@@ -22,11 +22,31 @@
  * passed namespace.
  */
 #define BOOST_MIRRORED_NAMESPACE(FULL_NAMESPACE_NAME) \
- mirror::meta_namespace< namespace_ ## FULL_NAMESPACE_NAME ## ::_ >
+ ::boost::mirror::meta_namespace< \
+ ::boost::mirror::namespace_ \
+ FULL_NAMESPACE_NAME ## \
+ _boost_mirror_helper \
+ ::_ \
+ >
+// namespace_ :: _boost_mirror_helper :: _
+// namespace_ ::test_boost_mirror_helper :: _
+// namespace_ ::test::foo_boost_mirror_helper :: _
+// namespace_ ::test::foo::bar_boost_mirror_helper :: _
 
 #define BOOST_MIRRORED_GLOBAL_SCOPE() \
- mirror::meta_namespace< namespace_ ## ::_ >
+ ::boost::mirror::meta_namespace< \
+ ::boost::mirror::namespace_ ## ::_ \
+ >
 
+namespace detail {
+
+ /** Forward declaration of the template class
+ * containing registered type information
+ */
+ template <typename Type>
+ struct registered_type_info;
+
+} // namespace detail
 
 
 /** Meta-type forward template declaration
@@ -38,24 +58,23 @@
 /** Macro that expands into the meta_type for the
  * given type or class.
  */
-#define BOOST_MIRROR_REFLECT_TYPE(TYPE) \
+#define BOOST_MIRRORED_TYPE(TYPE) \
         ::boost::mirror::meta_type<TYPE>
 
 /** Macro that expands into the meta_type for the
  * given typedefined type.
  */
-#define BOOST_MIRROR_REFLECT_TYPEDEFD(NAMESPACE_ALIAS, TYPEDEFD) \
- ::boost::mirror::meta_type< BOOST_MIRROR_TYPEDEFD_SELECTOR(\
- NAMESPACE_ALIAS##_##TYPEDEFD, \
- TYPEDEFD\
- ) >
+#define BOOST_MIRRORED_TYPEDEF(NAMESPACE, TYPEDEF) \
+ ::boost::mirror::meta_type< \
+ BOOST_MIRROR_GET_TYPEDEFD_TYPE_SELECTOR(NAMESPACE, TYPEDEF) \
+ >
 
 /** Macro that expands into the meta_type for the
  * type of the given expression.
  * To get this going <boost/typeof/typeof.hpp>
  * has to be included.
  */
-#define BOOST_MIRROR_REFLECT_TYPEOF(EXPRESSION) \
+#define BOOST_MIRRORED_TYPEOF(EXPRESSION) \
         ::boost::mirror::meta_type<BOOST_TYPEOF(EXPRESSION)>
 
 

Modified: sandbox/mirror/boost/mirror/meta_namespace.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_namespace.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_namespace.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
@@ -15,10 +15,10 @@
 #include <boost/preprocessor/seq/reverse.hpp>
 #include <boost/preprocessor/seq/pop_back.hpp>
 #include <boost/preprocessor/seq/seq.hpp>
+#include <boost/preprocessor/cat.hpp>
 
 // template meta programming
-#include <boost/mpl/int.hpp>
-#include <boost/mpl/plus.hpp>
+#include <boost/mpl/bool.hpp>
 #include <boost/mpl/vector.hpp>
 #include <boost/mpl/push_back.hpp>
 
@@ -44,6 +44,17 @@
         NamespacePlaceholder
>
 {
+ inline static const bstring& base_name(void)
+ {
+ return get_name(mpl::false_());
+ }
+
+ inline static const bstring& full_name(void)
+ {
+ return get_name(mpl::true_());
+ }
+
+
         // the parent meta_namespace
         typedef meta_namespace<
                 typename NamespacePlaceholder::parent_placeholder
@@ -63,23 +74,32 @@
         struct _
         {
                 // the base name of the namespace
- inline static const bchar* base_name(void){return BOOST_STR_LIT("");}
-
- // length of the basename:number of characters w/o the terminating '\0'
- typedef ::boost::mpl::int_<0>::type base_name_length;
-
- // the base name of the namespace
- inline static const bchar* full_name(void){return base_name();}
+ inline static const bstring& get_name(mpl::false_)
+ {
+ static bstring s_name;
+ return s_name;
+ }
+
+ // the full name of the namespace
+ inline static const bstring& get_name(mpl::true_)
+ {
+ return get_name(mpl::false_());
+ }
+
+ inline static const bstring& base_name(void)
+ {
+ return get_name(mpl::false_());
+ }
+
+ inline static const bstring& full_name(void)
+ {
+ return get_name(mpl::true_());
+ }
 
- // the length of the full name without the terminating null
- typedef base_name_length full_name_length;
         };
 
- // this is necessary for MIRORRED_NAMESPACE() to work with
- // the global scope
- namespace __ {
- typedef struct namespace_::_ _;
- } // namespace __
+ namespace _boost_mirror_helper = ::boost::mirror::namespace_;
+
 } // namespace namespace_
 
 // meta_namespace specialization for the global scope
@@ -109,38 +129,71 @@
  *
  * The sequence needed to register namespace ::test is (test)
  * To register ::test::foo::bar::baz use (test)(foo)(bar)(baz)
+ *
+ * this macro expands for the sequence (test)(foo)(bar)(baz)
+ * this way:
+ * namespace namespace_ { // -1-
+ * namespace test {
+ * namespace foo {
+ * namespace bar {
+ * namespace baz { // -2-
+ * struct _ // -3-
+ * {
+ * typedef ::boost::mirror::namespace_::test::foo::bar::_
+ * parent_placeholder; // -4-
+ * static const bchar* get_name(mpl::false_)(return "baz";} // -5-
+ * };
+ * } // namespace baz
+ * namespace baz_boost_mirror_helper = // -7-
+ * ::boost::mirror::namespace_::test::foo::bar::baz; // -8-
+ * } // namespace bar
+ * } // namespace foo
+ * } // namespace test
+ * } // -9-
  */
 #define BOOST_MIRROR_REG_NAMESPACE(NAME_SEQUENCE) \
- namespace namespace_ { \
- BOOST_PP_SEQ_FOR_EACH(BOOST_MIRROR_REG_NAMESPACE_PROLOGUE_HELPER, _, NAME_SEQUENCE) \
- struct _ \
+ namespace namespace_ { /* -1- */ \
+ BOOST_PP_SEQ_FOR_EACH( \
+ BOOST_MIRROR_REG_NAMESPACE_PROLOGUE_HELPER, \
+ _, \
+ NAME_SEQUENCE \
+ ) /* -2- */ \
+ struct _ /* -3- */ \
                 { \
- typedef namespace_ \
+ typedef ::boost::mirror::namespace_ \
                         BOOST_PP_SEQ_FOR_EACH( \
                                 BOOST_MIRROR_REG_NAMESPACE_ENUM_HELPER, \
                                 _, \
                                 BOOST_PP_SEQ_POP_BACK(NAME_SEQUENCE) \
- ) :: _ parent_placeholder; \
- static const bchar* base_name(void) \
+ ) :: _ parent_placeholder; /* -4- */ \
+ static const bstring& get_name(mpl::false_) \
                         { \
- return BOOST_CTS_STRINGIZE( \
+ static bstring s_name(BOOST_CTS_STRINGIZE( \
                                         BOOST_PP_SEQ_HEAD( \
                                                 BOOST_PP_SEQ_REVERSE(NAME_SEQUENCE) \
                                         ) \
- ); \
- } \
- typedef ::boost::mpl::int_< \
- BOOST_STR_LIT_LENGTH( \
- BOOST_CTS_STRINGIZE( \
- BOOST_PP_SEQ_HEAD( \
- BOOST_PP_SEQ_REVERSE(NAME_SEQUENCE) \
- ) \
- ) \
- ) \
- >::type base_name_length; \
+ )); \
+ return s_name; \
+ } /* -5- */ \
                 }; \
- BOOST_PP_SEQ_FOR_EACH(BOOST_MIRROR_REG_NAMESPACE_EPILOGUE_HELPER, _, NAME_SEQUENCE) \
- }
+ } \
+ namespace BOOST_PP_CAT( \
+ BOOST_PP_SEQ_HEAD( \
+ BOOST_PP_SEQ_REVERSE( NAME_SEQUENCE ) \
+ ), \
+ _boost_mirror_helper \
+ ) = /* -7- */ \
+ ::boost::mirror::namespace_ \
+ BOOST_PP_SEQ_FOR_EACH( \
+ BOOST_MIRROR_REG_NAMESPACE_ENUM_HELPER, \
+ _, \
+ NAME_SEQUENCE \
+ ) ; /* -8- */ \
+ BOOST_PP_SEQ_FOR_EACH( \
+ BOOST_MIRROR_REG_NAMESPACE_EPILOGUE_HELPER, \
+ _, \
+ NAME_SEQUENCE \
+ ) /* -9- */
 
 
 /** Register some of the common namespaces

Modified: sandbox/mirror/boost/mirror/meta_type.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_type.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_type.hpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
@@ -10,200 +10,129 @@
 #ifndef BOOST_MIRROR_META_TYPE_HPP
 #define BOOST_MIRROR_META_TYPE_HPP
 
+#include <boost/preprocessor/list/for_each.hpp>
+
 // meta namespaces
 #include <boost/mirror/meta_namespace.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>
+// type name decorations
+#include <boost/mirror/detail/decorated_type_name.hpp>
 
 namespace boost {
 namespace mirror {
 
-namespace detail {
- template <typename Type>
- struct defined_type_info;
-} // namespace detail
-
-
 /** Meta-data describing types
  */
 template <typename Type>
 struct meta_type
 : public detail::full_name_builder<
- typename defined_type_info<Type>::scope,
- defined_type_info<Type>
->{ };
+ typename detail::registered_type_info<Type>::scope,
+ detail::registered_type_info<Type>
+>
+{
+ inline static const bstring& base_name(void)
+ {
+ return get_name(mpl::false_());
+ }
 
-/** Macro for declaration of meta-types
+ inline static const bstring& full_name(void)
+ {
+ return get_name(mpl::true_());
+ }
+
+ typedef detail::registered_type_info<Type> base_info;
+ typedef typename base_info::scope scope;
+ typedef typename base_info::reflected_type reflected_type;
+};
+
+/** Helper macro used to declare base-name getting functions
+ * and base-name length static constants
  */
-#define BOOST_MIRROR_REG_TYPE(NAMESPACE, BASE_NAME) \
- namespace detail { \
- template <> struct defined_type_info< NAMESPACE::BASE_NAME > \
+#define BOOST_MIRROR_REG_TYPE_DECLARE_BASE_NAME_HELPER(TYPE_NAME) \
+ static const bstring& get_name(mpl::false_) \
         { \
- typedef BOOST_MIRRORED_NAMESPACE(NAMESPACE) scope; \
- typedef NAMESPACE::BASE_NAME reflected_type; \
- static const bchar* base_name(void) {return BOOST_STR_LIT(#BASE_NAME);} \
- typedef typename ::boost::mpl::int_< \
- BOOST_STR_LIT_LENGTH(#BASE_NAME) \
- >::type base_name_length; \
- }; \
- } // namespace detail
+ static bstring s_name(BOOST_STR_LIT(#TYPE_NAME)); \
+ return s_name; \
+ }
 
-/** Macro for declaration of meta-types
+/** Macro for registering global-scope types
  */
-#define BOOST_MIRROR_REG_TYPE_GLOBAL_SCOPE(BASE_NAME) \
+#define BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(BASE_NAME) \
         namespace detail { \
- template <> struct defined_type_info< BASE_NAME > \
+ template <> struct registered_type_info< BASE_NAME > \
         { \
                 typedef BOOST_MIRRORED_GLOBAL_SCOPE() scope; \
                 typedef BASE_NAME reflected_type; \
- static const bchar* base_name(void) {return BOOST_STR_LIT(#BASE_NAME);} \
- typedef typename ::boost::mpl::int_< \
- BOOST_STR_LIT_LENGTH(#BASE_NAME) \
- >::type base_name_length; \
+ BOOST_MIRROR_REG_TYPE_DECLARE_BASE_NAME_HELPER(BASE_NAME) \
         }; \
         } // namespace detail
 
-
-#ifdef NEVER_COMPILE_THIS
-
-namespace detail {
-
-template <class TypeIdentifier, typename Type>
-struct typedefd_type_selector { };
-
-} // namespace detail
-
-/** Macro that expands into a typedefined type selector
- */
-#define BOOST_MIRROR_TYPEDEFD_SELECTOR(IDENTIFIER, BASE_TYPE)\
- ::boost::mirror::detail::typedefd_type_selector< ::boost::mirror::typedefs::IDENTIFIER, BASE_TYPE >
-
-template <class TypeIdentifier, typename Type>
-struct meta_type< ::boost::mirror::detail::typedefd_type_selector<
- TypeIdentifier, Type
-> > : meta_type<Type>{ };
-
-/** Helper macro that declared the full_name-related stuff
- */
-#define BOOST_MIRROR_TMP_DECLARE_META_TYPE_FULL_NAME() \
- BOOST_STATIC_CONSTANT(\
- int, \
- full_name_length = \
- scope::full_name_length + 2 + \
- base_name_length \
- ); \
- static const bchar* full_name(void)\
- {\
- static bchar the_full_name[full_name_length] = \
- BOOST_STR_LIT(""); \
- if(!the_full_name[0]) \
- { \
- bchar * pos = the_full_name; \
- bstrncpy(pos, scope::full_name(), scope::full_name_length);\
- pos += scope::full_name_length; \
- bstrncpy(pos, BOOST_STR_LIT("::"), 2);\
- pos += 2; \
- bstrncpy(pos, base_name(), base_name_length);\
- pos += base_name_length; \
- *pos = BOOST_STR_LIT('\0'); \
- } \
- return the_full_name; \
- }
-
-
-
-/** Macro for declaration of meta-types for typedefined types
+/** Macro for registering types nested in namespaces
  */
-#define BOOST_MIRROR_REG_TYPEDEFD(NAMESPACE_ALIAS, NAMESPACE, TYPEDEFD_NAME) \
- namespace typedefs { struct NAMESPACE_ALIAS##_##TYPEDEFD_NAME { }; }\
- template <> struct meta_type< BOOST_MIRROR_TYPEDEFD_SELECTOR(\
- NAMESPACE_ALIAS##_##TYPEDEFD_NAME, \
- NAMESPACE::TYPEDEFD_NAME \
- ) > \
- { \
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(NAMESPACE_ALIAS) scope; \
- typedef NAMESPACE::TYPEDEFD_NAME reflected_type; \
- static const bchar* base_name(void) {return BOOST_STR_LIT(#TYPEDEFD_NAME);}\
- BOOST_STATIC_CONSTANT( \
- int, \
- base_name_length = \
- BOOST_STR_LIT_LENGTH(#TYPEDEFD_NAME)\
- ); \
- BOOST_MIRROR_TMP_DECLARE_META_TYPE_FULL_NAME() \
- };
+#define BOOST_MIRROR_REG_TYPE(NAMESPACE, BASE_NAME) \
+ namespace detail { \
+ template <> struct registered_type_info< NAMESPACE::BASE_NAME > \
+ { \
+ typedef BOOST_MIRRORED_NAMESPACE(NAMESPACE) scope; \
+ typedef NAMESPACE::BASE_NAME reflected_type; \
+ BOOST_MIRROR_REG_TYPE_DECLARE_BASE_NAME_HELPER(BASE_NAME) \
+ }; \
+ } // namespace detail
 
-/** Declaration of meta types for types in the global scope
+/** Macro that expands into a typedef-ined type selectos
  */
-#define BOOST_MIRROR_REG_TYPE_GLOBAL_SCOPE(BASE_NAME) \
- template <> struct meta_type< BASE_NAME > \
- { \
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_) scope; \
- typedef BASE_NAME reflected_type; \
- static const bchar* base_name(void) {return BOOST_STR_LIT(#BASE_NAME);}\
- BOOST_STATIC_CONSTANT( \
- int, \
- base_name_length = \
- BOOST_STR_LIT_LENGTH( #BASE_NAME ) \
- ); \
- static const bchar* full_name(void) {return base_name();}\
- BOOST_STATIC_CONSTANT(int, full_name_length = base_name_length); \
- };
+#define BOOST_MIRROR_GET_TYPEDEFD_TYPE_SELECTOR(NAMESPACE, TYPEDEFD_NAME) \
+ ::boost::mirror::typedef_::TYPEDEFD_NAME < \
+ BOOST_MIRRORED_NAMESPACE( NAMESPACE ) \
+ > \
+
+/** Macro for registering typedef-ined types in namespaces
+ */
+#define BOOST_MIRROR_REG_TYPEDEF(NAMESPACE, TYPEDEFD_NAME) \
+ namespace typedef_ { \
+ template <class MetaNamespace> struct TYPEDEFD_NAME; \
+ template <> struct TYPEDEFD_NAME< \
+ BOOST_MIRRORED_NAMESPACE( NAMESPACE ) \
+ > { }; \
+ } /* namespace typedef_ */ \
+ namespace detail { \
+ template <> struct registered_type_info< \
+ BOOST_MIRROR_GET_TYPEDEFD_TYPE_SELECTOR(NAMESPACE, TYPEDEFD_NAME) \
+ > \
+ { \
+ typedef BOOST_MIRRORED_NAMESPACE(NAMESPACE) scope; \
+ typedef NAMESPACE::TYPEDEFD_NAME reflected_type; \
+ BOOST_MIRROR_REG_TYPE_DECLARE_BASE_NAME_HELPER(TYPEDEFD_NAME) \
+ }; \
+ } // namespace detail
 
 /** Declaration of meta types for types in declared inside
  * of a class.
  */
-#define BOOST_MIRROR_REG_TYPE_EMBEDDED(WRAPPER, BASE_NAME) \
- template <> struct meta_type< WRAPPER::BASE_NAME > \
- { \
- typedef meta_class< WRAPPER > scope; \
- typedef WRAPPER::BASE_NAME reflected_type; \
- static const bchar* base_name(void) {return BOOST_STR_LIT(#BASE_NAME);}\
- BOOST_STATIC_CONSTANT( \
- int, \
- base_name_length = \
- BOOST_STR_LIT_LENGTH(#BASE_NAME)\
- ); \
- BOOST_MIRROR_TMP_DECLARE_META_TYPE_FULL_NAME() \
+#define BOOST_MIRROR_REG_TYPE_EMBEDDED(WRAPPER, BASE_NAME) \
+ template <> struct meta_type< WRAPPER::BASE_NAME > \
+ { \
+ typedef meta_type< WRAPPER > scope; \
+ typedef WRAPPER::BASE_NAME reflected_type; \
+ BOOST_MIRROR_REG_TYPE_DECLARE_BASE_NAME_HELPER(BASE_NAME) \
         };
 
-#endif // NEVER_COMPILE_THIS
-
-/** Helper macro used for batch registering of the meta-types for
- * the C++ native types
+/** Register C++ native types
  */
-#define BOOST_MIRROR_REG_ITH_META_TYPE_NATIVE(I, _, BASE_NAME)\
- BOOST_MIRROR_REG_TYPE_GLOBAL_SCOPE(BASE_NAME)
-
-#define BOOST_MIRROR_NATIVE_TYPES \
- BOOST_PP_TUPLE_TO_LIST( \
- 15, \
- ( \
- void, \
- bool, \
- char, signed char, unsigned char, wchar_t, \
- unsigned short int, short, \
- int, unsigned int, \
- long, unsigned long int, \
- float, \
- double, long double \
- ) \
- )
-
-/** Declare the meta types for the native C++ types
- */
-BOOST_PP_LIST_FOR_EACH(BOOST_MIRROR_REG_ITH_META_TYPE_NATIVE, _, BOOST_MIRROR_NATIVE_TYPES)
-
-/** We're done with registering of the meta types for native
- * types now so we don't need this anymore
- */
-#undef BOOST_MIRROR_REG_ITH_META_TYPE_NATIVE
-
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(void)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(bool)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(char)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(unsigned char)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(signed char)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(wchar_t)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(short int)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(unsigned short int)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(int)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(unsigned int)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(long int)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(unsigned long int)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(float)
+BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(double)
 
 /** Register std string and wstring
  */
@@ -211,64 +140,116 @@
 BOOST_MIRROR_REG_TYPE(::std, wstring)
 /** Now register the bchar and bstring too
  */
-BOOST_MIRROR_REG_TYPEDEFD(::boost, bchar)
-BOOST_MIRROR_REG_TYPEDEFD(::boost, bstring)
-
+BOOST_MIRROR_REG_TYPEDEF(::boost, bchar)
+BOOST_MIRROR_REG_TYPEDEF(::boost, bstring)
 
 /** Meta-types for pointers
  */
 template <class PointeeType>
-struct meta_type<PointeeType*> : detail::static_pointer_type_name<
- meta_type<PointeeType>
+struct meta_type<PointeeType*> : detail::decorated_type_name<
+ meta_type<PointeeType>,
+ detail::type_name_decorator<PointeeType*>
>
 {
         typedef typename meta_type<PointeeType>::scope scope;
         typedef PointeeType* reflected_type;
 };
 
+
+
 /** Meta-types for arrays
  */
 template <class ElementType, size_t Size>
-struct meta_type<const ElementType[Size]> : detail::static_array_type_name<
- meta_type<const ElementType>, Size
+struct meta_type<ElementType[Size]> : detail::decorated_type_name<
+ meta_type<ElementType>,
+ detail::type_name_decorator<ElementType[Size]>
>
 {
         typedef typename meta_type<ElementType>::scope scope;
         typedef ElementType reflected_type[Size];
 };
 
+
+template <class ElementType, size_t Size>
+struct meta_type<const ElementType[Size]> : detail::decorated_type_name<
+ meta_type<const ElementType>,
+ detail::type_name_decorator<ElementType[Size]>
+>
+{
+ typedef typename meta_type<ElementType>::scope scope;
+ typedef const ElementType reflected_type[Size];
+};
+
 template <class ElementType, size_t Size>
-struct meta_type<ElementType[Size]> : detail::static_array_type_name<
- meta_type<ElementType>, Size
+struct meta_type<volatile ElementType[Size]> : detail::decorated_type_name<
+ meta_type<volatile ElementType>,
+ detail::type_name_decorator<ElementType[Size]>
>
 {
         typedef typename meta_type<ElementType>::scope scope;
- typedef ElementType reflected_type[Size];
+ typedef volatile ElementType reflected_type[Size];
 };
 
-template <class ElementType>
-struct meta_type<const ElementType[]> : detail::static_array_type_name<
- meta_type<const ElementType>, -1
+template <class ElementType, size_t Size>
+struct meta_type<const volatile ElementType[Size]>
+: detail::decorated_type_name<
+ meta_type<const volatile ElementType>,
+ detail::type_name_decorator<ElementType[Size]>
>
 {
         typedef typename meta_type<ElementType>::scope scope;
- typedef ElementType const reflected_type[];
+ typedef const volatile ElementType reflected_type[Size];
 };
 
 template <class ElementType>
-struct meta_type<ElementType[]> : detail::static_array_type_name<
- meta_type<ElementType>, -1
+struct meta_type<ElementType[]> : detail::decorated_type_name<
+ meta_type<ElementType>,
+ detail::type_name_decorator<ElementType[]>
>
 {
         typedef typename meta_type<ElementType>::scope scope;
         typedef ElementType reflected_type[];
 };
 
+template <class ElementType>
+struct meta_type<const ElementType []> : detail::decorated_type_name<
+ meta_type<const ElementType>,
+ detail::type_name_decorator<ElementType []>
+>
+{
+ typedef typename meta_type<ElementType>::scope scope;
+ typedef ElementType const reflected_type [];
+};
+
+template <class ElementType>
+struct meta_type<volatile ElementType []> : detail::decorated_type_name<
+ meta_type<volatile ElementType>,
+ detail::type_name_decorator<ElementType []>
+>
+{
+ typedef typename meta_type<ElementType>::scope scope;
+ typedef ElementType volatile reflected_type [];
+};
+
+template <class ElementType>
+struct meta_type<const volatile ElementType []>
+: detail::decorated_type_name<
+ meta_type<const volatile ElementType>,
+ detail::type_name_decorator<ElementType []>
+>
+{
+ typedef typename meta_type<ElementType>::scope scope;
+ typedef ElementType const volatile reflected_type [];
+};
+
+
+
 /** Meta-types for references
  */
 template <class ReferredToType>
-struct meta_type<ReferredToType&> : detail::static_reference_type_name<
- meta_type<ReferredToType>
+struct meta_type<ReferredToType&> : detail::decorated_type_name<
+ meta_type<ReferredToType>,
+ detail::type_name_decorator<ReferredToType&>
>
 {
         typedef typename meta_type<ReferredToType>::scope scope;
@@ -278,8 +259,9 @@
 /** Meta-types for const types
  */
 template <class NonConstType>
-struct meta_type<const NonConstType> : detail::static_const_type_name<
- meta_type<NonConstType>
+struct meta_type<const NonConstType> : detail::decorated_type_name<
+ meta_type<NonConstType>,
+ detail::type_name_decorator<const NonConstType>
>
 {
         typedef typename meta_type<NonConstType>::scope scope;
@@ -289,8 +271,9 @@
 /** Meta-types for volatile types
  */
 template <class NonVolatileType>
-struct meta_type<volatile NonVolatileType> : detail::static_volatile_type_name<
- meta_type<NonVolatileType>
+struct meta_type<volatile NonVolatileType> : detail::decorated_type_name<
+ meta_type<NonVolatileType>,
+ detail::type_name_decorator<volatile NonVolatileType>
>
 {
         typedef typename meta_type<NonVolatileType>::scope scope;
@@ -300,15 +283,15 @@
 /** Meta-types for const volatile types
  */
 template <class NonCVType>
-struct meta_type<const volatile NonCVType> : detail::static_cv_type_name<
- meta_type<NonCVType>
+struct meta_type<const volatile NonCVType> : detail::decorated_type_name<
+ meta_type<NonCVType>,
+ detail::type_name_decorator<const volatile NonCVType>
>
 {
         typedef typename meta_type<NonCVType>::scope scope;
         typedef const volatile NonCVType reflected_type;
 };
 
-
 } // 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-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
@@ -238,10 +238,18 @@
                           Both registering and reflection have been fairly simplified
                         - Replaced the MIRROR_REFLECT_NAMESPACE with MIRRORED_NAMESPACE macro that takes the full namespace name instead
                           of a namespace alias MIRROR_REFLECT_NAMESPACE(_boost_mirror) is now MIRRORED_NAMESPACE(::boost::mirror).
- - Added MIRRORED_GLOBAL_SCOPE() to reflect global scope namespace which is equivalent but preffered to
- MIRRORED_NAMESPACE(::__)
+ - Added MIRRORED_GLOBAL_SCOPE() to reflect global scope namespace which is equivalent to
+ MIRRORED_NAMESPACE(::)
                         - Complete rewrite of type registering and reflection
 
+ - Changed the return value of base_name and full_name getters from const bchar* to bstring / const bstring&amp;
+ - Replaced BOOST_MIRROR_REG_TYPE_GLOBAL_SCOPE(TYPE) with BOOST_MIRROR_REG_GLOBAL_SCOPE_TYPE(TYPE) macro
+
+ - Added get_name(mpl::bool_&lt;FullName&gt;) function that gets the base name with mpl::false_ and full name with mpl::true_
+ - Removed the old non-trivial type name meta_types
+ - Added new meta_type name decorator
+
+
                         - Tested with MSVC++ 2008 EE On Vista
                 </revision>
         </revisions>

Modified: sandbox/mirror/libs/mirror/example/registering/namespaces.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/registering/namespaces.cpp (original)
+++ sandbox/mirror/libs/mirror/example/registering/namespaces.cpp 2008-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
@@ -40,6 +40,7 @@
 // register the namespaces
 //
 BOOST_MIRROR_REG_NAMESPACE((test))
+//
 BOOST_MIRROR_REG_NAMESPACE((test)(feature))
 BOOST_MIRROR_REG_NAMESPACE((test)(feature)(detail))
 //
@@ -63,7 +64,7 @@
         // meta_namespace<> specialization for the given namespace
         //
         // define an alternative name for the global scope meta-namespace
- // BOOST_MIRRORED_NAMESPACE(::__) is equivalent to this
+ // BOOST_MIRRORED_NAMESPACE(::) is equivalent to this
         typedef BOOST_MIRRORED_GLOBAL_SCOPE() meta_ns_global_scope;
 
         // define an alternative name for the ::test namespace meta-data
@@ -94,13 +95,13 @@
         //
         // the name_to_stream<meta_object> class allows to put the full name
         // (including the scope) into a stream
- bcout << "|07| " <<name_to_stream< BOOST_MIRRORED_NAMESPACE(::__) >() << endl;
+ bcout << "|07| " <<name_to_stream< BOOST_MIRRORED_NAMESPACE(::) >() << endl;
         bcout << "|08| " <<name_to_stream< BOOST_MIRRORED_NAMESPACE(::test) >() << endl;
         bcout << "|09| " <<name_to_stream< BOOST_MIRRORED_NAMESPACE(::test::stuff) >() << endl;
         bcout << "|10| " <<name_to_stream< BOOST_MIRRORED_NAMESPACE(::test::stuff::detail) >() << endl;
         // in this case the :: is prepended to the full name
         // thus test::stuff -> ::test::stuff
- bcout << "|11| " <<name_to_stream< BOOST_MIRRORED_NAMESPACE(::__) >(true) << endl;
+ bcout << "|11| " <<name_to_stream< BOOST_MIRRORED_NAMESPACE(::) >(true) << endl;
         bcout << "|12| " <<name_to_stream< BOOST_MIRRORED_NAMESPACE(::test) >(true) << endl;
         bcout << "|13| " <<name_to_stream< BOOST_MIRRORED_NAMESPACE(::test::stuff) >(true) << endl;
         bcout << "|14| " <<name_to_stream< BOOST_MIRRORED_NAMESPACE(::test::stuff::detail) >(true) << endl;
@@ -113,7 +114,7 @@
         //
         // printing out the full namespace names directly without the name_to_stream
         // printer template
- bcout << "|18| " << BOOST_MIRRORED_NAMESPACE(::__) ::full_name() << endl;
+ bcout << "|18| " << BOOST_MIRRORED_NAMESPACE(::) ::full_name() << endl;
         bcout << "|19| " << BOOST_MIRRORED_NAMESPACE(::std) ::full_name() << endl;
         bcout << "|20| " << BOOST_MIRRORED_NAMESPACE(::boost) ::full_name() << endl;
         bcout << "|21| " << BOOST_MIRRORED_NAMESPACE(::boost::mirror) ::full_name() << 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-07-04 15:29:52 EDT (Fri, 04 Jul 2008)
@@ -53,7 +53,7 @@
 BOOST_MIRROR_REG_TYPE(::test::feature::detail, bar)
 // register a typedef'd class this allows to distinguish it from
 // the 'source' type in some situations
-BOOST_MIRROR_REG_TYPEDEFD(::test::feature::detail, foobar)
+BOOST_MIRROR_REG_TYPEDEF(::test::feature::detail, foobar)
 
 } // namespace mirror
 } // namespace boost
@@ -77,6 +77,7 @@
         //
         // put the full name of the type to the output stream
         //
+ bcout << "|00| " << name_to_stream< BOOST_MIRRORED_TYPE(int) >() << endl;
         bcout << "|01| " << name_to_stream< BOOST_MIRRORED_TYPE(foo) >() << endl;
         bcout << "|02| " << name_to_stream< BOOST_MIRRORED_TYPE(bar) >() << endl;
         //
@@ -86,6 +87,7 @@
         // leading "::" too.
         bcout << "|03| " << name_to_stream< meta_foo >(true) << endl;
         bcout << "|04| " << name_to_stream< meta_bar >(true) << endl;
+
         //
         // this works too...
         bcout << "|05| " << name_to_stream< BOOST_MIRRORED_TYPE(foo*) >() << endl;
@@ -109,6 +111,7 @@
         // ... and maybe more conveniently
         bcout << "|18| " << name_to_stream< BOOST_MIRRORED_TYPEOF(1.0/2.0) >() << endl;
         //
+
         // sometimes it is useful to distinguish between a typedef'd type
         // and the 'source' type.
         //
@@ -116,25 +119,27 @@
         // on compilation configuration
         typedef BOOST_MIRRORED_TYPE(bchar) meta_bchar;
         // this reflects a meta-type that allows to query the typedef'd name
- typedef BOOST_MIRRORED_TYPEDEFD(_boost, bchar) meta_bchar_td;
+ typedef BOOST_MIRRORED_TYPEDEF(::boost, bchar) meta_bchar_td;
         // this reflects the meta-type for the typedef type foobar
- typedef BOOST_MIRRORED_TYPEDEFD(_test_feature_detail, foobar) meta_foobar_td;
+ typedef BOOST_MIRRORED_TYPEDEF(::test::feature::detail, foobar) meta_foobar_td;
+
         //
         bcout << "|19| " << name_to_stream< meta_bchar >() << endl;
         bcout << "|20| " << name_to_stream< meta_bchar_td >() << endl;
         bcout << "|21| " << name_to_stream< meta_foobar_td >() << endl;
         //
- // unfortunately BOOST_MIRRORED_TYPEDEFD(...) works only if
+ // unfortunately BOOST_MIRRORED_TYPEDEF(...) works only if
         // the typedefined name is explicitly given
         // still it can be useful in certin situations.
         // However, the next line for example would fail to compile
- //typedef BOOST_MIRRORED_TYPEDEFD(_boost, BOOST_TYPEOF(L'x')) meta_bchar_td;
+ //typedef BOOST_MIRRORED_TYPEDEF(_boost, BOOST_TYPEOF(L'x')) meta_bchar_td;
         //
         // check whether the type is defined on the global scope
         if(!reflects_global_scope<meta_bchar_td::scope>::value)
                 bcout << "|22| " << "bchar NOT defined on global scope" << endl;
         if(!reflects_global_scope<meta_foo::scope>::value)
                 bcout << "|23| " << "foo NOT defined on global scope" << endl;
+ //
         // use with typeof
         if(reflects_global_scope< BOOST_MIRRORED_TYPEOF(1+2) ::scope>::value)
                 bcout << "|24| " << "type of (1+2) defined on global scope" << endl;
@@ -144,11 +149,27 @@
         //
         bcout << "|26| " << BOOST_MIRRORED_TYPE(bool) ::full_name() << endl;
         bcout << "|27| " << BOOST_MIRRORED_TYPE(bchar) ::full_name() << endl;
- bcout << "|28| " << BOOST_MIRRORED_TYPEDEFD(_boost, bchar) ::full_name() << endl;
- bcout << "|29| " << BOOST_MIRRORED_TYPEDEFD(_boost, bstring) ::full_name() << endl;
+ bcout << "|28| " << BOOST_MIRRORED_TYPEDEF(::boost, bchar) ::full_name() << endl;
+ bcout << "|29| " << BOOST_MIRRORED_TYPEDEF(::boost, bstring) ::full_name() << endl;
+
+ bcout << "|30| " << BOOST_MIRRORED_TYPE(int const * ) ::full_name() << endl;
+
         bcout << "|30| " << BOOST_MIRRORED_TYPE(int const * const volatile) ::full_name() << endl;
- bcout << "|31| " << BOOST_MIRRORED_TYPE(int volatile * const * volatile) ::full_name() << endl;
+ bcout << "|31| " << BOOST_MIRRORED_TYPE(int volatile * const * volatile * const *) ::full_name() << endl;
         bcout << "|32| " << BOOST_MIRRORED_TYPE(int const * const [321]) ::full_name() << endl;
+ bcout << "|33| " << BOOST_MIRRORED_TYPE(int * volatile * const [][123]) ::full_name() << endl;
+ bcout << "|34| " << BOOST_MIRRORED_TYPE(bar [123][456][789]) ::full_name() << endl;
+ //
+ bcout << "|35| " << BOOST_MIRRORED_TYPE(foo*) ::full_name() << endl;
+ bcout << "|36| " << BOOST_MIRRORED_TYPE(bar&) ::full_name() << endl;
+ bcout << "|37| " << BOOST_MIRRORED_TYPE(foo***) ::full_name() << endl;
+ bcout << "|38| " << BOOST_MIRRORED_TYPE(bar**&) ::full_name() << endl;
+ bcout << "|39| " << BOOST_MIRRORED_TYPE(const foo**) ::full_name() << endl;
+ bcout << "|40| " << BOOST_MIRRORED_TYPE(volatile bar*&) ::full_name() << endl;
+ //
+ bcout << "|41| " << BOOST_MIRRORED_TYPE(const volatile foo) ::full_name() << endl;
+ bcout << "|42| " << BOOST_MIRRORED_TYPE(const volatile bar*) ::full_name() << 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