I was talking to Fruny earlier on IRC and he happened to mention a cool new library in boost, an IOStreams library.
"Big deal", you might think, "C++ already has one", and yes it does, however this builds on top of it enabling you filter content and treat different things as sources/sinks. For example you can compress/decompress data to a file on the fly using normal stream operations!
Having read around the library a bit I've decided that this truely is a gold mine. When it comes to loading data up all I need todo is select the right filter, drop it into the stream and then read like any other bit of data! The rest of the functionality would be encapslated in a class so its nicely out of the way and keep the main decoding code pretty stream lined.
From an extensibilty point of view this means you can literally add a class type and a tag to a table and the code will automagically look up the correct decoding filter.
This will also work seemlessly with custom stream based readers as this would hook into the chain AFTER the rest has taken place.
I've also been giving some thought to how this can interface with custom C streams, wrapping things in a custom stream class also seems like a good way forward here, this would allow functions which could take a file pointer, a custom reading function or a filter pointer and custom reading function, glue it into one standard stream interface and pass it down to the main code. At which point the filtering kicks in and all is good.
For custom C++ reader it will basically do the same thing, custom function, stream objects and with the addition of this custom boost::iostream object as well will probably be used.
Anyways, I need to investigate this library some more and then begin working on how to intergrate all the data reading function into sane classes with buffered reading.
Hopefully tomorrow I'll have some good news to report, if not expect more later next week [smile]