From: Daryle Walker (darylew_at_[hidden])
Date: 2001-01-20 14:12:20
on 1/19/01 9:13 AM, Joe Mariadassou at JMariadassou_at_[hidden] wrote:
> Does anybody have a sample of how to use boost::basic_passthrubuf? I am
> writing a simple filter to convert a data stream to base64. If I use
> passthrubuf I'll have to override every virtual function that it overrides;
> which doesn't make sense.
This is for the package I have at
http://www.egroups.com/files/boost/more_io.zip, right? Are you using the
current version (4)? This is the first time I've heard of anyone using my
stuff, although it's still in progress.
It doesn't make sense; you shouldn't have to override every virtual
function. I did all the overrides so you wouldn't have to! The problem
with other sample filtering streambuf classes I've seen is that they only
override the reading or writing methods (to call the inner streambuf's
version of the method). The other methods do their defaults of doing
nothing and possibly returning zero or failure, since they're not
overridden. The lack of overrides makes objects of those streambuf classes
crippled if you do something besides reading or writing. I made the
pass-through streambuf class to pass _all_ virtual methods to the
corresponding method of the inner streambuf. You just override the methods
you want, and all the others are enabled to do the right thing
Where did you get the impression that every method had to be overridden?
Let me know so I can correct the code and/or docs.
As for an example, I should probably add one for version 5. (The main
problem is that I'm not an expert, so I don't know how to make good test
-- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk