Boost logo

Boost-Commit :

From: chochlik_at_[hidden]
Date: 2008-04-16 13:52:24


Author: matus.chochlik
Date: 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
New Revision: 44471
URL: http://svn.boost.org/trac/boost/changeset/44471

Log:
Updated and added documentation and done minor changes to the header files and added one example.
Added:
   sandbox/mirror/boost/mirror/utils/name_to_stream/
   sandbox/mirror/boost/mirror/utils/name_to_stream/common.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/utils/name_to_stream/name_to_stream.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/utils/name_to_stream/namespace.hpp (contents, props changed)
   sandbox/mirror/libs/doc/xml/css/
   sandbox/mirror/libs/doc/xml/css/mirror.css (contents, props changed)
   sandbox/mirror/libs/doc/xml/mirror/pages/quick_start.xml (contents, props changed)
   sandbox/mirror/libs/doc/xml/mirror/sections/char_type.xml (contents, props changed)
   sandbox/mirror/libs/doc/xml/mirror/sections/toc_brief.xml (contents, props changed)
   sandbox/mirror/libs/doc/xml/xslt/html/cpp_expr.xsl (contents, props changed)
   sandbox/mirror/libs/doc/xml/xslt/html/emph.xsl (contents, props changed)
   sandbox/mirror/libs/doc/xml/xslt/html/filepath.xsl (contents, props changed)
   sandbox/mirror/libs/doc/xml/xslt/html/items.xsl (contents, props changed)
   sandbox/mirror/libs/doc/xml/xslt/html/links.xsl (contents, props changed)
   sandbox/mirror/libs/examples/registering/
   sandbox/mirror/libs/examples/registering/namespaces.cpp (contents, props changed)
Text files modified:
   sandbox/mirror/boost/mirror/meta_namespace.hpp | 11 ++++-
   sandbox/mirror/libs/doc/xml/mirror/_library.xml | 10 ++++
   sandbox/mirror/libs/doc/xml/mirror/pages/index.xml | 6 ++-
   sandbox/mirror/libs/doc/xml/mirror/sections/goals.xml | 40 +++++++++++++++++++--
   sandbox/mirror/libs/doc/xml/mirror/sections/overview.xml | 35 +++++++++++++++++-
   sandbox/mirror/libs/doc/xml/xslt/html.xsl | 6 +++
   sandbox/mirror/libs/doc/xml/xslt/html/boost_refs.xsl | 74 ++++++++++++++++++++++++++++++++++++++++
   sandbox/mirror/libs/doc/xml/xslt/html/doc_page.xsl | 39 +++++++++++++++-----
   sandbox/mirror/libs/doc/xml/xslt/html/note.xsl | 2
   sandbox/mirror/libs/doc/xml/xslt/html/section.xsl | 2
   10 files changed, 200 insertions(+), 25 deletions(-)

Modified: sandbox/mirror/boost/mirror/meta_namespace.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_namespace.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_namespace.hpp 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -7,8 +7,8 @@
  * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  */
 
-#ifndef BOOST_MIRROR_META_NAMESPACE
-#define BOOST_MIRROR_META_NAMESPACE
+#ifndef BOOST_MIRROR_META_NAMESPACE_HPP
+#define BOOST_MIRROR_META_NAMESPACE_HPP
 
 // true type/false type for trait templates
 #include <boost/type_traits/integral_constant.hpp>
@@ -57,7 +57,6 @@
 template <>
 struct is_global_scope<namespaces::_> : public true_type{ };
 
-
 /** Helper macro for registering new general namespaces (top level or nested)
  */
 #define BOOST_MIRROR_REG_META_NAMESPACE_HELPER(PARENT_META_NS, PREFIX, NAMESPACE, SPELLED_NAME) \
@@ -89,6 +88,12 @@
 // Registration of the ::boost::mirror namespace
 BOOST_MIRROR_REG_META_NAMESPACE(_boost, mirror, BOOST_PP_TUPLE_REM_CTOR(6,('m','i','r','r','o','r')));
 
+/** Macro that expands into the meta_namespace for the
+ * namespace with the given alias.
+ */
+#define BOOST_MIRROR_REFLECT_NAMESPACE(NAMESPACE_ALIAS) \
+ ::boost::mirror::namespaces::NAMESPACE_ALIAS
+
 } // namespace mirror
 } // namespace boost
 

Added: sandbox/mirror/boost/mirror/utils/name_to_stream/common.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/utils/name_to_stream/common.hpp 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,60 @@
+/**
+ * \file boost/mirror/utils/name_to_stream/common.hpp
+ * Common things required by the name_to_stream utility
+ *
+ * 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_UTILS_NAME_TO_STREAM_COMMON_HPP
+#define BOOST_MIRROR_UTILS_NAME_TO_STREAM_COMMON_HPP
+
+namespace boost {
+namespace mirror {
+
+/** name_to_stream_helper function object
+ */
+template <class meta_object>
+struct name_to_stream_helper;
+
+/** name_to_stream function object
+ * Puts the whole name of the meta object into the given stream.
+ */
+template <typename meta_object>
+class name_to_stream : public name_to_stream_helper<meta_object>
+{
+private:
+ typedef name_to_stream_helper<meta_object> _helper;
+ bool put_leading_dbl_cln;
+public:
+ // default constructor
+ name_to_stream(bool ldng_dbl_cln = false)
+ : put_leading_dbl_cln(ldng_dbl_cln)
+ { }
+ //
+ // use the inherited put function too
+ using _helper::put;
+ //
+ //! This version of put uses the stored flag put_leading_dbl_cln
+ template <class out_stream>
+ out_stream& put(out_stream& s) const
+ {
+ return _helper::put(s, put_leading_dbl_cln);
+ }
+};
+
+/** << operator overload for meta-namespaces
+ */
+template <class ostream, class meta_object>
+ostream& operator << (ostream& dst, const name_to_stream< meta_object >& mns)
+{
+ return mns.put(dst);
+}
+
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/utils/name_to_stream/name_to_stream.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/utils/name_to_stream/name_to_stream.hpp 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,179 @@
+/**
+ * \file boost/mirror/utils/name_to_stream.hpp
+ * Putting names of reflected nammespaces, classes, etc. to streams
+ *
+ * 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_UTILS_NAME_TO_STREAM
+#define BOOST_MIRROR_UTILS_NAME_TO_STREAM
+
+// meta namespaces (includes boost/char_type_switch/string.hpp)
+#include <boost/mirror/meta_namespace.hpp>
+// meta types
+#include <boost/mirror/meta_type.hpp>
+
+namespace boost {
+namespace mirror {
+
+/** name_to_stream_helper function object
+ */
+template <class meta_object>
+struct name_to_stream_helper;
+
+/** Specialization for the global scope meta-namespace
+ */
+template <class namespace_name>
+struct name_to_stream_helper<meta_namespace<void, namespace_name> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln = false)
+ {
+ return ldng_dbl_cln? s << BOOST_STR_LIT("::") : s;
+ }
+};
+
+/** Specialization for the top level namespaces
+ */
+template <class namespace_name>
+struct name_to_stream_helper<meta_namespace<namespaces::_, namespace_name> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln = false)
+ {
+ return (ldng_dbl_cln? s << BOOST_STR_LIT("::") : s) <<
+ meta_namespace<namespaces::_, namespace_name>::base_name();
+ }
+};
+
+/** Specialization of meta_namespace for nested namespaces
+ */
+template <class parent_meta_ns, class namespace_name>
+struct name_to_stream_helper<meta_namespace<parent_meta_ns, namespace_name> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln = false)
+ {
+ return name_to_stream<parent_meta_ns>::put(s, ldng_dbl_cln) <<
+ BOOST_STR_LIT("::") <<
+ meta_namespace<parent_meta_ns, namespace_name>::base_name();
+ }
+};
+
+/** Specialization for meta-types
+ */
+template <typename base_type>
+struct name_to_stream_helper<meta_type<base_type> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln = false)
+ {
+ if(!is_global_scope<typename meta_type<base_type>::scope>::value)
+ name_to_stream<meta_type<base_type>::scope>::put(s, ldng_dbl_cln) << BOOST_STR_LIT("::");
+ else if(ldng_dbl_cln) s << BOOST_STR_LIT("::");
+ return s << meta_type<base_type>::base_name();
+ }
+};
+
+/** Specialization for meta-types for pointers
+ */
+template <typename pointee_type>
+struct name_to_stream_helper<meta_type<pointee_type*> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln = false)
+ {
+ return name_to_stream_helper<meta_type<pointee_type> >::put(s,ldng_dbl_cln) << BOOST_STR_LIT("*");
+ }
+};
+
+/** Specialization for meta-types for references
+ */
+template <typename refered_to_type>
+struct name_to_stream_helper<meta_type<refered_to_type&> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln = false)
+ {
+ return name_to_stream_helper<meta_type<refered_to_type> >::put(s,ldng_dbl_cln) << BOOST_STR_LIT("&");
+ }
+};
+
+/** Specialization for meta-types for const types
+ */
+template <typename non_const_type>
+struct name_to_stream_helper<meta_type<const non_const_type> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln = false)
+ {
+ s << BOOST_STR_LIT("const ");
+ return name_to_stream_helper<meta_type<non_const_type> >::put(s,ldng_dbl_cln);
+ }
+};
+
+/** Specialization for meta-types for volatile types
+ */
+template <typename non_volatile_type>
+struct name_to_stream_helper<meta_type<volatile non_volatile_type> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln = false)
+ {
+ s << BOOST_STR_LIT("volatile ");
+ return name_to_stream_helper<meta_type<non_volatile_type> >::put(s,ldng_dbl_cln);
+ }
+};
+
+/** Specialization for meta-types for volatile types
+ */
+template <typename non_cv_type>
+struct name_to_stream_helper<meta_type<const volatile non_cv_type> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln = false)
+ {
+ s << BOOST_STR_LIT("const volatile ");
+ return name_to_stream_helper<meta_type<non_cv_type> >::put(s,ldng_dbl_cln);
+ }
+};
+
+
+/** Specialization for meta-classes
+ */
+template <typename base_type>
+struct name_to_stream_helper<meta_class<base_type> > :
+public name_to_stream_helper<meta_type<base_type> > { };
+
+/** name_to_stream function object
+ * Puts the whole name of the meta object into the given stream.
+ * There are three ways how to use this function object
+ * 1) invocation of static member function put(...)
+ * name_to_stream<meta_object>::put(stream);
+ * 2) construction with a stream as argument
+ * name_to_stream<meta_object> nts(stream);
+ * 3) construction and calling of the function call operator
+ * name_to_stream<meta_object>()(stream); or
+ * name_to_stream<meta_object> nts; nts();
+ */
+template <typename meta_object>
+struct name_to_stream : public name_to_stream_helper<meta_object>
+{
+ // default constructor
+ name_to_stream(void){ }
+ // this constructor invokes the put operation on the given stream
+ template <class out_stream>
+ name_to_stream(out_stream& s, bool ldng_dbl_cln = false){put(s, ldng_dbl_cln);}
+ // function call operator
+ template <class out_stream>
+ out_stream& operator()(out_stream& s, bool ldng_dbl_cln = false){return put(s, ldng_dbl_cln);}
+};
+
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/utils/name_to_stream/namespace.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/utils/name_to_stream/namespace.hpp 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,65 @@
+/**
+ * \file boost/mirror/utils/name_to_stream/namespace.hpp
+ * Putting names of registered namespaces to streams
+ *
+ * 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_UTILS_NAME_TO_STREAM_NAMESPACE_HPP
+#define BOOST_MIRROR_UTILS_NAME_TO_STREAM_NAMESPACE_HPP
+
+// common definitions
+#include <boost/mirror/utils/name_to_stream/common.hpp>
+// meta namespaces (includes boost/char_type_switch/string.hpp)
+#include <boost/mirror/meta_namespace.hpp>
+
+namespace boost {
+namespace mirror {
+
+/** Specialization of name_to_stream_helper for the global scope meta-namespace
+ */
+template <class namespace_name>
+struct name_to_stream_helper<meta_namespace<void, namespace_name> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln)
+ {
+ return ldng_dbl_cln? s << BOOST_STR_LIT("::") : s;
+ }
+};
+
+/** Specialization of name_to_stream_helper for the top level namespaces
+ */
+template <class namespace_name>
+struct name_to_stream_helper<meta_namespace<namespaces::_, namespace_name> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln)
+ {
+ return (ldng_dbl_cln? s << BOOST_STR_LIT("::") : s) <<
+ meta_namespace<namespaces::_, namespace_name>::base_name();
+ }
+};
+
+/** Specialization of name_to_stream_helper for nested namespaces
+ */
+template <class parent_meta_ns, class namespace_name>
+struct name_to_stream_helper<meta_namespace<parent_meta_ns, namespace_name> >
+{
+ template <class out_stream>
+ static out_stream& put(out_stream& s, bool ldng_dbl_cln)
+ {
+ return name_to_stream<parent_meta_ns>::put(s, ldng_dbl_cln) <<
+ BOOST_STR_LIT("::") <<
+ meta_namespace<parent_meta_ns, namespace_name>::base_name();
+ }
+};
+
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/libs/doc/xml/css/mirror.css
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/doc/xml/css/mirror.css 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,87 @@
+BODY {
+ font-family: 'Garamond';
+ text-align: justify;
+ /*
+ background-image: url("../../../boost.png");
+ background-position: 80% 80%;
+ background-repeat: no-repeat;
+ */
+}
+
+
+H1,H2,H3,H4,H5,H6 {
+ font-family: 'Palatino Linotype';
+ width: 100%;
+ background-color: #F0FFF0;
+ color: #206020;
+ border: 1px solid #E0EFE0;
+ padding-left: 1em;
+}
+
+H1 {
+ font-size: 120%;
+ font-weight: bold;
+}
+
+DIV.section {
+ padding-left: 2.5em;
+}
+
+DIV.licensing-notice, DIV.copyright-notice, DIV.revision-notice {
+ border: 1px solid #C0F0C0;
+ background-color: #FFFAE0;
+ padding: 0.2em;
+ padding-left: 1.5em;
+ margin-bottom: 1px;
+}
+
+DIV.related-pages {
+ border: 1px solid #C0F0C0;
+ background-color: #F0FFE0;
+ padding: 0.1em;
+ padding-left: 1.5em;
+ margin-bottom: 1px;
+}
+
+
+DIV.linkset {
+ border: 1px solid #A0C0A0;
+ background-color: #E0FFE0;
+ padding: 0.5em;
+}
+
+P.note {
+ border: 1px solid #C0A0A0;
+ background-color: #FFE0E0;
+ padding: 0.5em;
+}
+
+
+A {
+ text-decoration: none;
+ color: #609090;
+}
+
+A:hover {
+ text-decoration: underline;
+}
+
+
+A.linkset-link {
+ width: 100%;
+}
+
+A.linkset-link:hover {
+ background-color: #D0F0D0;
+ text-decoration: underline;
+}
+
+A.linkset-link:visited {
+ color: #204020;
+}
+
+
+
+CODE.cpp-expr {
+ font-weight: bold;
+}

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-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -8,10 +8,18 @@
                 <to>2008</to>
         </date>
         <authors>
