Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76661 - in sandbox/coerce/boost/coerce: . detail
From: vexocide_at_[hidden]
Date: 2012-01-24 05:57:10


Author: vexocide
Date: 2012-01-24 05:57:09 EST (Tue, 24 Jan 2012)
New Revision: 76661
URL: http://svn.boost.org/trac/boost/changeset/76661

Log:
Moved and renamed several files and functions
Added:
   sandbox/coerce/boost/coerce/detail/spirit.hpp
      - copied, changed from r76247, /sandbox/coerce/boost/coerce/detail/backend.hpp
Removed:
   sandbox/coerce/boost/coerce/detail/backend.hpp
   sandbox/coerce/boost/coerce/sequence.hpp
Text files modified:
   sandbox/coerce/boost/coerce/coerce.hpp | 11 ++++-----
   sandbox/coerce/boost/coerce/detail/karma.hpp | 8 +++---
   sandbox/coerce/boost/coerce/detail/spirit.hpp | 16 ++++++------
   sandbox/coerce/boost/coerce/reserve.hpp | 2 +
   sandbox/coerce/boost/coerce/string.hpp | 48 +++++++++++++++++++++++++++++++++++-----
   5 files changed, 61 insertions(+), 24 deletions(-)

Modified: sandbox/coerce/boost/coerce/coerce.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/coerce.hpp (original)
+++ sandbox/coerce/boost/coerce/coerce.hpp 2012-01-24 05:57:09 EST (Tue, 24 Jan 2012)
@@ -1,4 +1,4 @@
-// Copyright Jeroen Habraken 2010 - 2011.
+// Copyright Jeroen Habraken 2010 - 2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file ../../LICENSE_1_0.txt or copy at
@@ -11,9 +11,8 @@
 #pragma once
 #endif
 
-#include <boost/coerce/detail/backend.hpp>
+#include <boost/coerce/detail/spirit.hpp>
 #include <boost/coerce/detail/tag.hpp>
-#include <boost/coerce/sequence.hpp>
 #include <boost/coerce/string.hpp>
 #include <boost/coerce/tag.hpp>
 
@@ -33,9 +32,9 @@
           , typename Enable = void
>
         struct as
- : detail::backend<
- typename traits::is_sequence<Target>::type,
- typename traits::is_string<Source>::type
+ : detail::spirit<
+ typename traits::is_source_string<Source>::type,
+ typename traits::is_target_string<Target>::type
>::type { };
 
     } // namespace traits

Deleted: sandbox/coerce/boost/coerce/detail/backend.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/detail/backend.hpp 2012-01-24 05:57:09 EST (Tue, 24 Jan 2012)
+++ (empty file)
@@ -1,39 +0,0 @@
-// Copyright Jeroen Habraken 2011.
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file ../../../LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_COERCE_DETAIL_BACKEND_HPP
-#define BOOST_COERCE_DETAIL_BACKEND_HPP
-
-#ifdef _MSC_VER
-#pragma once
-#endif
-
-#include <boost/coerce/detail/karma.hpp>
-#include <boost/coerce/detail/qi.hpp>
-
-#include <boost/mpl/bool.hpp>
-#include <boost/static_assert.hpp>
-
-namespace boost { namespace coerce { namespace detail {
-
- template <typename U, typename V>
- struct backend {
- BOOST_STATIC_ASSERT(sizeof(U) == 0);
- };
-
- template <typename U>
- struct backend<U, mpl::true_> {
- typedef qi type;
- };
-
- template <>
- struct backend<mpl::true_, mpl::false_> {
- typedef karma type;
- };
-
-} } } // namespace boost::coerce::detail
-
-#endif // BOOST_COERCE_DETAIL_BACKEND_HPP

Modified: sandbox/coerce/boost/coerce/detail/karma.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/detail/karma.hpp (original)
+++ sandbox/coerce/boost/coerce/detail/karma.hpp 2012-01-24 05:57:09 EST (Tue, 24 Jan 2012)
@@ -12,7 +12,7 @@
 #endif
 
 #include <boost/coerce/reserve.hpp>
