commit
bc13f3dbf2
16 changed files with 102 additions and 219 deletions
@ -1,42 +0,0 @@ |
||||
#include "GzHelper.h" |
||||
|
||||
#include "Stacktrace.h" |
||||
|
||||
#include <boost/iostreams/copy.hpp> |
||||
#include <boost/iostreams/filtering_streambuf.hpp> |
||||
namespace bio = boost::iostreams; |
||||
|
||||
#include <sstream> |
||||
using std::stringstream; |
||||
|
||||
GzHelper::GzHelper() { } |
||||
|
||||
GzHelper::~GzHelper() { } |
||||
|
||||
string GzHelper::gzcompress(const string& str, const bio::zlib_params& params) |
||||
{
|
||||
stringstream decompressed; |
||||
decompressed << str; |
||||
|
||||
bio::filtering_istreambuf out; |
||||
out.push(bio::zlib_compressor(params)); |
||||
out.push(decompressed); |
||||
|
||||
stringstream compressed; |
||||
bio::copy(out, compressed); |
||||
return compressed.str(); |
||||
} |
||||
|
||||
string GzHelper::gzuncompress(const string& str) |
||||
{ |
||||
stringstream compressed; |
||||
compressed << str; |
||||
|
||||
bio::filtering_istreambuf in; |
||||
in.push(bio::zlib_decompressor()); |
||||
in.push(compressed); |
||||
|
||||
stringstream decompressed; |
||||
bio::copy(in, decompressed); |
||||
return decompressed.str(); |
||||
} |
||||
@ -1,29 +0,0 @@ |
||||
/*
|
||||
* Xournal++ |
||||
* |
||||
* Helper functions for ZLib GZip Compression |
||||
* |
||||
* @author Xournal++ Team |
||||
* https://github.com/xournalpp/xournalpp
|
||||
* |
||||
* @license GNU GPLv2 or later |
||||
*/ |
||||
|
||||
#pragma once |
||||
|
||||
#include <boost/iostreams/filter/gzip.hpp> |
||||
namespace bio = boost::iostreams; |
||||
|
||||
#include <string> |
||||
using std::string; |
||||
|
||||
class GzHelper |
||||
{ |
||||
private: |
||||
GzHelper(); |
||||
virtual ~GzHelper(); |
||||
|
||||
public: |
||||
static string gzcompress(const string& str, const bio::zlib_params& = bio::zlib::default_compression); |
||||
static string gzuncompress(const string& str); |
||||
}; |
||||
Loading…
Reference in new issue