- <author>
+ <author id="m_ch">
                         <name>Matúš</name>
                         <surname>Chochlík</surname>
                         <email>chochlik_at_[hidden]</email>
                 </author>
         </authors>
+ <revisions>
+ <revision id="20080415" major="0" minor="1" micro="0" author="m_ch">
+ Initial implementation.
+ </revision>
+ <revision id="20080416" major="0" minor="1" micro="1" author="m_ch">
+ Updated documentation and added several examples.
+ </revision>
+ </revisions>
 </library>

Modified: sandbox/mirror/libs/doc/xml/mirror/pages/index.xml
==============================================================================
--- sandbox/mirror/libs/doc/xml/mirror/pages/index.xml (original)
+++ sandbox/mirror/libs/doc/xml/mirror/pages/index.xml 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -1,10 +1,12 @@
 ï»¿<?xml version="1.0" encoding="utf-8"?>
 <?xml-stylesheet type="text/xsl" href="../../xslt/html.xsl"?>
-<doc_page title="Main Page">
+<doc_page title="Main Page" name="index">
         <paragraph>
                 Welcome to the <lib_name_ref/> library documentation.
         </paragraph>
- <note>The library is still only in the early stages of development and can be subject to major changes.</note>
+ <note>The library is still only in the early stages of development and can be subject to major changes. Also note that the documentation of current features is far from being complete.</note>
+ <include section="toc_brief" />
         <include section="overview" />
         <include section="goals" />
+ <include section="char_type" />
 </doc_page>

