Changeset 54796


Ignore:
Timestamp:
Jul 8, 2009, 3:43:16 PM (9 years ago)
Author:
Hartmut Kaiser
Message:

Spirit: fixing several (corner case) use cases

Location:
trunk/boost/spirit/home
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/boost/spirit/home/karma/detail/generate_to.hpp

    r52603 r54796  
    1313#include <boost/spirit/home/support/unused.hpp>
    1414#include <boost/spirit/home/support/char_class.hpp>
     15#include <boost/spirit/home/karma/detail/output_iterator.hpp>
    1516
    1617namespace boost { namespace spirit { namespace karma { namespace detail
     
    2930        *sink = spirit::char_class::convert<CharEncoding>::to(Tag(), p);
    3031        ++sink;
    31         return sink.good();
     32        return detail::sink_is_good(sink);
    3233    }
    3334
     
    3839        *sink = p;
    3940        ++sink;
    40         return sink.good();
     41        return detail::sink_is_good(sink);
    4142    }
    4243
     
    5354        *sink = p;
    5455        ++sink;
    55         return sink.good();
     56        return detail::sink_is_good(sink);
    5657    }
    5758
  • trunk/boost/spirit/home/karma/detail/output_iterator.hpp

    r52767 r54796  
    290290
    291291        output_proxy operator*() { return output_proxy(*this); }
    292         output_iterator& operator++() { ++sink; return *this; }
     292        output_iterator& operator++()
     293        {
     294            if (NULL == buffer)
     295                ++sink;           // increment only if not buffering
     296            return *this;
     297        }
    293298        output_iterator operator++(int)
    294299        {
     
    446451    };
    447452
     453    ///////////////////////////////////////////////////////////////////////////
     454    template <typename Sink>
     455    bool sink_is_good(Sink const& sink)
     456    {
     457        return true;      // the general case is always good
     458    }
     459
     460    template <typename OutputIterator, typename Derived>
     461    bool sink_is_good(output_iterator<OutputIterator, Derived> const& sink)
     462    {
     463        return sink.good(); // our own output iterators are handled separately
     464    }
     465
    448466}}}}
    449467
  • trunk/boost/spirit/home/karma/nonterminal/rule.hpp

    r54648 r54796  
    4141    BOOST_PP_REPEAT(SPIRIT_ATTRIBUTES_LIMIT, SPIRIT_USING_ATTRIBUTE, _)
    4242
     43    using spirit::_pass;
    4344    using spirit::_val;
    4445    using spirit::_a;
  • trunk/boost/spirit/home/karma/operator/kleene.hpp

    r54789 r54796  
    1 //  Copyright (c) 2001-2007 Joel de Guzman
     1  //  Copyright (c) 2001-2007 Joel de Guzman
    22//  Copyright (c) 2001-2009 Hartmut Kaiser
    33//
     
    1515#include <boost/spirit/home/karma/generator.hpp>
    1616#include <boost/spirit/home/karma/meta_compiler.hpp>
     17#include <boost/spirit/home/karma/detail/output_iterator.hpp>
    1718#include <boost/spirit/home/support/info.hpp>
    1819#include <boost/spirit/home/support/unused.hpp>
     
    7576                result = subject.generate(sink, ctx, d, traits::deref(it));
    7677            }
    77             return sink.good();
     78            return detail::sink_is_good(sink);
    7879        }
    7980
  • trunk/boost/spirit/home/karma/operator/plus.hpp

    r54789 r54796  
    1515#include <boost/spirit/home/karma/generator.hpp>
    1616#include <boost/spirit/home/karma/meta_compiler.hpp>
     17#include <boost/spirit/home/karma/detail/output_iterator.hpp>
    1718#include <boost/spirit/home/support/info.hpp>
    1819#include <boost/spirit/home/support/unused.hpp>
     
    7980                result = subject.generate(sink, ctx, d, traits::deref(it));
    8081            }
    81             return sink.good();
     82            return detail::sink_is_good(sink);
    8283        }
    8384
  • trunk/boost/spirit/home/support/container.hpp

    r53791 r54796  
    273273    compare(unused_type*, unused_type*)
    274274    {
    275         return true;
     275        return false;
     276    }
     277
     278    inline bool
     279    compare(unused_type const*, unused_type const*)
     280    {
     281        return false;
    276282    }
    277283
Note: See TracChangeset for help on using the changeset viewer.