I guess it is too late, but they finally put it. A compression/decompression api in windows which is easy to use. And, with my class, even easier.
The API is a simple set of functions that allow compression or decompression of data. Windows supports a number of algorithms (https://msdn.microsoft.com/en-us/library/windows/desktop/hh920921(v=vs.85).aspx) which we can select in our constructor. Windows also supports block-mode, if you want to control the compressor, which is not a feature in our quick class.
Because the API exists only in Windows 8, all our class calls are dynamic (incidentally, the call uses the template from my One-Line call article) . You can check the static member COMPRESSIONAPI::Available() to see if the API is available. If the API is not available, constructing the object will throw.
Using the code
Easy. You have the constructor (which specifies the compression algorithm, in this case COMPRESS_ALGORITHM_LZMS. Then you have 2 member functions, Compress and Decompress. Both take the buffer to work on, it's size, and a vector<char> to put the result. They return S_OK on success and E_FAIL on error.
Internally, my class tests the API in order to find out the exact size neeeded for the buffer.
16 - 2 - 2015 : First Release
I 've a PhD in Digital Signal Processing and Artificial Intelligence and I specialize in Pro Audio and AI applications.
My home page: https://www.turbo-play.com