Boost logo

Boost-Commit :

From: chochlik_at_[hidden]
Date: 2008-07-16 11:27:23


Author: matus.chochlik
Date: 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
New Revision: 47473
URL: http://svn.boost.org/trac/boost/changeset/47473

Log:
[mirror 0.2.x]
- The meta_namespace / meta_type member function get_name is now more generic
  and is allowing to specify the type of the return value. Thus based on the type
  of the newly introduced second parameter the return type can be a string or wstring.
- Started the documentation for 'char_type_switch' library
- Updated documentation for mirror
Added:
   sandbox/mirror/doc/html/char_type_switch.html (contents, props changed)
   sandbox/mirror/libs/char_type_switch/
   sandbox/mirror/libs/char_type_switch/doc/
   sandbox/mirror/libs/char_type_switch/doc/Jamfile.v2 (contents, props changed)
   sandbox/mirror/libs/char_type_switch/doc/char_type_switch.xml (contents, props changed)
   sandbox/mirror/libs/char_type_switch/doc/introduction.xml (contents, props changed)
Text files modified:
   sandbox/mirror/boost/char_type_switch/string.hpp | 3
   sandbox/mirror/boost/mirror/detail/argument_type_list.hpp | 45 +++-
   sandbox/mirror/boost/mirror/detail/decorated_type_name.hpp | 339 +++++++++++++++++++++++++--------------
   sandbox/mirror/boost/mirror/detail/full_name_builder.hpp | 74 ++++++--
   sandbox/mirror/boost/mirror/detail/function_type_name.hpp | 42 ++--
   sandbox/mirror/boost/mirror/detail/meta_type_registering.hpp | 25 ++
   sandbox/mirror/boost/mirror/detail/static_int_to_str.hpp | 69 +++++--
   sandbox/mirror/boost/mirror/detail/template_name.hpp | 33 ++-
   sandbox/mirror/boost/mirror/meta_classes/boost_tuple.hpp | 4
   sandbox/mirror/boost/mirror/meta_namespace.hpp | 57 +++++-
   sandbox/mirror/boost/mirror/meta_types/_free_fn.hpp | 18 +
   sandbox/mirror/doc/html/about.html | 2
   sandbox/mirror/doc/html/boost/mirror/meta_class.html | 13
   sandbox/mirror/doc/html/boost/mirror/meta_namespace.html | 43 ++--
   sandbox/mirror/doc/html/boost/mirror/meta_type.html | 47 +++--
   sandbox/mirror/doc/html/doc_HTML.manifest | 1
   sandbox/mirror/doc/html/index.html | 9
   sandbox/mirror/doc/html/libraries.html | 6
   sandbox/mirror/doc/html/mirror.html | 6
   sandbox/mirror/doc/src/mirror.xml | 4
   sandbox/mirror/libs/mirror/doc/reference/meta_namespace.xml | 23 +
   sandbox/mirror/libs/mirror/doc/reference/meta_type.xml | 27 ++-
   sandbox/mirror/libs/mirror/example/registering/namespaces.cpp | 8
   sandbox/mirror/libs/mirror/example/registering/types.cpp | 2
   sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp | 1
   25 files changed, 597 insertions(+), 304 deletions(-)

Modified: sandbox/mirror/boost/char_type_switch/string.hpp
==============================================================================
--- sandbox/mirror/boost/char_type_switch/string.hpp (original)
+++ sandbox/mirror/boost/char_type_switch/string.hpp 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -53,6 +53,9 @@
 # define BOOST_CTS_STRINGIZE(TO_TEXT) BOOST_PP_STRINGIZE(TO_TEXT)
 #endif // NOT BOOST_CTS_USE_WIDE_CHARS
 
+// define char traits
+typedef ::std::char_traits<bchar> bchar_traits;
+
 // define macro expanding into a compile time const length
 // of the given string literal
 #define BOOST_CTS_LIT_LENGTH(STR) ((sizeof(STR)/sizeof(::boost::bchar))-1)

Modified: sandbox/mirror/boost/mirror/detail/argument_type_list.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/argument_type_list.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/argument_type_list.hpp 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -52,30 +52,41 @@
                 typedef mpl::identity<T> type;
         };
 
- template <class FullOrBase>
+ template <class FullOrBase, typename CharT>
         class append_arg_typename
         {
+ private:
+ typedef type_name_decorator_literals<CharT> lits;
         public:
                 template <typename T>
                 inline void operator()(::boost::mpl::identity<T>)
                 {
- static cts::bstring comma(BOOST_CTS_LIT(", "));
- list.append(BOOST_MIRRORED_TYPE(T)::get_name(FullOrBase()));
+ static ::std::basic_string<CharT> comma(lits::get(lits::comma()));
+ list.append(BOOST_MIRRORED_TYPE(T)::get_name(
+ FullOrBase(),
+ ::std::char_traits<CharT>()
+ ));
                         list.append(comma);
                 }
 
- inline append_arg_typename(cts::bstring& _list)
+ inline append_arg_typename(::std::basic_string<CharT>& _list)
                 : list(_list)
                 { }
         private:
- cts::bstring& list;
+ ::std::basic_string<CharT>& list;
         };
 
- template <typename ArgTypeList, class FullOrBase, class Size>
+ template <
+ typename ArgTypeList,
+ class FullOrBase,
+ typename CharT,
+ class Size
+ >
         static void do_append_args(
                 ArgTypeList*,
- cts::bstring& str,
+ ::std::basic_string<CharT>& str,
                 FullOrBase full_or_base,
+ ::std::char_traits<CharT> _cht,
                 Size
         )
         {
@@ -93,28 +104,33 @@
                 // call the functor
                 ::boost::mpl::for_each<
                         args_wo_last
- >(append_arg_typename<FullOrBase>(str));
+ >(append_arg_typename<FullOrBase, CharT>(str));
                 //
                 // append the last argument
                 typedef typename mpl::back<ArgTypeList>::type last_arg_type;
- str.append(BOOST_MIRRORED_TYPE(last_arg_type)::get_name(full_or_base));
+ str.append(BOOST_MIRRORED_TYPE(last_arg_type)::get_name(
+ full_or_base,
+ _cht
+ ));
         }
 
         // overload for empty argument list
- template <typename ArgTypeList, class FullOrBase>
+ template <typename ArgTypeList, class FullOrBase, typename CharT>
         inline static void do_append_args(
                 ArgTypeList*,
- cts::bstring& str,
+ ::std::basic_string<CharT>& str,
                 FullOrBase,
+ ::std::char_traits<CharT>,
                 mpl::int_<0>
         )
         { }
 protected:
- template <typename ArgTypeList, class FullOrBase>
+ template <typename ArgTypeList, class FullOrBase, typename CharT>
         inline static void append_args(
                 ArgTypeList*,
- cts::bstring& str,
- FullOrBase full_or_base
+ ::std::basic_string<CharT>& str,
+ FullOrBase full_or_base,
+ ::std::char_traits<CharT> cht
         )
         {
                 // remove "null" types from the typelist
@@ -132,6 +148,7 @@
                         atlp,
                         str,
                         full_or_base,
+ cht,
                         size
                 );
         }

