Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55031 - in trunk/boost/spirit/home/karma: detail operator
From: hartmut.kaiser_at_[hidden]
Date: 2009-07-19 15:50:24


Author: hkaiser
Date: 2009-07-19 15:50:23 EDT (Sun, 19 Jul 2009)
New Revision: 55031
URL: http://svn.boost.org/trac/boost/changeset/55031

Log:
Spirit: Moved buffering from sequences to alternatives, which makes more sense...
Text files modified:
   trunk/boost/spirit/home/karma/detail/alternative_function.hpp | 13 ++++++++++++-
   trunk/boost/spirit/home/karma/operator/sequence.hpp | 15 ++-------------
   2 files changed, 14 insertions(+), 14 deletions(-)

Modified: trunk/boost/spirit/home/karma/detail/alternative_function.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/detail/alternative_function.hpp (original)
+++ trunk/boost/spirit/home/karma/detail/alternative_function.hpp 2009-07-19 15:50:23 EDT (Sun, 19 Jul 2009)
@@ -14,6 +14,7 @@
 #include <boost/spirit/home/karma/domain.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/karma/detail/output_iterator.hpp>
 #include <boost/utility/enable_if.hpp>
 #include <boost/mpl/find_if.hpp>
 #include <boost/mpl/deref.hpp>
@@ -184,7 +185,17 @@
                 alternative_generate<Component, Attribute, expected_type>
             generate;
 
- return generate::call(component, sink, ctx, delim, attr);
+ // wrap the given output iterator avoid output as long as one
+ // component fails
+ detail::enable_buffering<OutputIterator> buffering(sink);
+ bool r = false;
+ {
+ detail::disable_counting<OutputIterator> nocounting(sink);
+ r = generate::call(component, sink, ctx, delim, attr);
+ }
+ if (r)
+ buffering.buffer_copy();
+ return r;
         }
 
         OutputIterator& sink;

Modified: trunk/boost/spirit/home/karma/operator/sequence.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/sequence.hpp (original)
+++ trunk/boost/spirit/home/karma/operator/sequence.hpp 2009-07-19 15:50:23 EDT (Sun, 19 Jul 2009)
@@ -16,7 +16,6 @@
 #include <boost/spirit/home/karma/meta_compiler.hpp>
 #include <boost/spirit/home/karma/detail/fail_function.hpp>
 #include <boost/spirit/home/karma/detail/pass_container.hpp>
-#include <boost/spirit/home/karma/detail/output_iterator.hpp>
 #include <boost/spirit/home/support/info.hpp>
 #include <boost/spirit/home/support/detail/what_function.hpp>
 #include <boost/spirit/home/support/attributes.hpp>
@@ -121,18 +120,8 @@
         bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
           , Attribute const& attr) const
         {
- // wrap the given output iterator avoid output as long as one
- // component of the sequence fails
- detail::enable_buffering<OutputIterator> buffering(sink);
- bool r = false;
- {
- detail::disable_counting<OutputIterator> nocounting(sink);
- r = generate_impl(sink, ctx, d, attr
- , traits::is_container<Attribute>());
- }
- if (r)
- buffering.buffer_copy();
- return r;
+ return generate_impl(sink, ctx, d, attr
+ , traits::is_container<Attribute>());
         }
 
         template <typename Context>


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