Support reading from generic stream objects.
Posted: Thu Apr 01, 2010 05:31
I haven't been keeping up much with the CEGUI development so I don't know if this is already present in 0.7x. I've kept up with the Secret Maryo project and even submitted a few patches to it myself. One of the topics discussed was the ability to compress level files. The project writes XML files directly so can easily add a compression layer, but uses CEGUI to read the XML. I had and idea for a feature for CEGUI, if it could read not only from files, but from any generic stream object that had a read method, not only for XML files, but images and anything else needed. Perhaps load methods could take a object such as CEGUI::InputStream derived object with a member Read(void* buf, size_t bytes). Or maybe even some type of all-out virtual file system (for instance so all CEGUI items, image sets, layouts, etc could be stored in a zip file, and if an XML file references an image set relatively, it would access it with the appropriate file system decoder or application defined file system decoder.
I'm not sure how such would be implemented. Perhaps a unique string could be used, such as file:///path/to/zip#zip:///path/to/entry, this would use a file decoder for reading /path/to/zip, and create a zip decoder wrapping that file decoder and set to read /path/to/entry from the file. Well, I don't know how it could really be implemented, but it would be a nice feature to be able to load resources from any application-defined stream and not just directly from disk.
I'm not sure how such would be implemented. Perhaps a unique string could be used, such as file:///path/to/zip#zip:///path/to/entry, this would use a file decoder for reading /path/to/zip, and create a zip decoder wrapping that file decoder and set to read /path/to/entry from the file. Well, I don't know how it could really be implemented, but it would be a nice feature to be able to load resources from any application-defined stream and not just directly from disk.