Added: sandbox/mirror/libs/doc/xml/mirror/pages/quick_start.xml
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/doc/xml/mirror/pages/quick_start.xml 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet type="text/xsl" href="../../xslt/html.xsl"?>
+<doc_page title="Quick start" name="quick_start">
+ <paragraph>
+
+ </paragraph>
+</doc_page>

Added: sandbox/mirror/libs/doc/xml/mirror/sections/char_type.xml
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/doc/xml/mirror/sections/char_type.xml 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<section title="Note on character types" name="char_type">
+ <paragraph>
+ The <lib_name_ref/> library defines and uses <cpp_expr>::boost::bchar</cpp_expr> (or <cpp_expr>bchar</cpp_expr>) character type and several other types like <cpp_expr>bstring</cpp_expr>, <cpp_expr>bcin</cpp_expr>, <cpp_expr>bcout</cpp_expr>, <cpp_expr>bcerr</cpp_expr>, etc. defined in the <cpp_expr>boost</cpp_expr> namespace. These types are defined as <cpp_expr>char</cpp_expr> (and <cpp_expr>::std::string</cpp_expr>, <cpp_expr>::std::cin</cpp_expr>, <cpp_expr>::std::cout</cpp_expr>, <cpp_expr>::std::cerr</cpp_expr>, respectively) when the preprocessor symbol <cpp_expr>BOOST_USE_WIDE_CHARS</cpp_expr> is <emph>not</emph> defined (this is the default) and defined as <cpp_expr>wchar_t</cpp_expr> (and <cpp_expr>::std::wstring</cpp_expr>, <cpp_expr>::std::wcin</cpp_expr>, <cpp_expr>::std::wcout</cpp_expr>, <cpp_expr>::std::wcerr</cpp_expr>, respectively) otherwise.
+ <paragraph>
+ There is also a macro named <cpp_expr>BOOST_STR_LIT(STRING_LITERAL)</cpp_expr> that expands either to <cpp_expr>STRING_LITERAL</cpp_expr> or to <cpp_expr>L##STRING_LITERAL</cpp_expr> based on the <cpp_expr>BOOST_USE_WIDE_CHARS</cpp_expr> being defined.
+
+ </paragraph>
+ </paragraph>
+ <note>
+ The <cpp_expr>BOOST_USE_WIDE_CHARS</cpp_expr> symbol is in the current implementetion automatically defined, if the <cpp_expr>UNICODE</cpp_expr> symbol is defined (this PP symbol switches between narrow/wide chars on Win32).
+ </note>
+ <paragraph>
+ This approach allows to switch the character type without the need to do any changes to the code. A feature that is handy in some situations. Since the definition of <cpp_expr>bchar</cpp_expr> is always the same as the definition of <cpp_expr>TCHAR</cpp_expr> on Windows, this also allows smooth cooperation between <boost/> and WinAPI with both <cpp_expr>char</cpp_expr>s and <cpp_expr>wchar_t</cpp_expr>s.
+ Any WinAPI function that takes <cpp_expr>TCHAR</cpp_expr> or a pointer to <cpp_expr>TCHAR</cpp_expr> can be safely used with <cpp_expr>bchar</cpp_expr>. Thus it is better, safer and more robust to call <cpp_expr>LoadLibrary</cpp_expr> with a <cpp_expr>bchar*</cpp_expr> argument than to directly call <cpp_expr>LoadLibraryA</cpp_expr> with <cpp_expr>char*</cpp_expr> argument or <cpp_expr>LoadLibraryW</cpp_expr> with <cpp_expr>wchar_t*</cpp_expr> argument.
+ </paragraph>
+ <note>
+ The current implementation is far from perfect. It is more than probable that the functions from <filepath>cstring</filepath> like <cpp_expr>strlen</cpp_expr>/<cpp_expr>wcslen</cpp_expr>, <cpp_expr>strcpy</cpp_expr>/<cpp_expr>wcscpy</cpp_expr> will have to be wrapped by functions like <cpp_expr>bstrlen</cpp_expr>, <cpp_expr>bstrcpy</cpp_expr>, etc taking <cpp_expr>bchar</cpp_expr> as argument instead of <cpp_expr>char</cpp_expr>/<cpp_expr>wchar_t</cpp_expr>.
+ </note>
+ <paragraph>
+ Everything related to <cpp_expr>bchar</cpp_expr> and to the other char-type-related types can be found in the <filepath>boost/char_type_switch</filepath> subdirectory.
+ </paragraph>
+</section>

Modified: sandbox/mirror/libs/doc/xml/mirror/sections/goals.xml
==============================================================================
--- sandbox/mirror/libs/doc/xml/mirror/sections/goals.xml (original)
+++ sandbox/mirror/libs/doc/xml/mirror/sections/goals.xml 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -1,9 +1,41 @@
 ï»¿<?xml version="1.0" encoding="utf-8"?>
 <section title="Goals">
         <paragraph>
- <items>
- <item title="">
- </item>
- </items>
+ The purpose of the <lib_name_ref/> library is to fill in some gaps, that the other <boost/> libraries leave open. It does not try to reinvent the wheels though.
+ It's true power is in combination with other <boost/> libraries. For example the <boost_lib_ref name="type_traits"/> allows to query almost every trait of a type that one can think of. However, it does not allow to query platform/compiler independent name of the type (which also <cpp_expr>typeid</cpp_expr> fails to do) or the scope in which the type is defined. This is where <lib_name_ref/> comes in handy.
+ </paragraph>
+ <paragraph>
+ The <lib_name_ref/> library has the following goals:
+ </paragraph>
+ <items>
+ <item title="Namespace reflection">
+ Allow to register and inspect the namespaces at compile-time and query their names.
+ </item>
+ <item title="Type-related introspection">
+ Allow to inspect the base and the full name of a type and the scope in which it is defined (at least namespace and class).
+ </item>
+ <item title="Class-related introspection">
+ Allow to iterate between and to inspect the base classes of a given class, the type of inheritance (virtual vs. regular) the access modifier (private, protected, public). Allow to iterate between the member attributes of a class, to query the type of the attribute and to query it's name. Allow to iterate between the member functions and inspect their properties at compile time. Allow to iterate through the list of constructors of a class and introspect them.
+ </item>
+ <item title="Container-related introspection">
+ </item>
+ <item title="Recursive type and instace visitation">
+ </item>
+ <item title="Custom interface implementations">
+ If possible, this library should allow to generate custom interface implementations by combining the meta-data describing the class' interface and a class that says what to do, when a member function is invoked. This way custom proxies and decorators could be generated for every interface registered with the <lib_name_ref/>.
+ </item>
+ <item title="Cooperation with other libraries">
+ The implementation should allow easy cooperation with other (mainly standard and <boost/>) libraries.
+ Allow to apply <boost_lib_ref name="_mpl"/> algorithms to the provided meta-data, allow to use <boost_lib_ref name="type_traits"/> and <boost_lib_ref name="call_traits"/>, etc.
+ </item>
+ <item title="Support for other libraries">
+ Allow to automate the process of making classes serializable by the <boost_lib_ref name="serialization"/> library. Allow to automatically enable <link title="SOCI" url="http://soci.sourceforge.net/"/> object-relational mapping for a class, etc.
+ </item>
+ <item title="More...">
+ There is always place for new ideas.
+ </item>
+ </items>
+ <paragraph>
+ Some of the mentioned features are already implemented, some are still on the TODO list.
         </paragraph>
 </section>

Modified: sandbox/mirror/libs/doc/xml/mirror/sections/overview.xml
==============================================================================
--- sandbox/mirror/libs/doc/xml/mirror/sections/overview.xml (original)
+++ sandbox/mirror/libs/doc/xml/mirror/sections/overview.xml 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -3,6 +3,37 @@
         <paragraph>
                 The <lib_name_ref/> library is a compile-time reflection library, intended to be proposed as a <boost/> library at some point in the future.
         </paragraph>
- <items>
- </items>
+ <paragraph>
+ Reflection is a valuable tool when programming applications where instances of different types and classes need to be treated in a uniform manner. This includes, but is not limited to persistence-related operations like serialization or operations like marshalling.
+ Reflection allows to separate the definition of types from the algorithms that are working on the instances of theese types and vice versa. Thus an existing algorithm can be applied to any type recognized by the reflection facility. Well, at least in theory. There are as always exceptions.
+ </paragraph>
+ <paragraph>
+ An example of this is the <boost_lib_ref name="serialization"/> library, where the archives are implemented separately from the serializable classes and when adding support for serialization to a class no explicit reference to any archive type is made.
+ </paragraph>
+ <paragraph>
+ Here follows a list of several other domains where reflection is applicable:
+ <items>
+ <item title="object inspection">
+ Introspection allows to build user interface components reflecting both the structure and the data of given instances.
+ </item>
+ <item title="debugging and logging">
+ Similar to the above and basically to serialization, a custom debugger or a logging facility can use reflection to log, show and possibly modify the values of examined instances.
+ </item>
+ <item title="implementation of several design patterns">
+ Having a suitable reflection facility, we can easily implement several design patterns like factories, decorators, proxies or mementos (not to be confused with the known freshmaker).
+ </item>
+ </items>
+ </paragraph>
+ <paragraph>
+ Currently, <lib_name_ref/> library is focused on compile-time reflection, but might provide support for dynamic reflection facilities built on top of it.
+ </paragraph>
+ <paragraph>
+ A namespace, type, class, class' member attribute or function becomes <emph>reflectible</emph> when it is <emph>registered</emph>. The registration is performed by the means of preprocessor macros.
+ </paragraph>
+ <paragraph>
+ The <lib_name_ref/> library follows the principle of <emph>stratification</emph> and tries to be as non-intrusive as possible. This is however easier said than done and <lib_name_ref/> hits similar difficulties as <boost_lib_ref name="serialization"/> does in this matter. However, there are cases, in which the existing definition of a class (even with non-public members) does not need to be modified to support reflection and in the other cases only on line of code needs to be added to make the class <lib_name_ref/>-friendly.
+ </paragraph>
+ <paragraph>
+ The <lib_name_ref/> library uses several other <boost/> libraries, most notably <boost_lib_ref name="_mpl"/>, <boost_lib_ref name="preprocessor"/>, <boost_lib_ref name="call_traits"/>, <boost_lib_ref name="typeof"/> and several others. It does not use any other external libraries, besides those mentioned here.
+ </paragraph>
 </section>

Added: sandbox/mirror/libs/doc/xml/mirror/sections/toc_brief.xml
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/doc/xml/mirror/sections/toc_brief.xml 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<section title="Brief table of contents" name="toc_brief">
+ <link_set>
+ <link page="index"/>
+ <link page="quick_start"/>
+ </link_set>
+</section>

Modified: sandbox/mirror/libs/doc/xml/xslt/html.xsl
==============================================================================
--- sandbox/mirror/libs/doc/xml/xslt/html.xsl (original)
+++ sandbox/mirror/libs/doc/xml/xslt/html.xsl 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -8,6 +8,12 @@
         <xsl:include href="&docroot;/section.xsl"/>
         <xsl:include href="&docroot;/paragraph.xsl"/>
         <xsl:include href="&docroot;/note.xsl"/>