-#include <boost/coerce/sequence.hpp>
+#include <boost/coerce/string.hpp>
 #include <boost/coerce/tag.hpp>
 
 #include <boost/spirit/home/karma/char.hpp>
@@ -26,17 +26,17 @@
         template <typename Target, typename Source, typename Tag>
         static inline bool
         call(Target & target, Source const & source, Tag const & tag) {
- typedef traits::sequence_traits<Target> sequence_traits;
+ typedef traits::string_traits<Target> string_traits;
             
             detail::call_reserve(
                 target, traits::reserve_size<Source, Tag>::call(source, tag));
 
             typename Tag::template generator<
- typename sequence_traits::iterator, Target, Source
+ typename string_traits::back_insert_iterator, Target, Source
> generator(tag);
 
             return spirit::karma::generate(
- sequence_traits::back_inserter(target), generator, source);
+ string_traits::back_inserter(target), generator, source);
         }
     };
 

Copied: sandbox/coerce/boost/coerce/detail/spirit.hpp (from r76247, /sandbox/coerce/boost/coerce/detail/backend.hpp)
==============================================================================
--- /sandbox/coerce/boost/coerce/detail/backend.hpp (original)
+++ sandbox/coerce/boost/coerce/detail/spirit.hpp 2012-01-24 05:57:09 EST (Tue, 24 Jan 2012)
@@ -4,8 +4,8 @@
 // (See accompanying file ../../../LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_COERCE_DETAIL_BACKEND_HPP
-#define BOOST_COERCE_DETAIL_BACKEND_HPP
+#ifndef BOOST_COERCE_DETAIL_SPIRIT_HPP
+#define BOOST_COERCE_DETAIL_SPIRIT_HPP
 
 #ifdef _MSC_VER
 #pragma once
