Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66447 - sandbox/chrono/boost/static_string
From: vicente.botet_at_[hidden]
Date: 2010-11-07 17:06:24


Author: viboes
Date: 2010-11-07 17:06:21 EST (Sun, 07 Nov 2010)
New Revision: 66447
URL: http://svn.boost.org/trac/boost/changeset/66447

Log:
StaticString: Fix compile errors
* Add support for wide characters

Text files modified:
   sandbox/chrono/boost/static_string/basic_str.hpp | 91 ++++++++++++++++++++++++++++++++++++++++
   sandbox/chrono/boost/static_string/c_str.hpp | 25 ++++++----
   sandbox/chrono/boost/static_string/match.hpp | 4
   3 files changed, 107 insertions(+), 13 deletions(-)

Modified: sandbox/chrono/boost/static_string/basic_str.hpp
==============================================================================
--- sandbox/chrono/boost/static_string/basic_str.hpp (original)
+++ sandbox/chrono/boost/static_string/basic_str.hpp 2010-11-07 17:06:21 EST (Sun, 07 Nov 2010)
@@ -9,8 +9,14 @@
 #ifndef BOOST_STATIC_STRING_BASIC_STR_HPP
 #define BOOST_STATIC_STRING_BASIC_STR_HPP
 
+#include <boost/config.hpp>
 #include <boost/mpl/vector/vector10_c.hpp>
 
+#if defined(BOOST_NO_UNICODE_LITERALS) || defined(BOOST_NO_CHAR16_T) || defined(BOOST_NO_CHAR32_T)
+#else
+#define BOOST_STATIC_STRING_HAS_UNICODE_SUPPORT 1
+#endif
+
 namespace boost {
 namespace static_string {
 
@@ -41,6 +47,91 @@
     typedef mpl::vector5_c<char, H1, H2, H3, H4, H5> type;
 };
 
+
+#ifndef BOOST_NO_STD_WSTRING
+
+template <wchar_t H1>
+struct wstr_1 {
+ typedef mpl::vector1_c<wchar_t, H1> type;
+};
+
+template <wchar_t H1, wchar_t H2>
+struct wstr_2 {
+ typedef mpl::vector2_c<wchar_t, H1, H2> type;
+};
+
+template <wchar_t H1, wchar_t H2, wchar_t H3>
+struct wstr_3 {
+ typedef mpl::vector3_c<wchar_t, H1, H2, H3> type;
+};
+
+template <wchar_t H1, wchar_t H2, wchar_t H3, wchar_t H4>
+struct wstr_4 {
+ typedef mpl::vector4_c<wchar_t, H1, H2, H3, H4> type;
+};
+
+template <wchar_t H1, wchar_t H2, wchar_t H3, wchar_t H4, wchar_t H5>
+struct wstr_5 {
+ typedef mpl::vector5_c<wchar_t, H1, H2, H3, H4, H5> type;
+};
+#endif
+
+#ifdef BOOST_STATIC_STRING_HAS_UNICODE_SUPPORT
+template <char16_t H1>
+struct u16str_1 {
+ typedef mpl::vector1_c<char16_t, H1> type;
+};
+
+template <char16_t H1, char16_t H2>
+struct u16str_2 {
+ typedef mpl::vector2_c<char16_t, H1, H2> type;
+};
+
+template <char16_t H1, char16_t H2, char16_t H3>
+struct u16str_3 {
+ typedef mpl::vector3_c<char16_t, H1, H2, H3> type;
+};
+
+template <char16_t H1, char16_t H2, char16_t H3, char16_t H4>
+struct u16str_4 {
+ typedef mpl::vector4_c<char16_t, H1, H2, H3, H4> type;
+};
+
+template <char16_t H1, char16_t H2, char16_t H3, char16_t H4, char16_t H5>
+struct u16str_5 {
+ typedef mpl::vector5_c<char16_t, H1, H2, H3, H4, H5> type;
+};
+
+/////////
+
+template <char32_t H1>
+struct u32str_1 {
+ typedef mpl::vector1_c<char32_t, H1> type;
+};
+
+template <char32_t H1, char32_t H2>
+struct u32str_2 {
+ typedef mpl::vector2_c<char32_t, H1, H2> type;
+};
+
+template <char32_t H1, char32_t H2, char32_t H3>
+struct u32str_3 {
+ typedef mpl::vector3_c<char32_t, H1, H2, H3> type;
+};
+
+template <char32_t H1, char32_t H2, char32_t H3, char32_t H4>
+struct u32str_4 {
+ typedef mpl::vector4_c<char32_t, H1, H2, H3, H4> type;
+};
+
+template <char32_t H1, char32_t H2, char32_t H3, char32_t H4, char32_t H5>
+struct u32str_5 {
+ typedef mpl::vector5_c<char32_t, H1, H2, H3, H4, H5> type;
+};
+
+#endif
+
+
 } // namespace static_string
 } // namespace boost
 