+ <xsl:include href="&docroot;/items.xsl"/>
+ <xsl:include href="&docroot;/links.xsl"/>
+ <!-- font style-related -->
+ <xsl:include href="&docroot;/emph.xsl"/>
+ <xsl:include href="&docroot;/cpp_expr.xsl"/>
+ <xsl:include href="&docroot;/filepath.xsl"/>
         <!-- inclusions -->
         <xsl:include href="&docroot;/include.xsl"/>
         <!-- references to various things -->

Modified: sandbox/mirror/libs/doc/xml/xslt/html/boost_refs.xsl
==============================================================================
--- sandbox/mirror/libs/doc/xml/xslt/html/boost_refs.xsl (original)
+++ sandbox/mirror/libs/doc/xml/xslt/html/boost_refs.xsl 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -7,4 +7,78 @@
         <xsl:template match="boost">
                 <A href="http://www.boost.org"><B><EM>boost</EM></B></A>
         </xsl:template>
+ <!--
+ - this helper template properly formats the name of a boost
+ - library
+ -->
+ <xsl:template name="format-boost-lib-name">
+ <xsl:param name="a_name"/>
+ <xsl:param name="at_beginning" select="true()"/>
+ <xsl:variable name="lc_letters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
+ <xsl:variable name="uc_letters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
+ <xsl:choose>
+ <!-- if we are at the beginning -->
+ <xsl:when test="$at_beginning">
+ <!-- if the first character is an underscore -->
+ <xsl:if test="substring($a_name, 1, 1)='_'">
+ <!-- translate all charecters to uppercase and underscores to spaces -->
+ <xsl:value-of select="translate(translate(substring($a_name, 2), $lc_letters, $uc_letters), '_', ' ')"/>
+ </xsl:if>
+ <!-- if the first character is not an underscore -->
+ <xsl:if test="substring($a_name, 1, 1)!='_'">
+ <!-- capitalize the first character -->
+ <xsl:value-of select="translate(substring($a_name, 1, 1), $lc_letters, $uc_letters)"/>
+ <xsl:call-template name="format-boost-lib-name">
+ <xsl:with-param name="a_name" select="substring($a_name, 2)"/>
+ <xsl:with-param name="at_beginning" select="false()"/>
+ </xsl:call-template>
+
+ </xsl:if>
+ </xsl:when>
+ <!-- not at the beginning -->
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="contains($a_name, '_')">
+ <!-- if the first character is an underscore -->
+ <xsl:if test="substring($a_name, 1, 1)='_'">
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="translate(substring($a_name, 2, 1), $lc_letters, $uc_letters)"/>
+ <xsl:call-template name="format-boost-lib-name">
+ <xsl:with-param name="a_name" select="substring($a_name, 3)"/>
+ <xsl:with-param name="at_beginning" select="false()"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!-- if the first character is not an underscore -->
+ <xsl:if test="substring($a_name, 1, 1)!='_'">
+ <xsl:value-of select="translate(substring-before($a_name, '_'), $uc_letters, $lc_letters)"/>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="format-boost-lib-name">
+ <xsl:with-param name="a_name" select="substring-after($a_name, '_')"/>
+ <xsl:with-param name="at_beginning" select="true()"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate($a_name, $uc_letters, $lc_letters)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--
+ - template for the boost_lib_ref node
+ - this node is expanded to the name of a boost library
+ - and is linking to its documentation
+ -->
+ <xsl:template match="boost_lib_ref">
+ <xsl:element name="A">
+ <xsl:attribute name="href">
+ <xsl:text>http://www.boost.org/doc/libs/>
+ </xsl:attribute>
+ <xsl:text>Boost.</xsl:text>
+ <xsl:call-template name="format-boost-lib-name">
+ <xsl:with-param name="a_name" select="@name"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
 </xsl:stylesheet>

Added: sandbox/mirror/libs/doc/xml/xslt/html/cpp_expr.xsl
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/doc/xml/xslt/html/cpp_expr.xsl 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
+ <!--
+ - template for the paragraph node
+ -->
+ <xsl:template match="cpp_expr">
+ <CODE class="cpp-expr">
+ <xsl:apply-templates/>
+ </CODE>
+ </xsl:template>
+</xsl:stylesheet>

Modified: sandbox/mirror/libs/doc/xml/xslt/html/doc_page.xsl
==============================================================================
--- sandbox/mirror/libs/doc/xml/xslt/html/doc_page.xsl (original)
+++ sandbox/mirror/libs/doc/xml/xslt/html/doc_page.xsl 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -5,15 +5,15 @@
          - template that prints out the links to pages related this page
         -->
         <xsl:template name="format-related-page-links">
- <DIV>
- Related pages: [&lt;&lt;][&lt;][^][&gt;][&gt;&gt;]
+ <DIV class="related-pages">
+ Related pages: [Home][&lt;&lt;][&lt;][^][&gt;][&gt;&gt;]
                 </DIV>
         </xsl:template>
         <!--
          - template that prints out the licensing notice
         -->
         <xsl:template name="format-licensing-notice">
