$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r55274 - in sandbox/SOC/2009/unicode/boost: iterator unicode
From: loufoque_at_[hidden]
Date: 2009-07-30 14:45:04
Author: mgaunard
Date: 2009-07-29 20:17:12 EDT (Wed, 29 Jul 2009)
New Revision: 55274
URL: http://svn.boost.org/trac/boost/changeset/55274
Log:
Adding non-const range overloads
Text files modified: 
   sandbox/SOC/2009/unicode/boost/iterator/consumer_iterator.hpp |    11 +++++++++                               
   sandbox/SOC/2009/unicode/boost/iterator/pipe_iterator.hpp     |    11 +++++++++                               
   sandbox/SOC/2009/unicode/boost/unicode/graphemes.hpp          |    37 ++++++++++++++++++++++++++++++++        
   sandbox/SOC/2009/unicode/boost/unicode/search.hpp             |     1                                         
   sandbox/SOC/2009/unicode/boost/unicode/utf.hpp                |    46 ++++++++++++++++++++++++++++++++++++++++
   5 files changed, 105 insertions(+), 1 deletions(-)
Modified: sandbox/SOC/2009/unicode/boost/iterator/consumer_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/iterator/consumer_iterator.hpp	(original)
+++ sandbox/SOC/2009/unicode/boost/iterator/consumer_iterator.hpp	2009-07-29 20:17:12 EDT (Wed, 29 Jul 2009)
@@ -231,6 +231,17 @@
                 make_consumer_iterator(boost::begin(range), boost::end(range), boost::end(range), c)
         );
 }
+
+template<typename Range, typename Consumer>
+boost::iterator_range<
+	consumer_iterator<typename boost::range_iterator<Range>::type, Consumer>
+> consumed(Range& range, Consumer c)
+{
+	return boost::make_iterator_range(
+		make_consumer_iterator(boost::begin(range), boost::end(range), boost::begin(range), c),
+		make_consumer_iterator(boost::begin(range), boost::end(range), boost::end(range), c)
+	);
+}
     
 } // namespace boost
 
Modified: sandbox/SOC/2009/unicode/boost/iterator/pipe_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/iterator/pipe_iterator.hpp	(original)
+++ sandbox/SOC/2009/unicode/boost/iterator/pipe_iterator.hpp	2009-07-29 20:17:12 EDT (Wed, 29 Jul 2009)
@@ -252,6 +252,17 @@
         );
 }
 
+template<typename Range, typename Pipe>
+boost::iterator_range<
+	pipe_iterator<typename boost::range_iterator<Range>::type, Pipe>
+> piped(Range& range, Pipe p)
+{
+	return boost::make_iterator_range(
+		make_pipe_iterator(boost::begin(range), boost::end(range), boost::begin(range), p),
+		make_pipe_iterator(boost::begin(range), boost::end(range), boost::end(range), p)
+	);
+}
+
 template<typename Range, typename Pipe, typename OutputIterator>
 OutputIterator pipe(const Range& range, Pipe pipe, OutputIterator out)
 {
Modified: sandbox/SOC/2009/unicode/boost/unicode/graphemes.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/unicode/graphemes.hpp	(original)
+++ sandbox/SOC/2009/unicode/boost/unicode/graphemes.hpp	2009-07-29 20:17:12 EDT (Wed, 29 Jul 2009)
@@ -49,6 +49,20 @@
     return consumed(range, make_boundary_consumer(unicode::grapheme_boundary()));
 }
 
+/** Adapts the range of code points \c range into a range of ranges of code points,
+ * each subrange being a grapheme cluster. */
+template<typename Range>
+iterator_range<typename boost::detail::unspecified<
+    consumer_iterator<
+        typename range_iterator<Range>::type,
+        boundary_consumer<unicode::grapheme_boundary>
+    >
+>::type>
+grapheme_bounded(Range& range)
+{
+    return consumed(range, make_boundary_consumer(unicode::grapheme_boundary()));
+}
+
 /** INTERNAL ONLY */
 #define BOOST_UNICODE_GRAPHEME_BOUNDED_DEF(Name)                       \
 /** Adapts the range of Name units \c range into a range of ranges of
@@ -74,6 +88,29 @@
     );                                                                 \
 }                                                                      \
                                                                        \
+/** Adapts the range of Name units \c range into a range of ranges of
+Name units, each subrange being a grapheme cluster. */                 \
+template<typename Range>                                               \
+iterator_range<typename boost::detail::unspecified<                    \
+    consumer_iterator<                                                 \
+        typename range_iterator<Range>::type,                          \
+        piped_consumer<                                                \
+            unicode::Name##_decoder,                                   \
+            boundary_consumer<unicode::grapheme_boundary>              \
+        >                                                              \
+    >                                                                  \
+>::type>                                                               \
+Name##_grapheme_bounded(Range& range)                                  \
+{                                                                      \
+    return consumed(                                                   \
+        range,                                                         \
+        make_piped_consumer(                                           \
+            unicode::Name##_decoder(),                                 \
+            make_boundary_consumer(unicode::grapheme_boundary())       \
+        )                                                              \
+    );                                                                 \
+}                                                                      \
+                                                                       \
 /** Model of \c BoundaryChecker that tells whether a position lies on a
 grapheme cluster boundary within a range of Name units. */             \
 typedef multi_boundary<                                                \
