Boost logo

Boost Users :

Subject: Re: [Boost-users] Iostreams: how can I control my (ostream) filter?
From: Sylro (syrmonsieur_at_[hidden])
Date: 2014-11-16 15:06:55


Hi Akim.

I see what you're trying to do : sync up to the filter, but not beyond,
would be a simple solution.
However boost::iostreams::flush() will always flush everything, up to the
final device.

For the demonstration, if you use this dummy_sink :

class dummy_sink
{
public:
    typedef char char_type;
    struct category : public boost::iostreams::sink_tag, public
boost::iostreams::flushable_tag {};

    std::streamsize write(const char* s, std::streamsize n)
    {
        std::cout << "{" << std::string(s, s + n) << "}";
        return n;
    }

    bool flush()
    {
        std::cout << " FLUSH ";
        std::cout.flush();
        return true;
    }
};

With this example :
    {
        bos_ << " [label = \"";
        enable_();
        bos_ << "bla\\abla" << 1 << 2 << 3 << "blabla";
        disable_();
        bos_ << "\", shape = box";
    }

Then the output looks like:
    { [label = "}
    FLUSH
    {bla\\abla123blabla}
    FLUSH
    {", shape = box}
    FLUSH
    FLUSH
    FLUSH
    FLUSH
    FLUSH
    FLUSH
    FLUSH

--
View this message in context: http://boost.2283326.n4.nabble.com/Iostreams-how-can-I-control-my-ostream-filter-tp4668716p4669102.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net