
Jonathan Turkanis wrote:
This is a nice idea. IMO, the best way to implement it would be as a filter -- perhaps you could call it a stream_signature_filter. You might use it as follows:
stream_signature_filter f; f.push("GZIP", gzip_decompressor()); f.push("BZh", bzip2_decompressor()); filtering_istreambuf in(f); in.push(file("archive.tar.gz"));
You could then define filters derived from stream_signature_filter that have preset mappings from signatures to filters.
This sounds better, but was beyond my Boost knowledge. ( For the m-l archive, I noticed my xsgetn() doesn't decrement the n variable correctly. ) Then again, perhaps the stream_signature_filter should just try out each decompressor in turn, and whichever does not throw an exception should be allowed to continue. Please allow it to stream through unknown compression schemes, especially uncompressed files :-)
I'll add this to my list of ideas of 1.34.
Excellent, thank you! Marcus