- Joined
- Nov 25, 2007
- Messages
- 1,665
- Reaction score
- 13
- Points
- 38
- Location
- Germany
- Website
- www.enderspace.de
- Preferred Pronouns
- Can't you smell my T levels?
Here it is. Notice that since the actual operation is encapsulated in a function, the Boost headers are not used directly, hence won't be reincluded in your files, thus not slowing down the incremental compilation.Martins, the elevation and texture data compress pretty nicely (~50%). Would you consider loading the data by decompressing them from zip files on the fly? I could give you some working code for doing this, if you like (Boost based).
PHP:
#include <istream>
#include <string>
class Zipping
{
public:
void UnzipFile(const std::string & zipFileName, std::stringstream & sstrOut) const;
protected:
private:
};
PHP:
#include "Zipping.hpp"
#include <fstream>
#include <sstream>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/zlib.hpp>
#include <boost/iostreams/filter/gzip.hpp>
void Zipping::UnzipFile(const std::string & zipFileName, std::stringstream & sstrOut) const
{
namespace bio = boost::iostreams;
std::ifstream file(zipFileName, std::ios_base::binary);
bio::filtering_streambuf<bio::input> in;
in.push(bio::zlib_decompressor()); // Windows
//in.push(bio::gzip_decompressor()); // Linux
in.push(file);
bio::copy(in, sstrOut);
}
Boost said:The zlib Filters depend on the third-party zlib library, which is not included in the Boost distribution. Prebuilt zlib binaries are available on most UNIX and UNIX-like systems, and will be found automatically by the Boost build system. Windows users can obtain prebuilt binaries at the zlib homepage. Users can also configure the Boost Iostream library to build zlib from the source code, which is available at the zlib homepage.
Last edited: