|
Boost-Commit : |
From: chochlik_at_[hidden]
Date: 2008-08-12 12:40:28
Author: matus.chochlik
Date: 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
New Revision: 48105
URL: http://svn.boost.org/trac/boost/changeset/48105
Log:
[mirror 0.2.x]
- minor documentation update
- fixed the tests
- added native type reflection test
Added:
sandbox/mirror/doc/html/mirror/rationale.html (contents, props changed)
sandbox/mirror/libs/mirror/doc/reference/macro_REG_TYPE.xml (contents, props changed)
sandbox/mirror/libs/mirror/test/types_ct_01.cpp (contents, props changed)
Text files modified:
sandbox/mirror/libs/mirror/doc/reference.xml | 5 +++
sandbox/mirror/libs/mirror/doc/reference/meta_type.xml | 3 ++
sandbox/mirror/libs/mirror/test/Jamfile.v2 | 1
sandbox/mirror/libs/mirror/test/namespaces.hpp | 10 +++---
sandbox/mirror/libs/mirror/test/namespaces_cf_01.cpp | 2
sandbox/mirror/libs/mirror/test/namespaces_ct_01.cpp | 26 +++++++++---------
sandbox/mirror/libs/mirror/test/namespaces_ct_02.cpp | 25 +++++++++--------
sandbox/mirror/libs/mirror/test/namespaces_ct_03.cpp | 12 ++++----
sandbox/mirror/libs/mirror/test/namespaces_ct_04.cpp | 44 ++++++++++++++++----------------
sandbox/mirror/libs/mirror/test/namespaces_rt_01.cpp | 50 ++++++++++++++++++------------------
sandbox/mirror/libs/mirror/test/namespaces_rt_02.cpp | 54 ++++++++++++++++++++--------------------
11 files changed, 121 insertions(+), 111 deletions(-)
Added: sandbox/mirror/doc/html/mirror/rationale.html
==============================================================================
--- (empty file)
+++ sandbox/mirror/doc/html/mirror/rationale.html 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -0,0 +1,44 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Rationale</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
+<link rel="start" href="../index.html" title="The Mirror library documentation">
+<link rel="up" href="../mirror.html" title="Chapter 1. Mirror">
+<link rel="prev" href="../boost/mirror/reflects_virtual_inheritance.html" title="Class template reflects_virtual_inheritance">
+<link rel="next" href="../char_type_switch.html" title="Chapter 2. Char Type Switch">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../boost/mirror/reflects_virtual_inheritance.html"><img src="../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mirror.html"><img src="../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../char_type_switch.html"><img src="../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mirror.rationale"></a>Rationale</h2></div></div></div>
+<p>
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Matúš Chochlík<p>Use, modification and distribution is subject to the Boost
+ Software License, Version 1.0. (See accompanying file
+ <code class="filename">LICENSE_1_0.txt</code> or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../boost/mirror/reflects_virtual_inheritance.html"><img src="../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mirror.html"><img src="../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../char_type_switch.html"><img src="../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Modified: sandbox/mirror/libs/mirror/doc/reference.xml
==============================================================================
--- sandbox/mirror/libs/mirror/doc/reference.xml (original)
+++ sandbox/mirror/libs/mirror/doc/reference.xml 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -37,6 +37,11 @@
<entry>Registers a namespace</entry>
<entry></entry>
</row>
+ <row>
+ <entry><code><macroname>BOOST_MIRROR_REG_TYPE</macroname></code></entry>
+ <entry>Registers a type defined inside of a named namespace</entry>
+ <entry></entry>
+ </row>
</tbody>
</tgroup>
</table>
Added: sandbox/mirror/libs/mirror/doc/reference/macro_REG_TYPE.xml
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/doc/reference/macro_REG_TYPE.xml 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE section PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
+ "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<macro name="BOOST_MIRROR_REG_TYPE"
+ kind="functionlike"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+>
+ <macro-parameter name="NAMESPACE">
+ </macro-parameter>
+ <macro-parameter name="TYPE">
+ </macro-parameter>
+ <purpose>
+ <para>This macro is used to register a type that is defined inside of a namespace with <libraryname>Mirror</libraryname>.
+ After successful registration the type can be reflected.
+ </para>
+ </purpose>
+ <description>
+ <para>The <code><macroname>BOOST_MIRROR_REG_TYPE</macroname></code> macro registers a type with
+ the <libraryname>Mirror</libraryname> library. To register a type defined in the global scope
+ use the <code><macroname>BOOST_MIRROR_REG_TYPE_GLOBAL_SCOPE</macroname></code> or the
+ <code><macroname>BOOST_MIRROR_REG_TYPE_GS</macroname></code> macro. To register a <code>typedef</code>ined
+ type use one of the <code><macroname>BOOST_MIRROR_REG_TYPEDEF_GLOBAL_SCOPE</macroname></code>,
+ <code><macroname>BOOST_MIRROR_REG_TYPEDEF_GS</macroname></code> or <code><macroname>BOOST_MIRROR_REG_TYPEDEF</macroname></code>
+ macros. To register a type that is defined inside of a class use either the
+ <code><macroname>BOOST_MIRROR_REG_TYPE_EMBEDDED</macroname></code> or the <code><macroname>BOOST_MIRROR_REG_TYPE_EMB</macroname></code>
+ macro.
+ <note>The registering must be done in the <code>::boost::mirror</code> namespace.</note>
+ To register a type <code>bar</code> defined in a named namespace <code>foo</code>,
+ </para>
+<programlisting>
+namespace foo {
+ struct bar { };
+} // namespace foo
+</programlisting>
+ do this:
+<programlisting>
+// note that the registering must be done
+// in the boost::mirror namespace
+
+namespace boost {
+namespace mirror {
+
+// registers ::foo
+<macroname>BOOST_MIRROR_REG_NAMESPACE</macroname>((foo))
+// note that the full namespace name including the leading
+// double colon must be passed as the first argument
+<macroname>BOOST_MIRROR_REG_TYPE</macroname>(::foo, bar)
+
+} //namespace mirror
+} //namespace boost
+</programlisting>
+ Afterwards the types can be reflected with the
+ <code><macroname>BOOST_MIRRORED_TYPE</macroname></code> macro:
+<programlisting>
+BOOST_MPL_ASSERT((
+ <classname>reflects_type</classname>< <macroname>BOOST_MIRRORED_TYPE</macroname>(::foo::bar) >
+));
+BOOST_MPL_ASSERT((
+ <classname>reflects_namespace</classname>< <macroname>BOOST_MIRRORED_TYPE</macroname>(::foo::bar)::scope >
+));
+BOOST_MPL_ASSERT((
+ <classname>reflects_global_scope</classname>< <macroname>BOOST_MIRRORED_TYPE</macroname>(::foo::bar)::scope::scope >
+));
+</programlisting>
+ The <libraryname>Mirror</libraryname> has several preregistered types:
+<programlisting>
+namespace boost {
+namespace mirror {
+
+<macroname>BOOST_MIRROR_REG_TYPE</macroname>(::std, string)
+<macroname>BOOST_MIRROR_REG_TYPE</macroname>(::std, wstring)
+<macroname>BOOST_MIRROR_REG_TYPE</macroname>(::boost::tuples, tuple)
+
+} //namespace mirror
+} //namespace boost
+</programlisting>
+ </para>
+
+ <section id="mirror.REG_TYPE.reference.samples">
+ <title>Examples</title>
+ <para>This example shows the registering and reflection of namespaces
+ and basic usage of the <code><classname>meta_namespace</classname></code>
+ template class and its members.
+ </para>
+ </section>
+
+ </description>
+</macro>
Modified: sandbox/mirror/libs/mirror/doc/reference/meta_type.xml
==============================================================================
--- sandbox/mirror/libs/mirror/doc/reference/meta_type.xml (original)
+++ sandbox/mirror/libs/mirror/doc/reference/meta_type.xml 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -15,6 +15,9 @@
</namespace><!-- boost -->
<!-- macros -->
+ <!-- registering -->
+ <xi:include href="macro_REG_TYPE.xml"/>
+ <!-- reflection -->
<xi:include href="macro_RFL_TYPE.xml"/>
<xi:include href="macro_RFL_TYPE_NS.xml"/>
<xi:include href="macro_RFL_TYPEDEF.xml"/>
Modified: sandbox/mirror/libs/mirror/test/Jamfile.v2
==============================================================================
--- sandbox/mirror/libs/mirror/test/Jamfile.v2 (original)
+++ sandbox/mirror/libs/mirror/test/Jamfile.v2 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -20,5 +20,6 @@
[ compile namespaces_ct_03.cpp ]
[ compile namespaces_ct_04.cpp ]
[ compile-fail namespaces_cf_01.cpp ]
+ [ compile types_ct_01.cpp ]
;
Modified: sandbox/mirror/libs/mirror/test/namespaces.hpp
==============================================================================
--- sandbox/mirror/libs/mirror/test/namespaces.hpp (original)
+++ sandbox/mirror/libs/mirror/test/namespaces.hpp 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -35,13 +35,13 @@
// register the namespaces
//
-BOOST_MIRROR_REG_NAMESPACE_TOP_LEVEL(test)
+BOOST_MIRROR_REG_NAMESPACE((test))
//
-BOOST_MIRROR_REG_NAMESPACE(_test, feature)
-BOOST_MIRROR_REG_NAMESPACE(_test_feature, detail)
+BOOST_MIRROR_REG_NAMESPACE((test)(feature))
+BOOST_MIRROR_REG_NAMESPACE((test)(feature)(detail))
//
-BOOST_MIRROR_REG_NAMESPACE(_test, stuff)
-BOOST_MIRROR_REG_NAMESPACE(_test_stuff, detail)
+BOOST_MIRROR_REG_NAMESPACE((test)(stuff))
+BOOST_MIRROR_REG_NAMESPACE((test)(stuff)(detail))
} // namespace mirror
} // namespace boost
Modified: sandbox/mirror/libs/mirror/test/namespaces_cf_01.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/test/namespaces_cf_01.cpp (original)
+++ sandbox/mirror/libs/mirror/test/namespaces_cf_01.cpp 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -23,7 +23,7 @@
using namespace ::boost::mirror;
//
// no such namespace registered
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_foo) meta_ns_foo;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(not_defined_ns) meta_ns_ndns;
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
Modified: sandbox/mirror/libs/mirror/test/namespaces_ct_01.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/test/namespaces_ct_01.cpp (original)
+++ sandbox/mirror/libs/mirror/test/namespaces_ct_01.cpp 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -11,7 +11,7 @@
*/
// not operator
-#include <boost/mpl/not.hpp>
+#include <boost/mpl/assert.hpp>
// namespace registering
#include <boost/mirror/traits/reflects_global_scope.hpp>
//
@@ -25,21 +25,21 @@
using namespace ::boost::mirror;
//
// define an alternative name for the global scope meta-data
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_) meta_ns_;
- BOOST_STATIC_ASSERT( reflects_global_scope<meta_ns_>::value );
+ typedef BOOST_MIRRORED_GLOBAL_SCOPE() meta_gs;
+ BOOST_STATIC_ASSERT( reflects_global_scope<meta_gs>::value );
//
// 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) meta_ns_test_stuff;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail) meta_ns_test_stuff_detail;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature) meta_ns_test_feature;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature_detail) meta_ns_test_feature_detail;
+ typedef BOOST_MIRRORED_NAMESPACE(::test) meta_ns_test;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::stuff) meta_ns_test_stuff;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::stuff::detail) meta_ns_test_stuff_detail;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::feature) meta_ns_test_feature;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::feature::detail) meta_ns_test_feature_detail;
//
- BOOST_STATIC_ASSERT( mpl::not_<reflects_global_scope<meta_ns_test> >::value );
- BOOST_STATIC_ASSERT( mpl::not_<reflects_global_scope<meta_ns_test_stuff> >::value );
- BOOST_STATIC_ASSERT( mpl::not_<reflects_global_scope<meta_ns_test_stuff_detail> >::value );
- BOOST_STATIC_ASSERT( mpl::not_<reflects_global_scope<meta_ns_test_feature> >::value );
- BOOST_STATIC_ASSERT( mpl::not_<reflects_global_scope<meta_ns_test_feature_detail> >::value );
+ BOOST_MPL_ASSERT_NOT(( reflects_global_scope<meta_ns_test> ));
+ BOOST_MPL_ASSERT_NOT(( reflects_global_scope<meta_ns_test_stuff> ));
+ BOOST_MPL_ASSERT_NOT(( reflects_global_scope<meta_ns_test_stuff_detail> ));
+ BOOST_MPL_ASSERT_NOT(( reflects_global_scope<meta_ns_test_feature> ));
+ BOOST_MPL_ASSERT_NOT(( reflects_global_scope<meta_ns_test_feature_detail> ));
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
Modified: sandbox/mirror/libs/mirror/test/namespaces_ct_02.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/test/namespaces_ct_02.cpp (original)
+++ sandbox/mirror/libs/mirror/test/namespaces_ct_02.cpp 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -10,6 +10,7 @@
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
+#include <boost/mpl/assert.hpp>
// namespace registering
#include <boost/mirror/traits/reflects_namespace.hpp>
//
@@ -23,20 +24,20 @@
using namespace ::boost::mirror;
//
// define an alternative name for the global scope meta-data
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_) meta_ns_;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test) meta_ns_test;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff) meta_ns_test_stuff;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail) meta_ns_test_stuff_detail;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature) meta_ns_test_feature;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature_detail) meta_ns_test_feature_detail;
+ typedef BOOST_MIRRORED_GLOBAL_SCOPE() meta_gs;
+ typedef BOOST_MIRRORED_NAMESPACE(::test) meta_ns_test;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::stuff) meta_ns_test_stuff;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::stuff::detail) meta_ns_test_stuff_detail;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::feature) meta_ns_test_feature;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::feature::detail) meta_ns_test_feature_detail;
//
//
- BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_>::value );
- BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_test>::value );
- BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_test_stuff>::value );
- BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_test_stuff_detail>::value );
- BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_test_feature>::value );
- BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_test_feature_detail>::value );
+ BOOST_MPL_ASSERT(( reflects_namespace<meta_gs> ));
+ BOOST_MPL_ASSERT(( reflects_namespace<meta_ns_test> ));
+ BOOST_MPL_ASSERT(( reflects_namespace<meta_ns_test_stuff> ));
+ BOOST_MPL_ASSERT(( reflects_namespace<meta_ns_test_stuff_detail> ));
+ BOOST_MPL_ASSERT(( reflects_namespace<meta_ns_test_feature> ));
+ BOOST_MPL_ASSERT(( reflects_namespace<meta_ns_test_feature_detail> ));
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
Modified: sandbox/mirror/libs/mirror/test/namespaces_ct_03.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/test/namespaces_ct_03.cpp (original)
+++ sandbox/mirror/libs/mirror/test/namespaces_ct_03.cpp 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -23,22 +23,22 @@
using namespace ::boost::mirror;
//
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_NAMESPACE(_)
+ BOOST_MIRRORED_GLOBAL_SCOPE()
>::value );
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_NAMESPACE(_test)
+ BOOST_MIRRORED_NAMESPACE(::test)
>::value );
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff)
+ BOOST_MIRRORED_NAMESPACE(::test::stuff)
>::value );
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail)
+ BOOST_MIRRORED_NAMESPACE(::test::stuff::detail)
>::value );
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature)
+ BOOST_MIRRORED_NAMESPACE(::test::feature)
>::value );
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature_detail)
+ BOOST_MIRRORED_NAMESPACE(::test::feature::detail)
>::value );
}
Modified: sandbox/mirror/libs/mirror/test/namespaces_ct_04.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/test/namespaces_ct_04.cpp (original)
+++ sandbox/mirror/libs/mirror/test/namespaces_ct_04.cpp 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -10,7 +10,7 @@
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
-#include <boost/mpl/not.hpp>
+#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
// namespace registering
#include <boost/mirror/traits/reflects_namespace.hpp>
@@ -27,44 +27,44 @@
using namespace ::boost::mirror;
//
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_TYPE(bool) :: scope
+ BOOST_MIRRORED_TYPE(bool) :: scope
>::value );
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_TYPE(char) :: scope
+ BOOST_MIRRORED_TYPE(char) :: scope
>::value );
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_TYPE(int) :: scope
+ BOOST_MIRRORED_TYPE(int) :: scope
>::value );
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_TYPE(double) :: scope
+ BOOST_MIRRORED_TYPE(double) :: scope
>::value );
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_TYPE(void*) :: scope
+ BOOST_MIRRORED_TYPE(void*) :: scope
>::value );
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_TYPE(int const * const *) :: scope
+ BOOST_MIRRORED_TYPE(int const * const *) :: scope
>::value );
BOOST_STATIC_ASSERT( reflects_namespace<
- BOOST_MIRROR_REFLECT_TYPE(char volatile * const &) :: scope
+ BOOST_MIRRORED_TYPE(char volatile * const &) :: scope
>::value );
//
BOOST_STATIC_ASSERT(( is_same<
- BOOST_MIRROR_REFLECT_TYPE(const char* []) :: scope,
- BOOST_MIRROR_REFLECT_TYPE(int volatile &) :: scope
+ BOOST_MIRRORED_TYPE(const char* []) :: scope,
+ BOOST_MIRRORED_TYPE(int volatile &) :: scope
>::value ));
- BOOST_STATIC_ASSERT(( is_same<
- BOOST_MIRROR_REFLECT_TYPEDEFD(_boost, bchar) :: scope,
- BOOST_MIRROR_REFLECT_TYPEDEFD(_boost, bstring) :: scope
- >::value ));
- BOOST_STATIC_ASSERT(( mpl::not_<is_same<
- BOOST_MIRROR_REFLECT_TYPEDEFD(_boost, bchar) :: scope,
- BOOST_MIRROR_REFLECT_TYPE(char) :: scope
- > >::value ));
- BOOST_STATIC_ASSERT(( mpl::not_<is_same<
- BOOST_MIRROR_REFLECT_TYPEDEFD(_boost, bchar) :: scope,
- BOOST_MIRROR_REFLECT_TYPE(wchar_t) :: scope
- > >::value ));
+ BOOST_MPL_ASSERT(( is_same<
+ BOOST_MIRRORED_TYPEDEF(::boost::cts, bchar) :: scope,
+ BOOST_MIRRORED_TYPEDEF(::boost::cts, bstring) :: scope
+ > ));
+ BOOST_MPL_ASSERT_NOT((is_same<
+ BOOST_MIRRORED_TYPEDEF(::boost::cts, bchar) :: scope,
+ BOOST_MIRRORED_TYPE(char) :: scope
+ > ));
+ BOOST_MPL_ASSERT_NOT(( is_same<
+ BOOST_MIRRORED_TYPEDEF(::boost::cts, bchar) :: scope,
+ BOOST_MIRRORED_TYPE(wchar_t) :: scope
+ > ));
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
Modified: sandbox/mirror/libs/mirror/test/namespaces_rt_01.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/test/namespaces_rt_01.cpp (original)
+++ sandbox/mirror/libs/mirror/test/namespaces_rt_01.cpp 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -23,32 +23,32 @@
//
//
// 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) meta_ns_test_stuff;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail) meta_ns_test_stuff_detail;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature) meta_ns_test_feature;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature_detail) meta_ns_test_feature_detail;
+ typedef BOOST_MIRRORED_NAMESPACE(::test) meta_ns_test;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::stuff) meta_ns_test_stuff;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::stuff::detail) meta_ns_test_stuff_detail;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::feature) meta_ns_test_feature;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::feature::detail) meta_ns_test_feature_detail;
//
- BOOST_CHECK(bstrcmp(
- meta_ns_test::base_name(),
- BOOST_STR_LIT("test")
- ) == 0);
- BOOST_CHECK(bstrcmp(
- meta_ns_test_stuff::base_name(),
- BOOST_STR_LIT("stuff")
- ) == 0);
- BOOST_CHECK(bstrcmp(
- meta_ns_test_stuff_detail::base_name(),
- BOOST_STR_LIT("detail")
- ) == 0);
- BOOST_CHECK(bstrcmp(
- meta_ns_test_feature::base_name(),
- BOOST_STR_LIT("feature")
- ) == 0);
- BOOST_CHECK(bstrcmp(
- meta_ns_test_feature_detail::base_name(),
- BOOST_STR_LIT("detail")
- ) == 0);
+ BOOST_CHECK(
+ meta_ns_test::base_name() ==
+ BOOST_CTS_LIT("test")
+ );
+ BOOST_CHECK(
+ meta_ns_test_stuff::base_name() ==
+ BOOST_CTS_LIT("stuff")
+ );
+ BOOST_CHECK(
+ meta_ns_test_stuff_detail::base_name() ==
+ BOOST_CTS_LIT("detail")
+ );
+ BOOST_CHECK(
+ meta_ns_test_feature::base_name() ==
+ BOOST_CTS_LIT("feature")
+ );
+ BOOST_CHECK(
+ meta_ns_test_feature_detail::base_name() ==
+ BOOST_CTS_LIT("detail")
+ );
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
Modified: sandbox/mirror/libs/mirror/test/namespaces_rt_02.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/test/namespaces_rt_02.cpp (original)
+++ sandbox/mirror/libs/mirror/test/namespaces_rt_02.cpp 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -23,36 +23,36 @@
//
//
// define an alternative name for the global scope meta-data
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_) meta_ns_;
- BOOST_STATIC_ASSERT( reflects_global_scope<meta_ns_>::value );
+ typedef BOOST_MIRRORED_GLOBAL_SCOPE() meta_gs;
+ BOOST_STATIC_ASSERT( reflects_global_scope<meta_gs>::value );
//
// 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) meta_ns_test_stuff;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail) meta_ns_test_stuff_detail;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature) meta_ns_test_feature;
- typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature_detail) meta_ns_test_feature_detail;
+ typedef BOOST_MIRRORED_NAMESPACE(::test) meta_ns_test;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::stuff) meta_ns_test_stuff;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::stuff::detail) meta_ns_test_stuff_detail;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::feature) meta_ns_test_feature;
+ typedef BOOST_MIRRORED_NAMESPACE(::test::feature::detail) meta_ns_test_feature_detail;
//
- BOOST_CHECK(bstrcmp(
- meta_ns_test::full_name(),
- BOOST_STR_LIT("::test")
- ) == 0);
- BOOST_CHECK(bstrcmp(
- meta_ns_test_stuff::full_name(),
- BOOST_STR_LIT("::test::stuff")
- ) == 0);
- BOOST_CHECK(bstrcmp(
- meta_ns_test_stuff_detail::full_name(),
- BOOST_STR_LIT("::test::stuff::detail")
- ) == 0);
- BOOST_CHECK(bstrcmp(
- meta_ns_test_feature::full_name(),
- BOOST_STR_LIT("::test::feature")
- ) == 0);
- BOOST_CHECK(bstrcmp(
- meta_ns_test_feature_detail::full_name(),
- BOOST_STR_LIT("::test::feature::detail")
- ) == 0);
+ BOOST_CHECK(
+ meta_ns_test::full_name() ==
+ BOOST_CTS_LIT("::test")
+ );
+ BOOST_CHECK(
+ meta_ns_test_stuff::full_name() ==
+ BOOST_CTS_LIT("::test::stuff")
+ );
+ BOOST_CHECK(
+ meta_ns_test_stuff_detail::full_name() ==
+ BOOST_CTS_LIT("::test::stuff::detail")
+ );
+ BOOST_CHECK(
+ meta_ns_test_feature::full_name() ==
+ BOOST_CTS_LIT("::test::feature")
+ );
+ BOOST_CHECK(
+ meta_ns_test_feature_detail::full_name() ==
+ BOOST_CTS_LIT("::test::feature::detail")
+ );
}
test_suite* init_unit_test_suite( int argc, char* argv[] )
Added: sandbox/mirror/libs/mirror/test/types_ct_01.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/types_ct_01.cpp 2008-08-12 12:40:26 EDT (Tue, 12 Aug 2008)
@@ -0,0 +1,52 @@
+/**
+ * \file test/types_ct_01.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing type registration 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)
+ */
+
+// not operator
+#include <boost/mpl/assert.hpp>
+// namespace registering
+#include <boost/mirror/traits/reflects_global_scope.hpp>
+#include <boost/mirror/traits/reflects_namespace.hpp>
+#include <boost/mirror/traits/reflects_type.hpp>
+//
+// pre-registered types
+#include <boost/mirror/meta_type.hpp>
+//
+#include "./namespaces.hpp"
+#include "./test.hpp"
+
+void test_main()
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ typedef BOOST_MIRRORED_TYPE(int) meta_int;
+ typedef BOOST_MIRRORED_TYPE(::std::string) meta_std_string;
+ //
+ BOOST_MPL_ASSERT_NOT(( is_same<meta_int, meta_std_string> ));
+ BOOST_MPL_ASSERT(( reflects_global_scope<meta_int::scope> ));
+ BOOST_MPL_ASSERT(( reflects_namespace<meta_std_string::scope > ));
+ BOOST_MPL_ASSERT_NOT(( reflects_global_scope<meta_std_string::scope> ));
+ BOOST_MPL_ASSERT(( reflects_global_scope<meta_std_string::scope::scope> ));
+ //
+ BOOST_MPL_ASSERT(( is_same<meta_int::reflected_type, int> ));
+ BOOST_MPL_ASSERT(( is_same<meta_std_string::reflected_type, ::std::string> ));
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: types compile test 01");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+
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