Modified: sandbox/chrono/boost/static_string/c_str.hpp
==============================================================================
--- sandbox/chrono/boost/static_string/c_str.hpp (original)
+++ sandbox/chrono/boost/static_string/c_str.hpp 2010-11-07 17:06:21 EST (Sun, 07 Nov 2010)
@@ -15,8 +15,8 @@
 #include <boost/mpl/integral_c.hpp>
 #include <boost/mpl/end.hpp>
 #include <boost/mpl/begin.hpp>
-#include <boost/preprocessor/cat.hpp>
-#include <boost/preprocessor/inc.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/inc.hpp>
 
 #if !defined(BOOST_STATIC_STRING_LIMIT_C_STR_SIZE)
 # define BOOST_STATIC_STRING_LIMIT_C_STR_SIZE 32
@@ -55,12 +55,14 @@
 // typedef typename value_type<Sequence>::type value_type;
     typedef typename mpl::end<Sequence>::type iend;
     typedef typename mpl::begin<Sequence>::type i0;
- #define M0(z, n, data) \
- typedef \
- typename static_string::detail::next_unless<BOOST_PP_CAT(i, n), iend>::type \
+ #define BOOST_STATIC_STRING_C_STR_M0(z, n, data) \
+ typedef \
+ typename static_string::detail::next_unless<BOOST_PP_CAT(i, n), iend>::type \
     BOOST_PP_CAT(i, BOOST_PP_INC(n));
- BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~)
- #undef M0
+
+ BOOST_PP_REPEAT(BOOST_STATIC_STRING_LIMIT_C_STR_SIZE, BOOST_STATIC_STRING_C_STR_M0, ~)
+
+ #undef BOOST_STATIC_STRING_C_STR_M0
 
     typedef c_str type;
     static typename value_type<Sequence>::type const value[BOOST_STATIC_STRING_LIMIT_C_STR_SIZE+1];
@@ -69,12 +71,13 @@
 template<typename Sequence>
 typename value_type<Sequence>::type const c_str<Sequence>::value[BOOST_STATIC_STRING_LIMIT_C_STR_SIZE+1] =
 {
- #define M0(z, n, data) \
+ #define BOOST_STATIC_STRING_C_STR_M0(z, n, data) \
     static_string::detail::deref_unless<typename value_type<Sequence>::type, BOOST_PP_CAT(i, n), iend>::type::value,
- BOOST_PP_REPEAT(BOOST_STATIC_STRING_LIMIT_C_STR_SIZE, M0, ~)
- #undef M0
+
+ BOOST_PP_REPEAT(BOOST_STATIC_STRING_LIMIT_C_STR_SIZE, BOOST_STATIC_STRING_C_STR_M0, ~)
+
+ #undef BOOST_STATIC_STRING_C_STR_M0
     mpl::integral_c<typename value_type<Sequence>::type, 0>::type::value
-// '\0'
 };
 
 } // namespace static_string

Modified: sandbox/chrono/boost/static_string/match.hpp
==============================================================================
--- sandbox/chrono/boost/static_string/match.hpp (original)
+++ sandbox/chrono/boost/static_string/match.hpp 2010-11-07 17:06:21 EST (Sun, 07 Nov 2010)
@@ -9,8 +9,8 @@
 #ifndef BOOST_STATIC_STRING_MATCH_HPP
 #define BOOST_STATIC_STRING_MATCH_HPP
 
-#include <boost/static_string/static_string/basic_str.hpp>
-#include <boost/static_string/static_string/ptree.hpp>
+#include <boost/static_string/basic_str.hpp>
+#include <boost/static_string/ptree.hpp>
 #include <boost/mpl/integral_c.hpp>
 
 #include <ios>


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