Modified: sandbox/mirror/boost/mirror/detail/decorated_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/decorated_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/decorated_type_name.hpp 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -23,16 +23,21 @@
 struct decorated_type_name_base
 {
 public:
- template <bool FullName>
- inline static cts::bstring build_name(
+ template <bool FullName, typename CharT>
+ inline static ::std::basic_string<CharT> build_name(
                 mpl::bool_<FullName> full_or_base,
- cts::bstring& left,
- cts::bstring& right,
- cts::bstring& ex,
- cts::bstring& arg
+ ::std::basic_string<CharT>& left,
+ ::std::basic_string<CharT>& right,
+ ::std::basic_string<CharT>& ex,
+ ::std::basic_string<CharT>& arg
         )
         {
- Decorator D(left, right, ex, arg);
+ typename Decorator::template get<CharT>::type D(
+ left,
+ right,
+ ex,
+ arg
+ );
                 return MetaType::build_name(
                         full_or_base,
                         left,
@@ -49,16 +54,19 @@
 struct decorated_type_name_finisher : public Base
 {
 protected:
- template <bool FullName>
- inline static cts::bstring init_name(
- mpl::bool_<FullName> full_or_base
+ template <bool FullName, typename CharT>
+ inline static ::std::basic_string<CharT> init_name(
+ mpl::bool_<FullName> full_or_base,
+ ::std::char_traits<CharT> _cht
         )
         {
- cts::bstring left;
- cts::bstring right;
- cts::bstring ex;
- cts::bstring arg;
- cts::bstring temp(build_name(full_or_base, left, right, ex, arg));
+ ::std::basic_string<CharT> left;
+ ::std::basic_string<CharT> right;
+ ::std::basic_string<CharT> ex;
+ ::std::basic_string<CharT> arg;
+ ::std::basic_string<CharT> temp(
+ build_name(full_or_base, left, right, ex, arg)
+ );
                 left.append(temp);
                 left.append(right);
                 left.append(ex);
@@ -66,25 +74,37 @@
                 return left;
         }
 public:
- template <bool FullName>
- static const cts::bstring& get_name(mpl::bool_<FullName> full_or_base)
+ template <bool FullName, typename CharT>
+ static const ::std::basic_string<CharT>& get_name(
+ mpl::bool_<FullName> full_or_base,
+ ::std::char_traits<CharT> _cht
+ )
         {
- static cts::bstring s_name(init_name(full_or_base));
+ static ::std::basic_string<CharT> s_name(
+ init_name(full_or_base, _cht)
+ );
                 return s_name;
         }
 
         inline static const cts::bstring& base_name(void)
         {
- return get_name(mpl::false_());
+ return get_name(
+ mpl::false_(),
+ cts::bchar_traits()
+ );
         }
 
         inline static const cts::bstring& full_name(void)
         {
- return get_name(mpl::true_());
+ return get_name(
+ mpl::true_(),
+ cts::bchar_traits()
+ );
         }
 };
 
-/**
+/** This template should be used to decorate typenames
+ * using custom decorators.
  */
 template <class MetaType, class Decorator>
 struct decorated_type_name
@@ -92,116 +112,174 @@
         decorated_type_name_base<MetaType, Decorator>
> { };
 
-// no-op decorator
-template <typename T>
-struct type_name_decorator
+struct type_name_decorator_literal_selectors
 {
- inline type_name_decorator(cts::bstring&, cts::bstring&);
+ struct space { };
+ struct asterisk_post { };
+ struct ampersand_post { };
+ struct const_post { };
+ struct volatile_post { };
+ struct cv_post { };
+ struct lbracket { };
+ struct rbracket { };
+ struct brackets { };
+ struct lpar { };
+ struct rpar { };
+ struct comma { };
+ struct langle { };
+ struct rangle { };
+};
+
+/** Declaration of a helper template that
+ * has functions returning the common decorating
+ * literals.
+ */
+template <typename CharT>
+struct type_name_decorator_literals;
+
+// specialization for chars
+template <>
+struct type_name_decorator_literals<char>
+: type_name_decorator_literal_selectors
+{
+ typedef type_name_decorator_literal_selectors bc;
+ inline static const char* get(bc::space){return " ";}
+ inline static const char* get(bc::asterisk_post){return " *";}
+ inline static const char* get(bc::ampersand_post){return " &";}
+ inline static const char* get(bc::const_post){return " const";}
+ inline static const char* get(bc::volatile_post){return " volatile";}
+ inline static const char* get(bc::cv_post){return " const volatile";}
+ inline static const char* get(bc::lbracket){return "[";}
+ inline static const char* get(bc::rbracket){return "]";}
+ inline static const char* get(bc::brackets){return "[]";}
+ inline static const char* get(bc::lpar){return "(";}
+ inline static const char* get(bc::rpar){return ")";}
+ inline static const char* get(bc::comma){return ", ";}
+ inline static const char* get(bc::langle){return "< ";}
+ inline static const char* get(bc::rangle){return " >";}
+};
+
+// specialization for chars
+template <>
+struct type_name_decorator_literals<wchar_t>
+: type_name_decorator_literal_selectors
+{
+ typedef type_name_decorator_literal_selectors bc;
+ inline static const wchar_t* get(bc::space){return L" ";}
+ inline static const wchar_t* get(bc::asterisk_post){return L" *";}
+ inline static const wchar_t* get(bc::ampersand_post){return L" &";}
+ inline static const wchar_t* get(bc::const_post){return L" const";}
+ inline static const wchar_t* get(bc::volatile_post){return L" volatile";}
+ inline static const wchar_t* get(bc::cv_post){return L" const volatile";}
+ inline static const wchar_t* get(bc::lbracket){return L"[";}
+ inline static const wchar_t* get(bc::rbracket){return L"]";}
+ inline static const wchar_t* get(bc::brackets){return L"[]";}
+ inline static const wchar_t* get(bc::lpar){return L"(";}
+ inline static const wchar_t* get(bc::rpar){return L")";}
+ inline static const wchar_t* get(bc::comma){return L", ";}
+ inline static const wchar_t* get(bc::langle){return L"< ";}
+ inline static const wchar_t* get(bc::rangle){return L" >";}
 };
 
+// no-op decorator
+template <typename T>
+struct type_name_decorator;
+
 /** Base class for decorators that append something to 'right'
- * path of the type name
+ * part of the type name
  */
-struct type_name_right_postfix_decorator
-{
- inline type_name_right_postfix_decorator(
- cts::bstring& _r,
- const cts::bchar* _pfx
- ) : right(_r), postfix(_pfx) { }
+template <typename CharT, class Selector>
+struct type_name_right_postfix_decorator_impl
+ : type_name_decorator_literals<CharT>
+{
+ inline type_name_right_postfix_decorator_impl(
+ ::std::basic_string<CharT>&,
+ ::std::basic_string<CharT>& _right,
+ ::std::basic_string<CharT>&,
+ ::std::basic_string<CharT>&
+ ) : right(_right) { }
 
- inline ~type_name_right_postfix_decorator(void)
+ inline ~type_name_right_postfix_decorator_impl(void)
         {
- right.append(cts::bstring(postfix));
+ right.append(
+ ::std::basic_string<CharT>(
+ type_name_decorator_literals<CharT>::get(Selector())
+ )
+ );
         }
- cts::bstring& right;
- const cts::bchar* postfix;
+ ::std::basic_string<CharT>& right;
 };
 
-// pointer decorator
-template <typename T>
-struct type_name_decorator<T*>
-: type_name_right_postfix_decorator
+template <class Selector>
+struct type_name_right_postfix_decorator
 {
- inline type_name_decorator(
- cts::bstring&,
- cts::bstring& _right,
- cts::bstring&,
- cts::bstring&
- ) : type_name_right_postfix_decorator(_right, BOOST_CTS_LIT(" *"))
- { }
+ template <typename CharT>
+ struct get
+ {
+ typedef type_name_right_postfix_decorator_impl<
+ CharT,
+ Selector
+ > type;
+ };
 };
 
 
+// pointer decorator
+template <typename T>
+struct type_name_decorator<T*>
+: type_name_right_postfix_decorator<
+ type_name_decorator_literal_selectors::asterisk_post
+> { };
+
 // reference decorator
 template <typename T>
 struct type_name_decorator<T&>
-: type_name_right_postfix_decorator
-{
- inline type_name_decorator(
- cts::bstring&,
- cts::bstring& _right,
- cts::bstring&,
- cts::bstring&
- ) : type_name_right_postfix_decorator(_right, BOOST_CTS_LIT(" &"))
- { }
-};
+: type_name_right_postfix_decorator<
+ type_name_decorator_literal_selectors::ampersand_post
+> { };
 
 // const type decorator
 template <typename T>
 struct type_name_decorator<const T>
-: type_name_right_postfix_decorator
-{
- inline type_name_decorator(
- cts::bstring&,
- cts::bstring& _right,
- cts::bstring&,
- cts::bstring&
- ): type_name_right_postfix_decorator(_right, BOOST_CTS_LIT(" const"))
- { }
-};
+: type_name_right_postfix_decorator<
+ type_name_decorator_literal_selectors::const_post
+> { };
 
 // volatile type decorator
 template <typename T>
 struct type_name_decorator<volatile T>
-: type_name_right_postfix_decorator
-{
- inline type_name_decorator(
- cts::bstring&,
- cts::bstring& _right,
- cts::bstring&,
- cts::bstring&
- ) : type_name_right_postfix_decorator(_right, BOOST_CTS_LIT(" volatile"))
- { }
-};
+: type_name_right_postfix_decorator<
+ type_name_decorator_literal_selectors::volatile_post
+> { };
 
 // const volatile type decorator
 template <typename T>
 struct type_name_decorator<const volatile T>
-: type_name_right_postfix_decorator
-{
- inline type_name_decorator(
- cts::bstring&,
- cts::bstring& _r,
- cts::bstring&,
- cts::bstring&
- ) : type_name_right_postfix_decorator(_r, BOOST_CTS_LIT(" const volatile"))
- { }
-};
+: type_name_right_postfix_decorator<
+ type_name_decorator_literal_selectors::cv_post
+> { };
 
 // array decorator
 template <typename T>
 struct type_name_decorator< T[] >
 {
- inline type_name_decorator(
- cts::bstring&,
- cts::bstring&,
- cts::bstring& _ex,
- cts::bstring&
- )
+ template <typename CharT>
+ struct get : type_name_decorator_literals<CharT>
         {
- if(_ex.empty()) _ex.append(BOOST_CTS_LIT(" "));
- _ex.append(BOOST_CTS_LIT("[]"));
- }
+ typedef type_name_decorator_literals<CharT> bc;
+ inline get(
+ ::std::basic_string<CharT>&,
+ ::std::basic_string<CharT>&,
+ ::std::basic_string<CharT>& _ex,
+ ::std::basic_string<CharT>&
+ )
+ {
+ if(_ex.empty()) _ex.append(bc::get(bc::space()));
+ _ex.append(bc::get(bc::brackets()));
+ }
+
+ typedef get<CharT> type;
+ };
 };
 
 
@@ -209,37 +287,46 @@
 template <typename T, size_t Size>
 struct type_name_decorator< T[ Size ] >
 {
-private:
- inline static cts::bstring init_postfix(void)
- {
- typedef typename detail::static_int_to_str<Size>
- size_string;
- // init with '['
- cts::bstring res(BOOST_CTS_LIT("["));
- //
- // setup a buffer for the number
- const size_t max_size = size_string::length::value+1;
- cts::bchar buffer[max_size];
- // put it into the buffer
- size_string::convert(buffer, max_size);
- // append the buffer
- res.append(cts::bstring(buffer));
- // append ']'
- res.append(cts::bstring(BOOST_CTS_LIT("]")));
- return res;
- }
-public:
- inline type_name_decorator(
- cts::bstring&,
- cts::bstring&,
- cts::bstring& _ex,
- cts::bstring&
- )
+ template <typename CharT>
+ struct get : type_name_decorator_literals<CharT>
         {
- static cts::bstring s_postfix(init_postfix());
- if(_ex.empty()) _ex.append(BOOST_CTS_LIT(" "));
- _ex.append(s_postfix);
- }
+ private:
+ typedef type_name_decorator_literals<CharT> bc;
+
+ inline static ::std::basic_string<CharT> init_postfix(void)
+ {
+ typedef typename detail::static_int_to_str<CharT, Size>
+ size_string;
+ // init with '['
+ ::std::basic_string<CharT> res(bc::get(bc::lbracket()));
+ //
+ // setup a buffer for the number
+ const size_t max_size = size_string::length::value+1;
+ CharT buffer[max_size];
+ // put it into the buffer
+ size_string::convert(buffer, max_size);
+ // append the buffer
+ res.append(::std::basic_string<CharT>(buffer));
+ // append ']'
+ res.append(::std::basic_string<CharT>(bc::get(bc::rbracket())));
+ return res;
+ }
+ public:
+ inline get(
+ ::std::basic_string<CharT>&,
+ ::std::basic_string<CharT>&,
+ ::std::basic_string<CharT>& _ex,
+ ::std::basic_string<CharT>&
+ )
+ {
+ static ::std::basic_string<CharT> s_postfix(init_postfix());
+ if(_ex.empty())
+ _ex.append(::std::basic_string<CharT>(bc::get(bc::space())));
+ _ex.append(s_postfix);
+ }
+
+ typedef get<CharT> type;
+ };
 };
 
 

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-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -23,9 +23,6 @@
 #include <boost/mirror/common_defs.hpp>
 #include <boost/mirror/meta_data_fwd.hpp>
 
-// char-type related
-#include <boost/char_type_switch/string.hpp>
-
 namespace boost {
 namespace mirror {
 
@@ -44,65 +41,96 @@
                 // don't prepend '::' to types on global scope
                 template <typename Type>
                 inline static void append_separator(
- cts::bstring& _str,
+ ::std::basic_string<char>& _str,
                         mpl::identity<meta_namespace<namespace_::_> >,
                         mpl::identity<detail::registered_type_info<Type> >
                 )
                 { }
+ // don't prepend '::' to types on global scope
+ template <typename Type>
+ inline static void append_separator(
+ ::std::basic_string<wchar_t>& _str,
+ mpl::identity<meta_namespace<namespace_::_> >,
+ mpl::identity<detail::registered_type_info<Type> >
+ )
+ { }
+
+ // append separator to anything else
+ template <typename AnyScope, class AnyMO>
+ inline static void append_separator(
+ ::std::string& _str,
+ mpl::identity<AnyScope>,
+ mpl::identity<AnyMO>
+ )
+ {
+ static const ::std::string separator("::");
+ _str.append(separator);
+ }
 
                 // append separator to anything else
                 template <typename AnyScope, class AnyMO>
                 inline static void append_separator(
- cts::bstring& _str,
+ ::std::wstring& _str,
                         mpl::identity<AnyScope>,
                         mpl::identity<AnyMO>
                 )
                 {
- static const cts::bstring separator(BOOST_CTS_LIT("::"));
+ static const ::std::wstring separator(L"::");
                         _str.append(separator);
                 }
 
 
- // initializes the full names
- inline static cts::bstring init_name(mpl::true_ _full)
+ // initializes the full names
+ template <typename CharT>
+ inline static ::std::basic_string<CharT> init_name(
+ mpl::true_ _full,
+ ::std::char_traits<CharT> _cht
+ )
                 {
- cts::bstring res(Scope::get_name(_full));
+ ::std::basic_string<CharT> res(Scope::get_name(_full, _cht));
                         append_separator(
                                 res,
                                 mpl::identity<Scope>(),
                                 mpl::identity<BaseMetaObject>()
                         );
- res.append(BaseMetaObject::get_name(mpl::false_()));
+ res.append(BaseMetaObject::get_name(mpl::false_(), _cht));
                         return res;
                 }
 
                 // initializes the base names
- inline static const cts::bstring& init_name(mpl::false_ _base)
+ template <typename CharT>
+ inline static const ::std::basic_string<CharT>& init_name(
+ mpl::false_ _base,
+ ::std::char_traits<CharT> _cht
+ )
                 {
- return BaseMetaObject::get_name(_base);
+ return BaseMetaObject::get_name(_base, _cht);
                 }
         public:
                 // base of full name getter
- template <bool FullName>
- inline static const cts::bstring& build_name(
+ template <bool FullName, typename CharT>
+ inline static const ::std::basic_string<CharT>& build_name(
                         mpl::bool_<FullName> full_or_base,
- cts::bstring& left,
- cts::bstring& right,
- cts::bstring& ex,
- cts::bstring& arg
+ ::std::basic_string<CharT>& left,
+ ::std::basic_string<CharT>& right,
+ ::std::basic_string<CharT>& ex,
+ ::std::basic_string<CharT>& arg
                 )
                 {
- return get_name(full_or_base);
+ return get_name(full_or_base, ::std::char_traits<CharT>());
                 }
 
 
                 // base of full name getter
- template <bool FullName>
- inline static const cts::bstring& get_name(
- mpl::bool_<FullName> full_or_base
+ template <bool FullName, typename CharT>
+ inline static const ::std::basic_string<CharT>& get_name(
+ mpl::bool_<FullName> full_or_base,
+ ::std::char_traits<CharT> _cht
                 )
                 {
- static cts::bstring s_name(init_name(full_or_base));
+ static ::std::basic_string<CharT> s_name(
+ init_name(full_or_base, _cht)
+ );
                         return s_name;
                 }
         };

Modified: sandbox/mirror/boost/mirror/detail/function_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/function_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/function_type_name.hpp 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -35,33 +35,35 @@
 struct function_type_name_base : argument_type_list_builder
 {
 public:
- template <bool FullName>
- inline static cts::bstring build_name(
+ template <bool FullName, typename CharT>
+ inline static ::std::basic_string<CharT> build_name(
                 mpl::bool_<FullName> full_or_base,
- cts::bstring& left,
- cts::bstring& right,
- cts::bstring& ex,
- cts::bstring& arg
+ ::std::basic_string<CharT>& left,
+ ::std::basic_string<CharT>& right,
+ ::std::basic_string<CharT>& ex,
+ ::std::basic_string<CharT>& arg
         )
         {
- static cts::bstring space(BOOST_CTS_LIT(" "));
- static cts::bstring l_par(BOOST_CTS_LIT("("));
- static cts::bstring r_par(BOOST_CTS_LIT(")"));
+ typedef type_name_decorator_literals<CharT> lits;
+ static ::std::basic_string<CharT> space(lits::get(lits::space()));
+ static ::std::basic_string<CharT> l_par(lits::get(lits::lpar()));
+ static ::std::basic_string<CharT> r_par(lits::get(lits::rpar()));
         //
                 // the return value type
                 typedef BOOST_MIRRORED_TYPE(RetValType) meta_RV;
                 //
- cts::bstring rv_left;
- cts::bstring rv_right;
- cts::bstring rv_ex;
- cts::bstring rv_arg;
- cts::bstring rv_t(meta_RV::build_name(
+ ::std::basic_string<CharT> rv_left;
+ ::std::basic_string<CharT> rv_right;
+ ::std::basic_string<CharT> rv_ex;
+ ::std::basic_string<CharT> rv_arg;
+ ::std::basic_string<CharT> rv_t(meta_RV::build_name(
                         full_or_base,
                         rv_left,
                         rv_right,
                         rv_ex,
                         rv_arg
                 ));
+ ::std::char_traits<CharT> cht;
                 //
                 // return value
                 left.append(rv_left);
@@ -72,16 +74,22 @@
                 left.append(space);
                 left.append(l_par);
                 // the calling convention
- left.append(CallingConvention::name());
+ left.append(CallingConvention::name(cht));
                 arg.append(r_par);
                 //
                 // argument list
                 arg.append(l_par);
- append_args(((ArgTypeList*)0), arg, full_or_base);
+ append_args(
+ ((ArgTypeList*)0),
+ arg,
+ full_or_base,
+ cht
+ );
                 arg.append(r_par);
                 // the rest of the ret val type
                 arg.append(rv_arg);
- return cts::bstring();
+ // return an empty string
+ return ::std::basic_string<CharT>();
         }
 };
 

Modified: sandbox/mirror/boost/mirror/detail/meta_type_registering.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/meta_type_registering.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/meta_type_registering.hpp 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -35,12 +35,18 @@
 
         inline static const cts::bstring& base_name(void)
         {
- return base_class::get_name(mpl::false_());
+ return base_class::get_name(
+ mpl::false_(),
+ cts::bchar_traits()
+ );
         }
 
         inline static const cts::bstring& full_name(void)
         {
- return base_class::get_name(mpl::true_());
+ return base_class::get_name(
+ mpl::true_(),
+ cts::bchar_traits()
+ );
         }
 
         typedef detail::registered_type_info<Type> base_info;
@@ -49,9 +55,20 @@
 };
 
 #define BOOST_MIRROR_REG_TYPE_DECLARE_BASE_NAME(TYPE_NAME_STRING) \
- static const cts::bstring& get_name(mpl::false_) \
+ static const ::std::string& get_name( \
+ mpl::false_, \
+ ::std::char_traits<char> \
+ )\
         { \
- static cts::bstring s_name(BOOST_CTS_LIT(TYPE_NAME_STRING)); \
+ static ::std::string s_name(TYPE_NAME_STRING); \
+ return s_name; \
+ } \
+ static const ::std::wstring& get_name( \
+ mpl::false_, \
+ ::std::char_traits<wchar_t> \
+ )\
+ { \
+ static ::std::wstring s_name(L ## TYPE_NAME_STRING); \
                 return s_name; \
         }
 

Modified: sandbox/mirror/boost/mirror/detail/static_int_to_str.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/static_int_to_str.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/static_int_to_str.hpp 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -16,7 +16,6 @@
 #include <assert.h>
 #include <boost/mirror/detail/static_log10.hpp>
 #include <boost/mirror/detail/static_pow10.hpp>
-#include <boost/char_type_switch/string.hpp>
 
 #include <boost/mpl/vector_c.hpp>
 #include <boost/mpl/size.hpp>
@@ -27,9 +26,28 @@
 namespace mirror {
 namespace detail {
 
-template <int I>
+template <typename CharT>
+struct static_int_to_str_constants;
+
+template <>
+struct static_int_to_str_constants<char>
+{
+ static inline char null(void){return '\0';}
+ static inline char zero(void){return '0';}
+};
+
+template <>
+struct static_int_to_str_constants<wchar_t>
+{
+ static inline wchar_t null(void){return L'\0';}
+ static inline wchar_t zero(void){return L'0';}
+};
+
+template <typename CharT, int I>
 struct static_int_to_str
+: static_int_to_str_constants<CharT>
 {
+ typedef static_int_to_str_constants<CharT> base_class;
         // the length of the string needed to hold the given integer
         typedef typename mpl::int_<
                 static_log10<I>::type::value + 1
@@ -37,62 +55,67 @@
         //
         //
         template <int J>
- static inline cts::bchar get_digit(mpl::int_<J> pos)
+ static inline CharT get_digit(mpl::int_<J> pos)
         {
- static const cts::bchar zero = BOOST_CTS_LIT('0');
                 typedef typename static_pow10<
                         length::value - mpl::int_<J>::value
>::type K;
- return zero + (I / K::value) % 10;
+ return base_class::zero() + (I / K::value) % 10;
         }
         //
- static inline void do_copy_to(cts::bchar* _str, mpl::int_<0>){ }
+ static inline void do_copy_to(CharT* _str, mpl::int_<0>){ }
         //
         template <int J>
- static inline void do_copy_to(cts::bchar* _str, mpl::int_<J> pos)
+ static inline void do_copy_to(CharT* _str, mpl::int_<J> pos)
         {
                 _str[J-1] = get_digit(pos);
                 do_copy_to(_str, mpl::int_<J - 1>());
         }
         //
- static cts::bchar* convert(cts::bchar* _str, size_t _max_len)
+ static CharT* convert(CharT* _str, size_t _max_len)
         {
                 assert(_max_len > size_t(length::value));
                 do_copy_to(_str, length());
- _str[length::value] = BOOST_CTS_LIT('\0');
+ _str[length::value] = base_class::null();
                 return _str;
         }
 };
 
-template <>
-struct static_int_to_str<0>
+template <typename CharT>
+struct static_int_to_str<CharT, 0>
+: static_int_to_str_constants<CharT>
 {
+ typedef static_int_to_str_constants<CharT> base_class;
+
         typedef mpl::int_<1>::type length;
- static cts::bchar* convert(cts::bchar* _str, size_t _max_len)
+ static CharT* convert(CharT* _str, size_t _max_len)
         {
                 assert(_max_len > 1);
- _str[0] = BOOST_CTS_LIT('0');
- _str[1] = BOOST_CTS_LIT('\0');
+ _str[0] = base_class::zero();
+ _str[1] = base_class::null();
                 return _str;
         }
 };
 
-template <class Vector, int I>
+template <class Vector, typename CharT, int I>
 struct static_int_to_str_w_prefix
+: static_int_to_str_constants<CharT>
 {
+ typedef static_int_to_str_constants<CharT> base_class;
+ //
         typedef Vector prefix;
         typedef mpl::int_<mpl::size<prefix>::value> prefix_length;
- typedef typename static_int_to_str<I>::length number_length;
+ typedef typename static_int_to_str<CharT, I>::length number_length;
         // the length of the string needed to hold the given integer with the prefix
         typedef typename mpl::int_<
                 prefix_length::value +
                 number_length::value
> length;
         //
- static inline void do_apply_prefix_to(cts::bchar* _str, mpl::int_<0>){ }
+ static inline void do_apply_prefix_to(CharT* _str, mpl::int_<0>){ }
         //
         template <int J>
- static inline void do_apply_prefix_to(cts::bchar* _str, mpl::int_<J> pos)
+ static inline void do_apply_prefix_to(CharT* _str, mpl::int_<J> pos)
         {
                 _str[J-1] = mpl::at<
                         prefix,
@@ -101,7 +124,7 @@
                 do_apply_prefix_to(_str, mpl::int_<J - 1>());
         }
         //
- static cts::bchar* convert(cts::bchar* _str, size_t _max_len)
+ static CharT* convert(CharT* _str, size_t _max_len)
         {
                 // check the length
                 assert(_max_len > size_t(length::value));
@@ -110,17 +133,17 @@
                 // calculate offset
                 const int offs = mpl::size<prefix>::type::value;
                 // append given int as string
- static_int_to_str<I>::convert(_str + offs, _max_len - offs);
+ static_int_to_str<CharT, I>::convert(_str + offs, _max_len - offs);
                 // finalize the string
- _str[length::value] = BOOST_CTS_LIT('\0');
+ _str[length::value] = base_class::null();
                 return _str;
         }
         //
         struct holder
         {
- static const cts::bchar* get(void)
+ static const CharT* get(void)
                 {
- static cts::bchar str[length::value+1] = {0};
+ static CharT str[length::value+1] = {0};
                         if(!str[0]) convert(str, length::value+1);
                         return str;
                 }

Modified: sandbox/mirror/boost/mirror/detail/template_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/template_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/template_name.hpp 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -36,24 +36,35 @@
 
 
 public:
- template <bool FullName>
- inline static cts::bstring build_name(
+ template <bool FullName, typename CharT>
+ inline static ::std::basic_string<CharT> build_name(
                 mpl::bool_<FullName> full_or_base,
- cts::bstring& left,
- cts::bstring& right,
- cts::bstring& ex,
- cts::bstring& arg
+ ::std::basic_string<CharT>& left,
+ ::std::basic_string<CharT>& right,
+ ::std::basic_string<CharT>& ex,
+ ::std::basic_string<CharT>& arg
         )
         {
- static cts::bstring comma(BOOST_CTS_LIT(", "));
- static cts::bstring l_angle(BOOST_CTS_LIT("< "));
- static cts::bstring r_angle(BOOST_CTS_LIT(" >"));
+ typedef type_name_decorator_literals<CharT> lits;
+ static ::std::basic_string<CharT> comma(lits::get(lits::comma()));
+ static ::std::basic_string<CharT> l_angle(lits::get(lits::langle()));
+ static ::std::basic_string<CharT> r_angle(lits::get(lits::rangle()));
+ //
+ ::std::char_traits<CharT> cht;
                 //
                 // get the template name
- cts::bstring res(base_meta_template::get_name(full_or_base));
+ ::std::basic_string<CharT> res(base_meta_template::get_name(
+ full_or_base,
+ cht
+ ));
                 // argument list
                 res.append(l_angle);
- append_args(((TplArgTypeList*)0), res, full_or_base);
+ append_args(
+ ((TplArgTypeList*)0),
+ res,
+ full_or_base,
+ cht
+ );
                 res.append(r_angle);
                 //
                 return res;

Modified: sandbox/mirror/boost/mirror/meta_classes/boost_tuple.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_classes/boost_tuple.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_classes/boost_tuple.hpp 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -35,7 +35,9 @@
         static const cts::bchar* base_name(mpl::int_<I>)
         {
                 typedef typename boost::mirror::detail::static_int_to_str_w_prefix<
- mpl::vector_c<cts::bchar, BOOST_CTS_LIT('_') >, I
+ mpl::vector_c<cts::bchar, BOOST_CTS_LIT('_') >,
+ cts::bchar,
+ I
>::holder name;
                 //
                 return name::get();

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-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -51,12 +51,18 @@
 
         inline static const cts::bstring& base_name(void)
         {
- return base_class::get_name(mpl::false_());
+ return base_class::get_name(
+ mpl::false_(),
+ cts::bchar_traits()
+ );
         }
 
         inline static const cts::bstring& full_name(void)
         {
- return base_class::get_name(mpl::true_());
+ return base_class::get_name(
+ mpl::true_(),
+ cts::bchar_traits()
+ );
         }
 
 
@@ -79,26 +85,42 @@
         struct _
         {
                 // the base name of the namespace
- inline static const cts::bstring& get_name(mpl::false_)
+ template <typename CharT>
+ inline static const ::std::basic_string<CharT>& get_name(
+ mpl::false_,
+ ::std::char_traits<CharT>
+ )
                 {
- static cts::bstring s_name;
+ // the base name of the global scope is an empty string
+ static ::std::basic_string<CharT> s_name;
                         return s_name;
                 }
 
                 // the full name of the namespace
- inline static const cts::bstring& get_name(mpl::true_)
+ template <typename CharT>
+ inline static const ::std::basic_string<CharT>& get_name(
+ mpl::true_,
+ ::std::char_traits<CharT> _cht
+ )
                 {
- return get_name(mpl::false_());
+ // the same as the base name
+ return get_name(mpl::false_(), _cht);
                 }
 
                 inline static const cts::bstring& base_name(void)
                 {
- return get_name(mpl::false_());
+ return get_name(
+ mpl::false_(),
+ cts::bchar_traits()
+ );
                 }
         
                 inline static const cts::bstring& full_name(void)
                 {
- return get_name(mpl::true_());
+ return get_name(
+ mpl::true_(),
+ cts::bchar_traits()
+ );
                 }
 
         };
@@ -167,9 +189,24 @@
                                 _, \
                                 BOOST_PP_SEQ_POP_BACK(NAME_SEQUENCE) \
                         ) :: _ parent_placeholder; /* -4- */ \
- static const ::boost::cts::bstring& get_name(mpl::false_) \
+ static const ::std::string& get_name( \
+ mpl::false_, \
+ ::std::char_traits<char> \
+ ) \
                         { \
- static ::boost::cts::bstring s_name(BOOST_CTS_STRINGIZE( \
+ static ::std::string s_name(BOOST_PP_STRINGIZE( \
+ BOOST_PP_SEQ_HEAD( \
+ BOOST_PP_SEQ_REVERSE(NAME_SEQUENCE) \
+ ) \
+ )); \
+ return s_name; \
+ } \
+ static const ::std::wstring& get_name( \
+ mpl::false_, \
+ ::std::char_traits<wchar_t> \
+ ) \
+ { \
+ static ::std::wstring s_name(BOOST_PP_WSTRINGIZE( \
                                         BOOST_PP_SEQ_HEAD( \
                                                 BOOST_PP_SEQ_REVERSE(NAME_SEQUENCE) \
                                         ) \

Modified: sandbox/mirror/boost/mirror/meta_types/_free_fn.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_types/_free_fn.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_types/_free_fn.hpp 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -28,9 +28,14 @@
 #define BOOST_MIRROR_DECLARE_CALLING_CONVENTION_HELPER(CC) \
         struct __##CC##_ \
         { \
- inline static const ::boost::cts::bstring& name(void) \
+ inline static const ::std::string& name(::std::char_traits<char>) \
                 { \
- static ::boost::cts::bstring cc_name(BOOST_CTS_STRINGIZE(__##CC));\
+ static ::std::string cc_name(BOOST_PP_STRINGIZE(__##CC));\
+ return cc_name; \
+ } \
+ inline static const ::std::wstring& name(::std::char_traits<wchar_t>) \
+ { \
+ static ::std::wstring cc_name(BOOST_PP_WSTRINGIZE(__##CC));\
                         return cc_name; \
                 } \
         };
@@ -41,7 +46,14 @@
 
         struct __default_
         {
- inline static cts::bstring name(void){return cts::bstring();}
+ inline static ::std::string name(::std::char_traits<char>)
+ {
+ return ::std::string();
+ }
+ inline static ::std::wstring name(::std::char_traits<wchar_t>)
+ {
+ return ::std::wstring();
+ }
         };
 
 // undefine the helper macros

Modified: sandbox/mirror/doc/html/about.html
==============================================================================
--- sandbox/mirror/doc/html/about.html (original)
+++ sandbox/mirror/doc/html/about.html 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -7,7 +7,7 @@
 <link rel="start" href="index.html" title="The Mirror library documentation">
 <link rel="up" href="index.html" title="The Mirror library documentation">
 <link rel="prev" href="index.html" title="The Mirror library documentation">
-<link rel="next" href="libraries.html" title="Part I. The Mirror library">
+<link rel="next" href="libraries.html" title="Part I. Libraries">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%"><tr>

Modified: sandbox/mirror/doc/html/boost/mirror/meta_class.html
==============================================================================
--- sandbox/mirror/doc/html/boost/mirror/meta_class.html (original)
+++ sandbox/mirror/doc/html/boost/mirror/meta_class.html 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -7,6 +7,7 @@
 <link rel="start" href="../../index.html" title="The Mirror library documentation">
 <link rel="up" href="../../mirror/reference.html#header.boost.mirror.meta_class.hpp" title="Header &lt;boost/mirror/meta_class.hpp&gt;">
 <link rel="prev" href="meta_type.html" title="Class template meta_type">
+<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>
@@ -19,7 +20,7 @@
 </tr></table>
 <hr>
 <div class="spirit-nav">
-<a accesskey="p" href="meta_type.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../mirror/reference.html#header.boost.mirror.meta_class.hpp"><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="p" href="meta_type.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../mirror/reference.html#header.boost.mirror.meta_class.hpp"><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="refentry" lang="en">
 <a name="boost.mirror.meta_class"></a><div class="titlepage"></div>
@@ -43,16 +44,16 @@
                                         </em></span>
 {
 <span class="bold"><strong>public</strong></span>:
- <span class="emphasis"><em>// <a class="link" href="meta_class.html#id459098-bbtypes">types</a></em></span>
+ <span class="emphasis"><em>// <a class="link" href="meta_class.html#id513376-bbtypes">types</a></em></span>
   <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>unspecified</em></span> <a class="link" href="meta_class.html#boost.mirror.meta_class.base_classes">base_classes</a>;
   <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>unspecified</em></span> <a class="link" href="meta_class.html#boost.mirror.meta_class.attributes">attributes</a>;
   <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>unspecified</em></span> <a class="link" href="meta_class.html#boost.mirror.meta_class.all_attributes">all_attributes</a>;
 };</pre></div>
 <div class="refsect1" lang="en">
-<a name="id706902"></a><h2>Description</h2>
+<a name="id699328"></a><h2>Description</h2>
 <div class="refsect2" lang="en">
-<a name="id706906"></a><h3>
-<a name="id459098-bbtypes"></a><code class="computeroutput">meta_class</code> public types</h3>
+<a name="id699332"></a><h3>
+<a name="id513376-bbtypes"></a><code class="computeroutput">meta_class</code> public types</h3>
 <div class="orderedlist"><ol type="1">
 <li>
 <p>
@@ -86,7 +87,7 @@
 </tr></table>
 <hr>
 <div class="spirit-nav">
-<a accesskey="p" href="meta_type.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../mirror/reference.html#header.boost.mirror.meta_class.hpp"><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="p" href="meta_type.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../mirror/reference.html#header.boost.mirror.meta_class.hpp"><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/doc/html/boost/mirror/meta_namespace.html
==============================================================================
--- sandbox/mirror/doc/html/boost/mirror/meta_namespace.html (original)
+++ sandbox/mirror/doc/html/boost/mirror/meta_namespace.html 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -45,16 +45,17 @@
 <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> NamespacePlaceholder&gt;
 <span class="bold"><strong>class</strong></span> <a class="link" href="meta_namespace.html" title="Class template meta_namespace">meta_namespace</a> {
 <span class="bold"><strong>public</strong></span>:
- <span class="emphasis"><em>// <a class="link" href="meta_namespace.html#id459983-bbtypes">types</a></em></span>
+ <span class="emphasis"><em>// <a class="link" href="meta_namespace.html#id461075-bbtypes">types</a></em></span>
   <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>unspecified</em></span> <a class="link" href="meta_namespace.html#boost.mirror.meta_namespace.scope">scope</a>;
   <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>unspecified</em></span> <a class="link" href="meta_namespace.html#boost.mirror.meta_namespace.ancestors">ancestors</a>;
- <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a class="link" href="meta_namespace.html#id459860-bb">base_name</a>();
- <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a class="link" href="meta_namespace.html#id459818-bb">full_name</a>();
- <span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>bool</strong></span> FullName&gt;
- <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a class="link" href="meta_namespace.html#id459764-bb">get_name</a>(::boost::mpl::bool_&lt;FullName&gt;);
+ <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a class="link" href="meta_namespace.html#id460952-bb">base_name</a>();
+ <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a class="link" href="meta_namespace.html#id460910-bb">full_name</a>();
+ <span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>bool</strong></span> FullName, <span class="bold"><strong>typename</strong></span> CharT&gt;
+ <span class="type"><span class="bold"><strong>const</strong></span> ::std::basic_string&lt;CharT&gt;&amp;</span>
+ <a class="link" href="meta_namespace.html#id460856-bb">get_name</a>(::boost::mpl::bool_&lt;FullName&gt;, ::std::char_traits&lt;CharT&gt;);
 };</pre></div>
 <div class="refsect1" lang="en">
-<a name="id705703"></a><h2>Description</h2>
+<a name="id698062"></a><h2>Description</h2>
 <p>The specializations of <code class="computeroutput">meta_type</code> can
                                 be used to get meta-information about the reflected types, some at compile-time and some at run-time.
                                 The following examples show type reflection and basic
@@ -167,8 +168,8 @@
 </div>
 </div>
 <div class="refsect2" lang="en">
-<a name="id705799"></a><h3>
-<a name="id459983-bbtypes"></a><code class="computeroutput">meta_namespace</code> public types</h3>
+<a name="id698158"></a><h3>
+<a name="id461075-bbtypes"></a><code class="computeroutput">meta_namespace</code> public types</h3>
 <div class="orderedlist"><ol type="1">
 <li>
 <p>
@@ -241,7 +242,7 @@
 </li>
 </ol></div>
 </div>
-<pre class="literallayout"><span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a name="id459860-bb"></a>base_name();</pre>
+<pre class="literallayout"><span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a name="id460952-bb"></a>base_name();</pre>
 <p>This static member function returns the base name of the
                                         namespace reflected by a <code class="computeroutput">meta_namespace</code>.
                                         For example the base namespace name "returned" by the invocation of
@@ -253,7 +254,7 @@
                                         <span class="bold"><strong>with</strong></span> the nested name specifier
                                         is needed use the <code class="computeroutput">full_name</code> member function
                                                instead.</p>
-<pre class="literallayout"><span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a name="id459818-bb"></a>full_name();</pre>
+<pre class="literallayout"><span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a name="id460910-bb"></a>full_name();</pre>
 <p>This static member function returns the full name of the
                                         namespace reflected by a <code class="computeroutput">meta_namespace</code>
                                         with the nested name specifier. For example:
@@ -278,27 +279,33 @@
                                         </p></td>
 </tr></tbody>
 </table></div>
-<pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>bool</strong></span> FullName&gt;
- <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a name="id459764-bb"></a>get_name(::boost::mpl::bool_&lt;FullName&gt; full);</pre>
+<pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>bool</strong></span> FullName, <span class="bold"><strong>typename</strong></span> CharT&gt;
+ <span class="type"><span class="bold"><strong>const</strong></span> ::std::basic_string&lt;CharT&gt;&amp;</span>
+ <a name="id460856-bb"></a>get_name(::boost::mpl::bool_&lt;FullName&gt; full, ::std::char_traits&lt;CharT&gt; cht);</pre>
 <p>This static member template function returns either the base name
                                         <span class="bold"><strong>without</strong></span> the nested name specifier
                                         or the full name <span class="bold"><strong>with</strong></span> the
                                         nested name specifier of the namespace reflected by this
                                         <code class="computeroutput">meta_namespace</code>,
                                         depending on the value of the template argument <code class="computeroutput">FullName</code>.
+ Furthermore it allows to choose whether the return value type is
+ <code class="computeroutput">::std::string</code> or <code class="computeroutput">::std::wstring</code> based
+ on the type of the second argument.
                                         For example:
                                         </p>
-<pre class="programlisting"><code class="computeroutput">BOOST_MIRRORED_NAMESPACE</code>(::boost::mirror) :: get_name(::boost::mpl::false_())
+<pre class="programlisting"><code class="computeroutput">BOOST_MIRRORED_NAMESPACE</code>(::boost::mirror) :: get_name(::boost::mpl::false_(), ::std::char_traits&lt;char&gt;())
                                         </pre>
 <p> is equivalent to calling the
- <code class="computeroutput">base_name</code> member function and
- returns simply <code class="computeroutput">"mirror"</code> and calling
+ <code class="computeroutput">base_name</code> member function with the
+ <code class="computeroutput">BOOST_CTS_USE_WIDE_CHARS</code> symbol undefined,
+ which returns a <code class="computeroutput">::std::string</code> holding the string <code class="computeroutput">"mirror"</code> and calling
                                         </p>
-<pre class="programlisting"><code class="computeroutput">BOOST_MIRRORED_NAMESPACE</code>(::boost::mirror) :: get_name(::boost::mpl::true_())
+<pre class="programlisting"><code class="computeroutput">BOOST_MIRRORED_NAMESPACE</code>(::boost::mirror) :: get_name(::boost::mpl::true_(), ::std::char_traits&lt;wchar_t&gt;())
                                         </pre>
 <p> is equivalent to calling the
- <code class="computeroutput">full_name</code> method which
- returns <code class="computeroutput">"::boost::mirror"</code>.
+ <code class="computeroutput">full_name</code> method with the
+ <code class="computeroutput">BOOST_CTS_USE_WIDE_CHARS</code> symbol defined,
+ which returns a <code class="computeroutput">::std::wstring</code> holding this string <code class="computeroutput">L"::boost::mirror"</code>.
                                         </p>
 </div>
 </div>

Modified: sandbox/mirror/doc/html/boost/mirror/meta_type.html
==============================================================================
--- sandbox/mirror/doc/html/boost/mirror/meta_type.html (original)
+++ sandbox/mirror/doc/html/boost/mirror/meta_type.html 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -44,16 +44,17 @@
 <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> Type&gt;
 <span class="bold"><strong>class</strong></span> <a class="link" href="meta_type.html" title="Class template meta_type">meta_type</a> {
 <span class="bold"><strong>public</strong></span>:
- <span class="emphasis"><em>// <a class="link" href="meta_type.html#id459471-bbtypes">types</a></em></span>
+ <span class="emphasis"><em>// <a class="link" href="meta_type.html#id460529-bbtypes">types</a></em></span>
   <span class="bold"><strong>typedef</strong></span> Type <a class="link" href="meta_type.html#boost.mirror.meta_type.reflected_type">reflected_type</a>;
   <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>unspecified</em></span> <a class="link" href="meta_type.html#boost.mirror.meta_type.scope">scope</a>;
- <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a class="link" href="meta_type.html#id459410-bb">base_name</a>();
- <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a class="link" href="meta_type.html#id459350-bb">full_name</a>();
- <span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>bool</strong></span> FullName&gt;
- <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a class="link" href="meta_type.html#id459290-bb">get_name</a>(::boost::mpl::bool_&lt;FullName&gt;);
+ <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a class="link" href="meta_type.html#id460468-bb">base_name</a>();
+ <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a class="link" href="meta_type.html#id460408-bb">full_name</a>();
+ <span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>bool</strong></span> FullName, <span class="bold"><strong>typename</strong></span> CharT&gt;
+ <span class="type"><span class="bold"><strong>const</strong></span> ::std::basic_string&lt;CharT&gt;&amp;</span>
+ <a class="link" href="meta_type.html#id460348-bb">get_name</a>(::boost::mpl::bool_&lt;FullName&gt;, ::std::char_traits&lt;CharT&gt;);
 };</pre></div>
 <div class="refsect1" lang="en">
-<a name="id706304"></a><h2>Description</h2>
+<a name="id698698"></a><h2>Description</h2>
 <p>The specializations of <code class="computeroutput">meta_type</code> can
                                 be used to get meta-information about the reflected types, some at compile-time and some at run-time.
                                 The following examples show type reflection and basic
@@ -236,8 +237,8 @@
 </div>
 </div>
 <div class="refsect2" lang="en">
-<a name="id706442"></a><h3>
-<a name="id459471-bbtypes"></a><code class="computeroutput">meta_type</code> public types</h3>
+<a name="id698836"></a><h3>
+<a name="id460529-bbtypes"></a><code class="computeroutput">meta_type</code> public types</h3>
 <div class="orderedlist"><ol type="1">
 <li>
 <p>
@@ -256,7 +257,7 @@
 </li>
 </ol></div>
 </div>
-<pre class="literallayout"><span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a name="id459410-bb"></a>base_name();</pre>
+<pre class="literallayout"><span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a name="id460468-bb"></a>base_name();</pre>
 <p>This static member function returns the base name of the
                                         type reflected by <code class="computeroutput">meta_type</code>
                                         without the nested name specifier. For example:
@@ -286,7 +287,7 @@
                                         </p></td>
 </tr></tbody>
 </table></div>
-<pre class="literallayout"><span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a name="id459350-bb"></a>full_name();</pre>
+<pre class="literallayout"><span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a name="id460408-bb"></a>full_name();</pre>
 <p>This static member function returns the full name of the
                                         type reflected by <code class="computeroutput">meta_type</code>
                                         with the nested name specifier. For example:
@@ -316,32 +317,38 @@
                                         </p></td>
 </tr></tbody>
 </table></div>
-<pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>bool</strong></span> FullName&gt;
- <span class="type"><span class="bold"><strong>const</strong></span> cts::bstring&amp;</span> <a name="id459290-bb"></a>get_name(::boost::mpl::bool_&lt;FullName&gt; full);</pre>
+<pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>bool</strong></span> FullName, <span class="bold"><strong>typename</strong></span> CharT&gt;
+ <span class="type"><span class="bold"><strong>const</strong></span> ::std::basic_string&lt;CharT&gt;&amp;</span>
+ <a name="id460348-bb"></a>get_name(::boost::mpl::bool_&lt;FullName&gt; full, ::std::char_traits&lt;CharT&gt; cht);</pre>
 <p>This static member template function returns either the base name
                                         <span class="bold"><strong>without</strong></span> the nested name specifier
                                         or the full name <span class="bold"><strong>with</strong></span> the
                                         nested name specifier of the type reflected by this
                                         <code class="computeroutput">meta_type</code>,
                                         depending on the value of the template argument <code class="computeroutput">FullName</code>.
+ Furthermore it allows to choose whether the return value type is
+ <code class="computeroutput">::std::string</code> or <code class="computeroutput">::std::wstring</code> based
+ on the type of the second argument.
                                         For example:
                                         </p>
-<pre class="programlisting"><code class="computeroutput">BOOST_MIRRORED_TYPE</code>(::std::string) :: get_name(::boost::mpl::false_())</pre>
+<pre class="programlisting"><code class="computeroutput">BOOST_MIRRORED_TYPE</code>(::std::string) :: get_name(::boost::mpl::false_(), ::std::char_traits&lt;char&gt;())</pre>
 <p> or
                                         </p>
-<pre class="programlisting"><code class="computeroutput">meta_type</code> &lt; ::std::string &gt; :: get_name(::boost::mpl::false_())</pre>
+<pre class="programlisting"><code class="computeroutput">meta_type</code> &lt; ::std::string &gt; :: get_name(::boost::mpl::false_(), ::std::char_traits&lt;char&gt;())</pre>
 <p>
                                         is equivalent to calling the
- <code class="computeroutput">base_name</code> member function and
- returns simply <code class="computeroutput">"string"</code> and
+ <code class="computeroutput">base_name</code> member function with the
+ <code class="computeroutput">BOOST_CTS_USE_WIDE_CHARS</code> symbol undefined,
+ which returns a <code class="computeroutput">::std::string</code> containing <code class="computeroutput">"string"</code> and calling
                                         </p>
-<pre class="programlisting"><code class="computeroutput">BOOST_MIRRORED_TYPE</code>(::std::string) :: get_name(::boost::mpl::true_())</pre>
+<pre class="programlisting"><code class="computeroutput">BOOST_MIRRORED_TYPE</code>(::std::string) :: get_name(::boost::mpl::true_(), ::std::char_traits&lt;wchar_t&gt;())</pre>
 <p> or
                                         </p>
-<pre class="programlisting"><code class="computeroutput">meta_type</code> &lt; ::std::string &gt; :: get_name( ::boost::mpl::true_())</pre>
+<pre class="programlisting"><code class="computeroutput">meta_type</code> &lt; ::std::string &gt; :: get_name( ::boost::mpl::true_(), ::std::char_traits&lt;wchar_t&gt;())</pre>
 <p> is equivalent to calling the
- <code class="computeroutput">full_name</code> method which
- returns <code class="computeroutput">"::std::string"</code>.
+ <code class="computeroutput">full_name</code> method with the
+ <code class="computeroutput">BOOST_CTS_USE_WIDE_CHARS</code> symbol defined,
+ which returns a <code class="computeroutput">::std::wstring</code> containing <code class="computeroutput">L"::std::string"</code>.
                                         </p>
 </div>
 </div>

Added: sandbox/mirror/doc/html/char_type_switch.html
==============================================================================
--- (empty file)
+++ sandbox/mirror/doc/html/char_type_switch.html 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -0,0 +1,178 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Chapter 2. Char Type Switch</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="libraries.html" title="Part I. Libraries">
+<link rel="prev" href="boost/mirror/meta_class.html" title="Class template meta_class">
+</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/meta_class.html"><img src="../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.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>
+</div>
+<div class="chapter" lang="en">
+<div class="titlepage"><div>
+<div><h2 class="title">
+<a name="char_type_switch"></a>Chapter 2. Char Type Switch</h2></div>
+<div><div class="author">
+<h3 class="author">
+<span class="firstname">Matú&#353;</span> <span class="surname">Chochlík</span>
+</h3>
+<code class="email">&lt;<a class="email" href="mailto:chochlik%20-at-%20gmail.com">chochlik -at- gmail.com</a>&gt;</code><code class="email">&lt;<a class="email" href="mailto:Matus.Chochlik%20-at-%20fri.uniza.sk">Matus.Chochlik -at- fri.uniza.sk</a>&gt;</code>
+</div></div>
+<div><p class="copyright">Copyright © 2008 Matú&#353; Chochlík</p></div>
+<div><div class="legalnotice">
+<a name="id699443"></a><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></div>
+</div></div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Introduction</span></dt>
+<dd><dl>
+<dt><span class="section">Abstract</span></dt>
+<dt><span class="section">Motivation</span></dt>
+</dl></dd>
+</dl>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="char_type_switch.intro"></a>Introduction</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Abstract</span></dt>
+<dt><span class="section">Motivation</span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="char_type_switch.abstract"></a>Abstract</h3></div></div></div>
+<p>
+ The <a class="link" href="char_type_switch.html" title="Chapter 2. Char Type Switch">Char Type Switch</a> is a utility, which allows
+ to change the type of string characters (and most of the related things)
+ used in the source code at compile time without breaking it, if several
+ general guidelines are followed.
+</p>
+<p>
+ The library introduces a new character type called
+ <code class="computeroutput">::boost::cts::bchar</code> that can be
+ defined as <code class="computeroutput">wchar_t</code> or as <code class="computeroutput">char</code> based on whether
+ the <code class="computeroutput">BOOST_CTS_USE_WIDE_CHARS</code> preprocessor symobol is or is not defined.
+ Based on the real type of <code class="computeroutput">bchar</code> other types like
+ <code class="computeroutput">::boost::cts::bstring</code>,
+ <code class="computeroutput">::boost::cts::bistream</code>,
+ <code class="computeroutput">::boost::cts::bostream</code>, etc.,
+ functions like
+ <code class="computeroutput">::boost::cts::bstrlen</code>,
+ <code class="computeroutput">::boost::cts::bstrcpy</code>, etc.
+ and macros like
+ <code class="computeroutput">BOOST_CTS_LIT(STRING_LITERAL)</code> OR
+ <code class="computeroutput">BOOST_CTS_LIT_LENGTH(STRING_LITERAL)</code>
+ are defined.
+</p>
+<p>
+ Most of the string operations in many applications and libraries do not logically
+ depend on the definition of the underlying character type.
+ If the types like <code class="computeroutput">bchar</code>, <code class="computeroutput">bstring</code>, etc. are used consistently
+ in the source code, instead of <code class="computeroutput">char</code>/<code class="computeroutput">wchar_t</code> or
+ <code class="computeroutput">::std::string</code>/<code class="computeroutput">::std::wstring</code>, the <a class="link" href="char_type_switch.html" title="Chapter 2. Char Type Switch">Char Type Switch</a>
+ greatly simplifies the process of changing the character type used by a library
+ or an application, when it becomes obvious that this change is necessary.
+</p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../doc/html/images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ This library is not handling conversions between various character encodings.
+</p></td></tr>
+</table></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="char_type_switch.motivation"></a>Motivation</h3></div></div></div>
+<p>
+ It is not always simple, possible or wise to decide
+ which character type to use in the an application
+ or a library when the development process starts.
+ This decision is influenced by factors many of which are clear
+ only much later in the development process or even just before
+ the deployment in a concrete enviroment, like the character
+ encodings to be used, the memory requirements, other libraries,
+ etc.
+</p>
+<p>
+ When developing a library, toolkit, or a framework it is even more
+ important to leave this decision to the application programmers
+ that will be using it. A library thus should support both
+ single-byte characters and wide chars. There are several ways
+ how to implement this support.
+</p>
+<p>
+ One of the ways for a library to support different character types
+ is to provide a dual interface using different identifiers for
+ string-related types, classes and functions. For example a naming
+ convention to prepend or append a defined prefix or suffing to the
+ base identifiers. For example:
+</p>
+<pre class="programlisting">
+// return some text as a string of chars
+const char* get_some_text_narrow(SomeType an_arg);
+// return some text as a string of wchars
+const wchar_t* get_some_text_wide(SomeType an_arg);
+
+// or
+::std::string ansi_get_some_text(SomeType an_arg);
+::std::wstring wide_get_some_text(SomeType an_arg);
+</pre>
+<p>
+ The problem with this approach is that it's not very generic what
+ makes it unacceptable for many applications. A better
+ way is to pass the required character type as a (template) argument and
+ to use function overloads:
+</p>
+<pre class="programlisting">
+::std::basic_string&lt;char&gt;&amp; get_some_text(::std::char_traits&lt;char&gt;);
+::std::basic_string&lt;wchar_t&gt;&amp; get_some_text(::std::char_traits&lt;wchar_t&gt;);
+
+// or
+::std::basic_string&lt;char&gt;&amp; get_some_text(::std::basic_string&lt;char&gt;&amp; str);
+::std::basic_string&lt;wchar_t&gt;&amp; get_some_text(::std::basic_string&lt;wchar_t&gt;&amp;);
+
+</pre>
+<p>
+ This however, sometimes leads to long and ugly expressions and adds the requirement
+ to somehow pass the character type to the function or template.
+ There are many applications that consistently use just one character type
+ and here the need to explicitly pass the type over and over is especially
+ annoying.
+</p>
+<p>
+ This can be solved using <code class="computeroutput">typedef</code>s.
+</p>
+</div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: July 16, 2008 at 10:36:00 +0200</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="boost/mirror/meta_class.html"><img src="../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.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>
+</div>
+</body>
+</html>

Modified: sandbox/mirror/doc/html/doc_HTML.manifest
==============================================================================
--- sandbox/mirror/doc/html/doc_HTML.manifest (original)
+++ sandbox/mirror/doc/html/doc_HTML.manifest 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -7,3 +7,4 @@
 boost/mirror/meta_namespace.html
 boost/mirror/meta_type.html
 boost/mirror/meta_class.html
+char_type_switch.html

Modified: sandbox/mirror/doc/html/index.html
==============================================================================
--- sandbox/mirror/doc/html/index.html (original)
+++ sandbox/mirror/doc/html/index.html 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -21,15 +21,18 @@
 <div class="book" lang="en">
 <div class="titlepage">
 <div><div><h1 class="title">
-<a name="id603662"></a>The Mirror library documentation</h1></div></div>
+<a name="id596016"></a>The Mirror library documentation</h1></div></div>
 <hr>
 </div>
 <div class="toc">
 <p><b>Table of Contents</b></p>
 <dl>
 <dt><span class="preface">About this document</span></dt>
-<dt><span class="part">I. The Mirror library</span></dt>
-<dd><dl><dt><span class="chapter">1. Mirror</span></dt></dl></dd>
+<dt><span class="part">I. Libraries</span></dt>
+<dd><dl>
+<dt><span class="chapter">1. Mirror</span></dt>
+<dt><span class="chapter">2. Char Type Switch</span></dt>
+</dl></dd>
 </dl>
 </div>
 </div>

Modified: sandbox/mirror/doc/html/libraries.html
==============================================================================
--- sandbox/mirror/doc/html/libraries.html (original)
+++ sandbox/mirror/doc/html/libraries.html 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Part I. The Mirror library</title>
+<title>Part I. Libraries</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">
@@ -24,7 +24,7 @@
 </div>
 <div class="part" lang="en">
 <div class="titlepage"><div><div><h1 class="title">
-<a name="libraries"></a>Part I. The Mirror library</h1></div></div></div>
+<a name="libraries"></a>Part I. Libraries</h1></div></div></div>
 <div class="toc">
 <p><b>Table of Contents</b></p>
 <dl>
@@ -34,6 +34,8 @@
 <dt><span class="section">Tutorial</span></dt>
 <dt><span class="section">Mirror Reference</span></dt>
 </dl></dd>
+<dt><span class="chapter">2. Char Type Switch</span></dt>
+<dd><dl><dt><span class="section">Introduction</span></dt></dl></dd>
 </dl>
 </div>
 </div>

Modified: sandbox/mirror/doc/html/mirror.html
==============================================================================
--- sandbox/mirror/doc/html/mirror.html (original)
+++ sandbox/mirror/doc/html/mirror.html 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -5,8 +5,8 @@
 <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="libraries.html" title="Part I. The Mirror library">
-<link rel="prev" href="libraries.html" title="Part I. The Mirror library">
+<link rel="up" href="libraries.html" title="Part I. Libraries">
+<link rel="prev" href="libraries.html" title="Part I. Libraries">
 <link rel="next" href="mirror/tutorial.html" title="Tutorial">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -34,7 +34,7 @@
 </div></div>
 <div><p class="copyright">Copyright © 2008 Matú&#353; Chochlík</p></div>
 <div><div class="legalnotice">
-<a name="id705145"></a><p>Use, modification and distribution is subject to the Boost
+<a name="id697499"></a><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>

Modified: sandbox/mirror/doc/src/mirror.xml
==============================================================================
--- sandbox/mirror/doc/src/mirror.xml (original)
+++ sandbox/mirror/doc/src/mirror.xml 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -18,8 +18,8 @@
   </preface>
 
   <part id="libraries">
- <title>The Mirror library</title>
-
+ <title>Libraries</title>
     <xi:include href="../../libs/mirror/doc/mirror.xml"/>
+ <xi:include href="../../libs/char_type_switch/doc/char_type_switch.xml"/>
   </part>
 </boostbook>

Added: sandbox/mirror/libs/char_type_switch/doc/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/char_type_switch/doc/Jamfile.v2 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -0,0 +1,13 @@
+# Copyright (c) 2008 Matus Chochlik <chochlik -at- gmail.com>
+
+# 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)
+
+project mirror/doc
+ ;
+
+import boostbook : boostbook ;
+
+boostbook mirror-doc : mirror.xml ;
+

Added: sandbox/mirror/libs/char_type_switch/doc/char_type_switch.xml
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/char_type_switch/doc/char_type_switch.xml 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
+"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<library name="Char Type Switch"
+ dirname="char_type_switch"
+ last-revision="$Date: 2008-07-16 10:36:00 +0200 (Wed, 16 Jul 2008) $"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ id="char_type_switch"
+>
+ <libraryinfo>
+ <author>
+ <firstname>Matúš</firstname>
+ <surname>Chochlík</surname>
+ <email>chochlik -at- gmail.com</email>
+ <email>Matus.Chochlik -at- fri.uniza.sk</email>
+ </author>
+
+ <copyright>
+ <year>2008</year>
+ <holder>Matúš Chochlík</holder>
+ </copyright>
+
+ <legalnotice>
+ <para>Use, modification and distribution is subject to the Boost
+ Software License, Version 1.0. (See accompanying file
+ <filename>LICENSE_1_0.txt</filename> or copy at <ulink
+ url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt>)
+ </para>
+ </legalnotice>
+
+ <librarypurpose>Utility that allows to switch the character type and things related to it at compile time</librarypurpose>
+ <librarycategory name="category:utilities"/>
+ </libraryinfo>
+
+ <title>Char Type Switch</title>
+
+ <xi:include href="introduction.xml"/>
+ <!--
+ <xi:include href="tutorial.xml"/>
+ <xi:include href="reference.xml"/>
+ -->
+
+</library>
+

Added: sandbox/mirror/libs/char_type_switch/doc/introduction.xml
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/char_type_switch/doc/introduction.xml 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -0,0 +1,127 @@
+<?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">
+<section id="char_type_switch.intro">
+ <title>Introduction</title>
+
+ <using-namespace name="boost"/>
+ <using-namespace name="boost::cts"/>
+
+<section id="char_type_switch.abstract">
+ <title>Abstract</title>
+
+<para>
+ The <libraryname>Char Type Switch</libraryname> is a utility, which allows
+ to change the type of string characters (and most of the related things)
+ used in the source code at compile time without breaking it, if several
+ general guidelines are followed.
+</para>
+<para>
+ The library introduces a new character type called
+ <code><classname>::boost::cts::bchar</classname></code> that can be
+ defined as <code>wchar_t</code> or as <code>char</code> based on whether
+ the <code>BOOST_CTS_USE_WIDE_CHARS</code> preprocessor symobol is or is not defined.
+ Based on the real type of <code>bchar</code> other types like
+ <code><classname>::boost::cts::bstring</classname></code>,
+ <code><classname>::boost::cts::bistream</classname></code>,
+ <code><classname>::boost::cts::bostream</classname></code>, etc.,
+ functions like
+ <code><functionname>::boost::cts::bstrlen</functionname></code>,
+ <code><functionname>::boost::cts::bstrcpy</functionname></code>, etc.
+ and macros like
+ <code><macroname>BOOST_CTS_LIT</macroname>(STRING_LITERAL)</code> OR
+ <code><macroname>BOOST_CTS_LIT_LENGTH</macroname>(STRING_LITERAL)</code>
+ are defined.
+</para>
+<para>
+ Most of the string operations in many applications and libraries do not logically
+ depend on the definition of the underlying character type.
+ If the types like <code>bchar</code>, <code>bstring</code>, etc. are used consistently
+ in the source code, instead of <code>char</code>/<code>wchar_t</code> or
+ <code>::std::string</code>/<code>::std::wstring</code>, the <libraryname>Char Type Switch</libraryname>
+ greatly simplifies the process of changing the character type used by a library
+ or an application, when it becomes obvious that this change is necessary.
+</para>
+<note><para>
+ This library is not handling conversions between various character encodings.
+</para></note>
+
+</section>
+
+
+<section id="char_type_switch.motivation">
+<title>Motivation</title>
+<para>
+ It is not always simple, possible or wise to decide
+ which character type to use in the an application
+ or a library when the development process starts.
+ This decision is influenced by factors many of which are clear
+ only much later in the development process or even just before
+ the deployment in a concrete enviroment, like the character
+ encodings to be used, the memory requirements, other libraries,
+ etc.
+</para>
+<para>
+ When developing a library, toolkit, or a framework it is even more
+ important to leave this decision to the application programmers
+ that will be using it. A library thus should support both
+ single-byte characters and wide chars. There are several ways
+ how to implement this support.
+</para>
+<para>
+ One of the ways for a library to support different character types
+ is to provide a dual interface using different identifiers for
+ string-related types, classes and functions. For example a naming
+ convention to prepend or append a defined prefix or suffing to the
+ base identifiers. For example:
+</para>
+<programlisting>
+// return some text as a string of chars
+const char* get_some_text_narrow(SomeType an_arg);
+// return some text as a string of wchars
+const wchar_t* get_some_text_wide(SomeType an_arg);
+
+// or
+::std::string ansi_get_some_text(SomeType an_arg);
+::std::wstring wide_get_some_text(SomeType an_arg);
+</programlisting>
+<para>
+ The problem with this approach is that it's not very generic what
+ makes it unacceptable for many applications. A better
+ way is to pass the required character type as a (template) argument and
+ to use function overloads:
+</para>
+<programlisting>
+::std::basic_string&lt;char&gt;&amp; get_some_text(::std::char_traits&lt;char&gt;);
+::std::basic_string&lt;wchar_t&gt;&amp; get_some_text(::std::char_traits&lt;wchar_t&gt;);
+
+// or
+::std::basic_string&lt;char&gt;&amp; get_some_text(::std::basic_string&lt;char&gt;&amp; str);
+::std::basic_string&lt;wchar_t&gt;&amp; get_some_text(::std::basic_string&lt;wchar_t&gt;&amp;);
+
+</programlisting>
+<para>
+ This however, sometimes leads to long and ugly expressions and adds the requirement
+ to somehow pass the character type to the function or template.
+ There are many applications that consistently use just one character type
+ and here the need to explicitly pass the type over and over is especially
+ annoying.
+</para>
+<para>
+ This can be solved using <code>typedef</code>s.
+</para>
+
+<!--
+<section id="char_type_switch.motivation.problem.typenames">
+ <title>Problem - Querying typenames</title>
+
+ <para>
+ </para>
+ <xi:include href="samples/typenames_naive.xml"/>
+
+</section>
+-->
+
+</section>
+
+</section>

Modified: sandbox/mirror/libs/mirror/doc/reference/meta_namespace.xml
==============================================================================
--- sandbox/mirror/libs/mirror/doc/reference/meta_namespace.xml (original)
+++ sandbox/mirror/libs/mirror/doc/reference/meta_namespace.xml 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -136,11 +136,15 @@
                                         <template-nontype-parameter name="FullName">
                                                 <type>bool</type>
                                         </template-nontype-parameter>
+ <template-type-parameter name="CharT"/>
                                 </template>
- <type>const <classname>cts::bstring</classname>&amp;</type>
+ <type>const <classname>::std::basic_string&lt;CharT&gt;</classname>&amp;</type>
                                 <parameter name="full">
                                         <paramtype>::boost::mpl::bool_&lt;FullName&gt;</paramtype>
                                 </parameter>
+ <parameter name="cht">
+ <paramtype>::std::char_traits&lt;CharT&gt;</paramtype>
+ </parameter>
                                 <purpose>
                                         <para>This static member template function returns either the base name
                                         <emphasis role="bold">without</emphasis> the nested name specifier
@@ -148,15 +152,20 @@
                                         nested name specifier of the namespace reflected by this
                                         <code><classname>meta_namespace</classname></code>,
                                         depending on the value of the template argument <code>FullName</code>.
+ Furthermore it allows to choose whether the return value type is
+ <code>::std::string</code> or <code>::std::wstring</code> based
+ on the type of the second argument.
                                         For example:
- <programlisting><classname>BOOST_MIRRORED_NAMESPACE</classname>(::boost::mirror) :: get_name(::boost::mpl::false_())
+ <programlisting><classname>BOOST_MIRRORED_NAMESPACE</classname>(::boost::mirror) :: get_name(::boost::mpl::false_(), ::std::char_traits&lt;char&gt;())
                                         </programlisting> is equivalent to calling the
- <code><methodname>base_name</methodname></code> member function and
- returns simply <code>"mirror"</code> and calling
- <programlisting><classname>BOOST_MIRRORED_NAMESPACE</classname>(::boost::mirror) :: get_name(::boost::mpl::true_())
+ <code><methodname>base_name</methodname></code> member function with the
+ <code><macroname>BOOST_CTS_USE_WIDE_CHARS</macroname></code> symbol undefined,
+ which returns a <code>::std::string</code> holding the string <code>"mirror"</code> and calling
+ <programlisting><classname>BOOST_MIRRORED_NAMESPACE</classname>(::boost::mirror) :: get_name(::boost::mpl::true_(), ::std::char_traits&lt;wchar_t&gt;())
                                         </programlisting> is equivalent to calling the
- <code><methodname>full_name</methodname></code> method which
- returns <code>"::boost::mirror"</code>.
+ <code><methodname>full_name</methodname></code> method with the
+ <code><macroname>BOOST_CTS_USE_WIDE_CHARS</macroname></code> symbol defined,
+ which returns a <code>::std::wstring</code> holding this string <code>L"::boost::mirror"</code>.
                                         </para>
                                 </purpose>
                         </method>

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-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -144,11 +144,15 @@
                                         <template-nontype-parameter name="FullName">
                                                 <type>bool</type>
                                         </template-nontype-parameter>
+ <template-type-parameter name="CharT"/>
                                 </template>
- <type>const <classname>cts::bstring</classname>&amp;</type>
+ <type>const <classname>::std::basic_string&lt;CharT&gt;</classname>&amp;</type>
                                 <parameter name="full">
                                         <paramtype>::boost::mpl::bool_&lt;FullName&gt;</paramtype>
                                 </parameter>
+ <parameter name="cht">
+ <paramtype>::std::char_traits&lt;CharT&gt;</paramtype>
+ </parameter>
                                 <purpose>
                                         <para>This static member template function returns either the base name
                                         <emphasis role="bold">without</emphasis> the nested name specifier
@@ -156,16 +160,21 @@
                                         nested name specifier of the type reflected by this
                                         <code><classname>meta_type</classname></code>,
                                         depending on the value of the template argument <code>FullName</code>.
+ Furthermore it allows to choose whether the return value type is
+ <code>::std::string</code> or <code>::std::wstring</code> based
+ on the type of the second argument.
                                         For example:
- <programlisting><macroname>BOOST_MIRRORED_TYPE</macroname>(::std::string) :: get_name(::boost::mpl::false_())</programlisting> or
- <programlisting><classname>meta_type</classname> &lt; ::std::string &gt; :: get_name(::boost::mpl::false_())</programlisting>
+ <programlisting><macroname>BOOST_MIRRORED_TYPE</macroname>(::std::string) :: get_name(::boost::mpl::false_(), ::std::char_traits&lt;char&gt;())</programlisting> or
+ <programlisting><classname>meta_type</classname> &lt; ::std::string &gt; :: get_name(::boost::mpl::false_(), ::std::char_traits&lt;char&gt;())</programlisting>
                                         is equivalent to calling the
- <code><methodname>base_name</methodname></code> member function and
- returns simply <code>"string"</code> and
- <programlisting><macroname>BOOST_MIRRORED_TYPE</macroname>(::std::string) :: get_name(::boost::mpl::true_())</programlisting> or
- <programlisting><classname>meta_type</classname> &lt; ::std::string &gt; :: get_name( ::boost::mpl::true_())</programlisting> is equivalent to calling the
- <code><methodname>full_name</methodname></code> method which
- returns <code>"::std::string"</code>.
+ <code><methodname>base_name</methodname></code> member function with the
+ <code><macroname>BOOST_CTS_USE_WIDE_CHARS</macroname></code> symbol undefined,
+ which returns a <code>::std::string</code> containing <code>"string"</code> and calling
+ <programlisting><macroname>BOOST_MIRRORED_TYPE</macroname>(::std::string) :: get_name(::boost::mpl::true_(), ::std::char_traits&lt;wchar_t&gt;())</programlisting> or
+ <programlisting><classname>meta_type</classname> &lt; ::std::string &gt; :: get_name( ::boost::mpl::true_(), ::std::char_traits&lt;wchar_t&gt;())</programlisting> is equivalent to calling the
+ <code><methodname>full_name</methodname></code> method with the
+ <code><macroname>BOOST_CTS_USE_WIDE_CHARS</macroname></code> symbol defined,
+ which returns a <code>::std::wstring</code> containing <code>L"::std::string"</code>.
                                         </para>
                                 </purpose>
                         </method>

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-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -103,6 +103,14 @@
         bcout << "|11| " << BOOST_MIRRORED_NAMESPACE(::test) ::full_name() << endl;
         bcout << "|12| " << BOOST_MIRRORED_NAMESPACE(::test::stuff) ::full_name() << endl;
         bcout << "|13| " << BOOST_MIRRORED_NAMESPACE(::test::stuff::detail) ::full_name() << endl;
+ //
+ // a more generic interface
+ bcout << "|14| " << BOOST_MIRRORED_NAMESPACE(::test::stuff::detail) ::get_name(
+ // the base name
+ ::boost::mpl::false_(),
+ // the character type traits could be (::std::char_traits<...>())
+ ::boost::cts::bchar_traits()
+ ) << endl;
         return 0;
 }
 

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-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -220,7 +220,7 @@
         // reference to function returning pointer to functions
         typedef T50& T51;
         bcout << "|51| " << BOOST_MIRRORED_TYPE(T51) ::full_name() << endl;
- bcout << "|52| " << BOOST_MIRRORED_TYPE(T51) ::get_name(mpl::false_()) << endl;
+ bcout << "|52| " << BOOST_MIRRORED_TYPE(T51) ::get_name(mpl::false_(), cts::bchar_traits()) << endl;
         //
         return 0;
 }

Modified: sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp (original)
+++ sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp 2008-07-16 11:27:20 EDT (Wed, 16 Jul 2008)
@@ -88,6 +88,7 @@
         typedef BOOST_MIRRORED_CLASS(T) meta_T;
         //
         //
+ //
         bcout << "---------------------------------------------------" << endl;
         bcout << "The type name is: "<< meta_T::base_name() << endl;
         bcout << "---------------------------------------------------" << endl;


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