|
Boost Users : |
From: gyrotech_at_[hidden]
Date: 2007-08-03 06:45:05
Hello all.
I am trying to create a wrapper for a set of resources (mixed text,
image, etc files) for use in an SDL-based application.
I want to use iostreams and keep it as close to C++ as I can, but SDL
uses some functions that load data from c-type file pointers or a
location in memory using a void* and byte-count.
Is it possible to define a method of file access using iostreams and a
filter that will then let me create sub-streams of the data inside??
For instance - a zlib-compressed file called 'foobar.gz' that contains
'foo.txt' and 'bar.png'.
I want to attach an iostream to foobar.gz then use functions to get
the contents in different formats, e.g.
stream<my_res_file> compressed_file( "foobar.gz" );
ifstream foo = compressed_file.getasfilestream( "foo.txt" );
// read stuff from foo
foo.close();
char* img_data;
unsigned long size;
compressed_file.getasmembuffer( img_data, &size );
// read img_data and poke around with it
delete[] img_data;
I know the above is just for illustration, but I can't find any libs
that do this sort of work. I am having some real problems now even at
the design stage, for instance how to neatly pack multiple files into
a single one. My packed-file headers always seem to go wrong and
without fixed-length space for files names it gets even more painful :-)
If this isn't the right place for this sort of question (I see it's
far more conceptual than directly boost-related) then I apologise and
will start hitting on some more generic forums and lists ;-)
Thanks for your time,
GT
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net