@@ -20,20 +20,20 @@
 namespace boost { namespace coerce { namespace detail {
 
     template <typename U, typename V>
- struct backend {
+ struct spirit {
         BOOST_STATIC_ASSERT(sizeof(U) == 0);
     };
 
- template <typename U>
- struct backend<U, mpl::true_> {
+ template <>
+ struct spirit<mpl::true_, mpl::false_> {
         typedef qi type;
     };
 
- template <>
- struct backend<mpl::true_, mpl::false_> {
+ template <typename U>
+ struct spirit<U, mpl::true_> {
         typedef karma type;
     };
 
 } } } // namespace boost::coerce::detail
 
-#endif // BOOST_COERCE_DETAIL_BACKEND_HPP
+#endif // BOOST_COERCE_DETAIL_SPIRIT_HPP

Modified: sandbox/coerce/boost/coerce/reserve.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/reserve.hpp (original)
+++ sandbox/coerce/boost/coerce/reserve.hpp 2012-01-24 05:57:09 EST (Tue, 24 Jan 2012)
@@ -34,10 +34,12 @@
         BOOST_STATIC_CONSTANT(std::size_t, value = 1);
     };
 
+#ifndef BOOST_NO_INTRINSIC_WCHAR_T
     template <typename Tag>
     struct reserve_size_impl<wchar_t, Tag> {
         BOOST_STATIC_CONSTANT(std::size_t, value = 1);
     };
+#endif
 
     template <typename T, typename Tag>
     struct reserve_size_impl_integral {

Deleted: sandbox/coerce/boost/coerce/sequence.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/sequence.hpp 2012-01-24 05:57:09 EST (Tue, 24 Jan 2012)
+++ (empty file)
@@ -1,67 +0,0 @@
-// Copyright Jeroen Habraken 2011.
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file ../../LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_COERCE_SEQUENCE_HPP
-#define BOOST_COERCE_SEQUENCE_HPP
-
-#ifdef _MSC_VER
-#pragma once
-#endif
-
-#include <boost/mpl/bool.hpp>
-
-#include <iterator>
-#include <string>
-#include <vector>
-
-namespace boost { namespace coerce { namespace traits {
-
- template <typename T>
- struct sequence_traits_impl;
-
- template <typename T>
- struct sequence_traits_impl_std {
- typedef std::back_insert_iterator<T> iterator;
-
- static inline iterator
- back_inserter(T & value) {
- return std::back_inserter(value);
- }
- };
-
- template <typename T, typename Traits, typename Allocator>
- struct sequence_traits_impl<std::basic_string<T, Traits, Allocator> >
- : sequence_traits_impl_std<
- std::basic_string<T, Traits, Allocator>
- > { };
-
- template <typename T, typename Allocator>
- struct sequence_traits_impl<std::vector<T, Allocator> >
- : sequence_traits_impl_std<std::vector<T, Allocator> > { };
-
- template <typename T, typename Enable = void>
- struct sequence_traits
- : sequence_traits_impl<T> { };
-
- template <typename T>
- struct is_sequence_impl
- : mpl::false_ { };
-
- template <typename T, typename Traits, typename Allocator>
- struct is_sequence_impl<std::basic_string<T, Traits, Allocator> >
- : mpl::true_ { };
-
- template <typename T, typename Allocator>
- struct is_sequence_impl<std::vector<T, Allocator> >
- : mpl::true_ { };
-
- template <typename T, typename Enable = void>
- struct is_sequence
- : is_sequence_impl<T> { };
-
-} } } // namespace boost::coerce::traits
-
-#endif // BOOST_COERCE_SEQUENCE_HPP

Modified: sandbox/coerce/boost/coerce/string.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/string.hpp (original)
+++ sandbox/coerce/boost/coerce/string.hpp 2012-01-24 05:57:09 EST (Tue, 24 Jan 2012)
@@ -14,6 +14,7 @@
 
 #include <cstddef> // std::size_t
 #include <string>
+#include <vector>
 
 namespace boost { namespace coerce { namespace traits {
 
@@ -67,6 +68,25 @@
         end(type const & value) {
             return value.end();
         }
+
+ typedef std::back_insert_iterator<type> back_insert_iterator;
+
+ static inline back_insert_iterator
+ back_inserter(type & value) {
+ return std::back_inserter(value);
+ }
+ };
+
+ template <typename T, typename Allocator>
+ struct string_traits_impl<std::vector<T, Allocator> > {
+ typedef std::vector<T, Allocator> type;
+
+ typedef std::back_insert_iterator<type> back_insert_iterator;
+
+ static inline back_insert_iterator
+ back_inserter(type & value) {
+ return std::back_inserter(value);
+ }
     };
 
     template <typename T, typename Enable = void>
@@ -74,24 +94,40 @@
         : string_traits_impl<T> { };
 
     template <typename T>
- struct is_string_impl
+ struct is_source_string_impl
         : mpl::false_ { };
 
     template <typename T>
- struct is_string_impl<T *>
+ struct is_source_string_impl<T *>
         : traits::is_char<T> { };
 
     template <typename T, std::size_t N>
- struct is_string_impl<T [N]>
+ struct is_source_string_impl<T [N]>
+ : traits::is_char<T> { };
+
+ template <typename T, typename Traits, typename Allocator>
+ struct is_source_string_impl<std::basic_string<T, Traits, Allocator> >
         : traits::is_char<T> { };
 
+ template <typename T, typename Enable = void>
+ struct is_source_string
+ : is_source_string_impl<T> { };
+
+ template <typename T>
+ struct is_target_string_impl
+ : mpl::false_ { };
+
     template <typename T, typename Traits, typename Allocator>
- struct is_string_impl<std::basic_string<T, Traits, Allocator> >
+ struct is_target_string_impl<std::basic_string<T, Traits, Allocator> >
+ : traits::is_char<T> { };
+
+ template <typename T, typename Allocator>
+ struct is_target_string_impl<std::vector<T, Allocator> >
         : traits::is_char<T> { };
 
     template <typename T, typename Enable = void>
- struct is_string
- : is_string_impl<T> { };
+ struct is_target_string
+ : is_target_string_impl<T> { };
 
 } } } // namespace boost::coerce::traits
 


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