- <DIV>
+ <DIV class="licensing-notice">
                         <xsl:text>Distributed under the Boost Software License, Version 1.0.</xsl:text>
                         <xsl:text>(See accompanying file LICENSE_1_0.txt or copy at </xsl:text>
                         <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt>
@@ -21,10 +21,31 @@
                 </DIV>
         </xsl:template>
         <!--
+ - template that prints out the revision notice
+ -->
+ <xsl:template name="format-revision-notice">
+ <DIV class="revision-notice">
+ <xsl:for-each select="document($lib_info_url)/library/revisions/revision[position()=last()]">
+ <xsl:text>Last revision (</xsl:text>
+ <xsl:value-of select="@major"/>
+ <xsl:text>.</xsl:text>
+ <xsl:value-of select="@minor"/>
+ <xsl:text>.</xsl:text>
+ <xsl:value-of select="@micro"/>
+ <xsl:text>) Date: </xsl:text>
+ <xsl:value-of select="substring(@id, 1,4)"/>
+ <xsl:text>-</xsl:text>
+ <xsl:value-of select="substring(@id, 5,2)"/>
+ <xsl:text>-</xsl:text>
+ <xsl:value-of select="substring(@id, 7,2)"/>
+ </xsl:for-each>
+ </DIV>
+ </xsl:template>
+ <!--
          - template that prints out the copyright notice
         -->
         <xsl:template name="format-copyright-notice">
- <DIV>
+ <DIV class="copyright-notice">
                         <xsl:text>Copyright (C) </xsl:text>
                         <xsl:for-each select="document($lib_info_url)/library/authors/author">
                                 <xsl:if test="position()!=1">
@@ -76,20 +97,16 @@
                                 </TITLE>
                                 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"/>
                                 <META NAME="author" CONTENT="Matus Chochlik"/>
+ <LINK REL="stylesheet" HREF="../../css/mirror.css" TYPE="text/css"/>
                         </HEAD>
- <BODY STYLE="
- display: block;
- font-family: Arial;
- font-size: 10pt;
- text-align: justify;
- text-indent: 0mm;
- ">
+ <BODY>
                                 <H1><xsl:value-of select="@title"/></H1>
                                 <xsl:call-template name="format-copyright-notice"/>
                                 <xsl:call-template name="format-licensing-notice"/>
                                 <xsl:call-template name="format-related-page-links"/>
                                 <xsl:apply-templates/>
                                 <xsl:call-template name="format-related-page-links"/>
+ <xsl:call-template name="format-revision-notice"/>
                         </BODY>
                 </HTML>
         </xsl:template>

Added: sandbox/mirror/libs/doc/xml/xslt/html/emph.xsl
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/doc/xml/xslt/html/emph.xsl 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
+ <!--
+ - template for the paragraph node
+ -->
+ <xsl:template match="emph">
+ <EM><xsl:apply-templates/></EM>
+ </xsl:template>
+</xsl:stylesheet>

Added: sandbox/mirror/libs/doc/xml/xslt/html/filepath.xsl
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/doc/xml/xslt/html/filepath.xsl 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <!--
+ - template for the paragraph node
+ -->
+ <xsl:template match="filepath">
+ <CODE class="filepath">
+ <xsl:text>"</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>"</xsl:text>
+ </CODE>
+ </xsl:template>
+</xsl:stylesheet>

Added: sandbox/mirror/libs/doc/xml/xslt/html/items.xsl
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/doc/xml/xslt/html/items.xsl 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <!--
+ - template for the items node
+ - items node represents a item list
+ -->
+ <xsl:template match="items">
+ <UL>
+ <xsl:apply-templates/>
+ </UL>
+ </xsl:template>
+ <!--
+ - template for the item node
+ - item node represents a single item in a item list
+ -->
+ <xsl:template match="item">
+ <LI>
+ <xsl:if test="@title">
+ <B><xsl:value-of select="@title"/>:</B>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </LI>
+ </xsl:template>
+</xsl:stylesheet>

Added: sandbox/mirror/libs/doc/xml/xslt/html/links.xsl
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/doc/xml/xslt/html/links.xsl 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <!--
+ - template for the link_set node
+ -->
+ <xsl:template match="link_set">
+ <DIV class="linkset">
+ <xsl:apply-templates/>
+ </DIV>
+ </xsl:template>
+ <!--
+ - template for the link node
+ -->
+ <xsl:template match="link">
+ <xsl:variable name="source_url">
+ <xsl:choose>
+ <xsl:when test="@section">
+ <xsl:text>../sections/</xsl:text>
+ <xsl:value-of select="@section"/>
+ <xsl:text>.xml</xsl:text>
+ </xsl:when>
+ <xsl:when test="@page">
+ <xsl:text>../pages/</xsl:text>
+ <xsl:value-of select="@page"/>
+ <xsl:text>.xml</xsl:text>
+ </xsl:when>
+ <xsl:when test="@url">
+ <xsl:value-of select="@url"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="link_title">
+ <xsl:choose>
+ <xsl:when test="@title">
+ <xsl:value-of select="@title"/>
+ </xsl:when>
+ <xsl:when test="@section">
+ <xsl:value-of select="document($source_url)/section/@title"/>
+ </xsl:when>
+ <xsl:when test="@page">
+ <xsl:value-of select="document($source_url)/doc_page/@title"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>--INVALID LINK--</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="parent::link_set">
+ <xsl:element name="A">
+ <xsl:attribute name="class">
+ <xsl:text>linkset-link</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$source_url"/>
+ </xsl:attribute>
+ <xsl:value-of select="$link_title"/>
+ </xsl:element>
+ <BR/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="A">
+ <xsl:attribute name="href">
+ <xsl:value-of select="$source_url"/>
+ </xsl:attribute>
+ <xsl:value-of select="$link_title"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>

Modified: sandbox/mirror/libs/doc/xml/xslt/html/note.xsl
==============================================================================
--- sandbox/mirror/libs/doc/xml/xslt/html/note.xsl (original)
+++ sandbox/mirror/libs/doc/xml/xslt/html/note.xsl 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -4,7 +4,7 @@
          - template for the paragraph node
         -->
         <xsl:template match="note">
- <P>
+ <P class="note">
                         <B>Note:</B>
                         <EM><xsl:apply-templates/></EM>
                 </P>

Modified: sandbox/mirror/libs/doc/xml/xslt/html/section.xsl
==============================================================================
--- sandbox/mirror/libs/doc/xml/xslt/html/section.xsl (original)
+++ sandbox/mirror/libs/doc/xml/xslt/html/section.xsl 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -14,7 +14,7 @@
                 <xsl:element name="{$heading_kind}">
                         <xsl:value-of select="@title"/>
                 </xsl:element>
- <DIV>
+ <DIV class="section">
                         <xsl:apply-templates/>
                 </DIV>
         </xsl:template>

Added: sandbox/mirror/libs/examples/registering/namespaces.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/examples/registering/namespaces.cpp 2008-04-16 13:52:22 EDT (Wed, 16 Apr 2008)
@@ -0,0 +1,114 @@
+/**
+ * \file examples/registering/namespaces.hpp
+ * Example of namespace registering and reflection
+ *
+ * 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)
+ */
+// narrow/wide char stream
+#include <boost/char_type_switch/iostream.hpp>
+// namespace registering
+#include <boost/mirror/meta_namespace.hpp>
+// utility that allows to put the name of the namespace to a given stream
+#include <boost/mirror/utils/name_to_stream/namespace.hpp>
+//
+// mpl size meta function
+#include <boost/mpl/size.hpp>
+
+
+namespace test {
+namespace feature {
+namespace detail {
+
+} // namespace detail
+} // namespace feature
+
+namespace stuff {
+namespace detail {
+
+} // namespace detail
+} // namespace stuff
+} // namespace test
+
+
+namespace boost {
+namespace mirror {
+
+// register the namespaces
+//
+// the namespace 'test' in the global scope
+BOOST_MIRROR_REG_META_NAMESPACE_TOP_LEVEL(test, BOOST_PP_TUPLE_REM_CTOR(4,('t','e','s','t')))
+// namespace feature in namespace ::test
+// the _test is a "namespace alias" for namespace ::test
+// _ is the namespace alias for the global scope
+BOOST_MIRROR_REG_META_NAMESPACE(_test, feature, BOOST_PP_TUPLE_REM_CTOR(7,('f','e','a','t','u','r','e')))
+BOOST_MIRROR_REG_META_NAMESPACE(_test_feature, detail, BOOST_PP_TUPLE_REM_CTOR(6,('d','e','t','a','i','l')))
+BOOST_MIRROR_REG_META_NAMESPACE(_test, stuff, BOOST_PP_TUPLE_REM_CTOR(5,('s','t','u','f','f')))
+BOOST_MIRROR_REG_META_NAMESPACE(_test_stuff, detail, BOOST_PP_TUPLE_REM_CTOR(6,('d','e','t','a','i','l')))
+
+} // namespace mirror
+} // namespace boost
+
+int main(void)
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ // NOTE bcout ~ cout when using narrow chars
+ // ~ wcout when using wide chars
+ // it's typedef'd in the boost namespace
+ //
+ // the BOOST_MIRROR_REFLECT_NAMESPACE(NAMESPACE_ALIAS) returns the
+ // meta_namespace<> specialization for the given namespace alias
+ //
+ // define an alternative name for the global scope meta-data
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_) meta_ns_global_scope;
+ // define an alternative name for the ::test namespace meta-data
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test) meta_ns_test;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail) meta_ns_test_stuff_detail;
+ //
+ //
+ // the base name function allows to get the base name
+ // of the namespace
+ //
+ // print the base name of the namespace
+ bcout << meta_ns_test_stuff_detail::base_name() << endl;
+ //
+ // the 'parent' type is the meta_namespace<> for the parent
+ // namespace of the given namespace
+ //
+ // print the base name of the parent namespace
+ bcout << meta_ns_test_stuff_detail::parent::base_name() << endl;
+ bcout << meta_ns_test_stuff_detail::parent::parent::base_name() << endl;
+ //
+ // the 'scope' member is a mpl::vector containing the whole
+ // list of ancestor namespaces
+ //
+ // find out and print the 'depth' of the namespace
+ bcout << mpl::size<meta_ns_global_scope::scope>::value << endl;
+ bcout << mpl::size<meta_ns_test::scope>::value << endl;
+ bcout << mpl::size<meta_ns_test_stuff_detail::scope>::value << endl;
+ //
+ // the name_to_stream<meta_object> class allows to put the full name
+ // (including the scope) into a stream
+ bcout << name_to_stream< BOOST_MIRROR_REFLECT_NAMESPACE(_) >() << endl;
+ bcout << name_to_stream< BOOST_MIRROR_REFLECT_NAMESPACE(_test) >() << endl;
+ bcout << name_to_stream< BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff) >() << endl;
+ bcout << name_to_stream< BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail) >() << endl;
+ // in this case the :: is prepended to the full name
+ // thus test::stuff -> ::test::stuff
+ bcout << name_to_stream< BOOST_MIRROR_REFLECT_NAMESPACE(_) >(true) << endl;
+ bcout << name_to_stream< BOOST_MIRROR_REFLECT_NAMESPACE(_test) >(true) << endl;
+ bcout << name_to_stream< BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff) >(true) << endl;
+ bcout << name_to_stream< BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail) >(true) << endl;
+ //
+ // there are few namespace registered by default
+ // including (::std, ::boost, ::boost::mirror)
+ bcout << name_to_stream< BOOST_MIRROR_REFLECT_NAMESPACE(_std) >(true) << endl;
+ bcout << name_to_stream< BOOST_MIRROR_REFLECT_NAMESPACE(_boost) >(true) << endl;
+ bcout << name_to_stream< BOOST_MIRROR_REFLECT_NAMESPACE(_boost_mirror) >(true) << 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