Modified: sandbox/SOC/2009/unicode/boost/unicode/search.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/unicode/search.hpp	(original)
+++ sandbox/SOC/2009/unicode/boost/unicode/search.hpp	2009-07-29 20:17:12 EDT (Wed, 29 Jul 2009)
@@ -4,7 +4,6 @@
 #include <boost/range.hpp>
 #include <boost/algorithm/string/compare.hpp>
 
-
 namespace boost
 {
 
Modified: sandbox/SOC/2009/unicode/boost/unicode/utf.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/unicode/utf.hpp	(original)
+++ sandbox/SOC/2009/unicode/boost/unicode/utf.hpp	2009-07-29 20:17:12 EDT (Wed, 29 Jul 2009)
@@ -41,6 +41,21 @@
     return piped(range, make_one_many_pipe(unicode::Name##_encoder()));\
 }                                                                      \
                                                                        \
+/** Lazily evalutes unicode::Name##_encoder by returning a range adapter
+   that wraps the range \c range and converts it step-by-step as
+   the range is advanced */                                            \
+template<typename Range>                                               \
+iterator_range<typename boost::detail::unspecified<                    \
+    pipe_iterator<                                                     \
+        typename range_iterator<Range>::type,                          \
+        one_many_pipe<unicode::Name##_encoder>                         \
+    >                                                                  \
+>::type>                                                               \
+Name##_encoded(Range& range)                                           \
+{                                                                      \
+    return piped(range, make_one_many_pipe(unicode::Name##_encoder()));\
+}                                                                      \
+                                                                       \
 /** Lazily evalutes unicode::Name##_encoder by returning an output
   iterator that wraps \c out and converts every pushed element. */     \
 template<typename OutputIterator>                                      \
@@ -81,6 +96,21 @@
     return piped(range, unicode::Name##_decoder());                    \
 }                                                                      \
                                                                        \
+/** Lazily evalutes unicode::Name##_decoder by returning a range adapter
+   that wraps the range \c range and converts it step-by-step as
+   the range is advanced */                                            \
+template<typename Range>                                               \
+iterator_range<typename boost::detail::unspecified<                    \
+    pipe_iterator<                                                     \
+        typename range_iterator<Range>::type,                          \
+        unicode::Name##_decoder                                        \
+    >                                                                  \
+>::type>                                                               \
+Name##_decoded(Range& range)                                           \
+{                                                                      \
+    return piped(range, unicode::Name##_decoder());                    \
+}                                                                      \
+                                                                       \
 /** Adapts the range of Name units \c range into a range of ranges of
 Name units, each subrange being a decoded unit. */                     \
 template<typename Range>                                               \
@@ -96,6 +126,22 @@
         make_pipe_consumer(unicode::Name##_decoder())                  \
     );                                                                 \
 }                                                                      \
+                                                                       \
+/** Adapts the range of Name units \c range into a range of ranges of
+Name units, each subrange being a decoded unit. */                     \
+template<typename Range>                                               \
+iterator_range<typename boost::detail::unspecified<                    \
+    consumer_iterator<                                                 \
+        typename range_iterator<Range>::type,                          \
+        pipe_consumer<unicode::Name##_decoder>                         \
+    >                                                                  \
+>::type> Name##_bounded(Range& range)                                  \
+{                                                                      \
+    return consumed(                                                   \
+        range,                                                         \
+        make_pipe_consumer(unicode::Name##_decoder())                  \
+    );                                                                 \
+}                                                                      \
 
 BOOST_UNICODE_ENCODER_DEF(u16)
 BOOST_UNICODE_DECODER_DEF(u16)