Boost logo

Boost :

Subject: Re: [boost] [iostreams] array and gzip_decompressor
From: Chris Hamilton (chamilton_at_[hidden])
Date: 2010-03-01 10:40:28


Ahh... my bad for misreading ;)

Rather than patching things this way, you could always use the
array_source device defined in <boost/iostreams/device/array.hpp>. A
very simple wrapper can also be written around a std::vector, or you can
use the array_source directly on the internal data of the std::vector.

You then use a filtered_source, and push back the gzip_decompressor
followed by the array_source, like the earlier example in this thread.

Cheers,

Chris

> Thank you eg, Chris,
>
> But I have probably misled you a bit with my post.
> The gzipped data is actually in memory (inside the storage variable),
> and I wanted to have a gzip_decompressing stream from that.
>
> for no I am using this patch
>
>
> Index: detail/adapter/direct_adapter.hpp
> ===================================================================
> --- detail/adapter/direct_adapter.hpp (revision 59992)
> +++ detail/adapter/direct_adapter.hpp (working copy)
> @@ -116,6 +116,7 @@
> std::streamsize write(const char_type* s, std::streamsize n);
> std::streampos seek( stream_offset, BOOST_IOS::seekdir,
> BOOST_IOS::openmode = BOOST_IOS::in |
> BOOST_IOS::out );
> + bool putback(const char_type c);
> void close();
> void close(BOOST_IOS::openmode which);
> #ifndef BOOST_IOSTREAMS_NO_LOCALE
> @@ -204,6 +205,18 @@
> }
>
> template<typename Direct>
> +inline bool direct_adapter<Direct>::putback
> + (const char_type c)
> +{
> + pointers& get = ptrs_.first();
> + if( get.ptr == get.beg )
> + throw bad_putback();
> + get.ptr -= 1;
> + *get.ptr = c;
> + return true;
> +}
> +
> +template<typename Direct>
> inline std::streamsize direct_adapter<Direct>::write
> (const char_type* s, std::streamsize n)
> {
>
>
>
> Nikolay Mladenov
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk