[iostreams] Any simple examples on implementing a Symmetric_filter?

Hi all, I'm new to the iostreams library. It looks pretty cool. We have a bunch of existing objects which already have interfaces for reading and writing their state to a stream, e.g. MyWrite(std::ostream &out) and MyRead(std::istream &in) I've convinced myself I can filter these with iostreams, as I prototyped setting up a filtering stream with an existing gzip_compressor() filter, then reversed it with a gzip_decompressor(). Nice. Now, what I want to do is write my own filter, and thought that a symmetric_filter met my needs based on the description. Unfortunately, there are no simple examples in the tutorial section, and the documentation seems a bit weaker in this area. As a first kick at the can, reading the zlib/bzip implementations is a bit dense to pick out the nuances. Does anyone have an identity_filter example (based on symmetric_filter) that just copies input to output characters? ... or given some dumb c function like the following, how to construct a symmetric_filter using it. my_dumb_crypt(char* in, char* out, char *pwd, int len) { for (int i=0; i < len; ++i) // assumes in, out, and pwd are len long out[i] = in[i] ^ pwd[i]; } Thanks. eg
participants (1)
-
eg