acl/lib_acl_cpp/include/acl_cpp/stdlib/zlib_stream.hpp

292 lines
8.8 KiB
C++
Raw Normal View History

#pragma once
2017-06-02 14:47:24 +08:00
#include "../acl_cpp_define.hpp"
#include "pipe_stream.hpp"
2014-11-19 00:25:21 +08:00
typedef struct z_stream_s z_stream;
namespace acl {
/**
* ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>ٶȼ<EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>ȵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>ʽ
* <EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD>ֵԽ<EFBFBD>ߣ<EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣬵<EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>ٶȻ<EFBFBD>Խ<EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
*/
typedef enum
{
zlib_default = -1, // ȱʡ<C8B1><CAA1>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
zlib_level0 = 0, // <20><><EFBFBD>͵<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD>Dz<EFBFBD>ѹ<EFBFBD><D1B9>
zlib_best_speed = 1, // ѹ<><D1B9><EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
zlib_level1 = zlib_best_speed,
zlib_level2 = 2,
zlib_level3 = 3,
zlib_level4 = 4,
zlib_level5 = 5,
zlib_level6 = 6,
zlib_level7 = 7,
zlib_level8 = 8,
zlib_best_compress = 9, // <20><><EFBFBD>ߵ<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD>͵<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD>ٶ<EFBFBD>
2014-11-19 00:25:21 +08:00
zlib_level9 = zlib_best_compress
} zlib_level_t;
/**
* ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>ֵԽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>Խ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>Խ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щֵ<EFBFBD>ĸ<EFBFBD>ֵ<EFBFBD><EFBFBD>-zlib_wbits_t
*/
enum
{
zlib_wbits_8 = 8,
zlib_wbits_9 = 9,
zlib_wbits_10 = 10,
zlib_wbits_11 = 11,
zlib_wbits_12 = 12,
zlib_wbits_13 = 13,
zlib_wbits_14 = 14,
zlib_wbits_15 = 15,
};
/**
* ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>ֵԽ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>Խ<EFBFBD><EFBFBD>
*/
typedef enum
{
zlib_mlevel_1 = 1,
zlib_mlevel_2 = 2,
zlib_mlevel_3 = 3,
zlib_mlevel_4 = 4,
zlib_mlevel_5 = 5,
zlib_mlevel_6 = 6,
zlib_mlevel_7 = 7,
zlib_mlevel_8 = 8,
zlib_mlevel_9 = 9,
} zlib_mlevel_t;
2014-11-19 00:25:21 +08:00
/**
* ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĻ<EFBFBD><EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>˻<EFBFBD><EFBFBD>ñȽϸߵ<EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>Ӧ<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD> zlib_flush_off <EFBFBD><EFBFBD>ʽ
2014-11-19 00:25:21 +08:00
*/
typedef enum
{
zlib_flush_off = 0, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
zlib_flush_partial = 1, // ˢ<>²<EFBFBD><C2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
zlib_flush_sync = 2, // ͬ<><CDAC>ˢ<EFBFBD><CBA2>
zlib_flush_full = 3, // <20><>ȫˢ<C8AB><CBA2>
zlib_flush_finish = 4 // <20><>ȫˢ<C8AB>²<EFBFBD>ֹͣѹ<D6B9><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
} zlib_flush_t;
class string;
class ACL_CPP_API zlib_stream : public pipe_stream
{
public:
zlib_stream(void);
~zlib_stream(void);
2014-11-19 00:25:21 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽѹ<EFBFBD><EFBFBD>
* @param in {const char*} Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param len {int} Դ<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
* @param out {string*} <EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param level {zlib_level_t} ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>𣬼<EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD>ߣ<EFBFBD>
* <EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>Խ<EFBFBD><EFBFBD>
* @return {bool} ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
2014-11-19 00:25:21 +08:00
*/
bool zlib_compress(const char* in, int len, string* out,
zlib_level_t level = zlib_default);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD>
* @param in {const char*} Դѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param len {int} Դ<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
* @param out {string*} <EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param have_zlib_header {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD> zlib_header ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ϊ false
* @param wsize {int} <EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>С
* @return {bool} <EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
2014-11-19 00:25:21 +08:00
*/
bool zlib_uncompress(const char* in, int len, string* out,
bool have_zlib_header = true, int wsize = 15);
///////////////////////////////////////////////////////////////
//
// <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ʽѹ<CABD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
//
///////////////////////////////////////////////////////////////
/**
* <EFBFBD><EFBFBD>ʼѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD>
* zip_begin->zip_update->zip_finish<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD>κ<EFBFBD>һ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD> zip_reset
* @param level {zlib_level_t} ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>𣬼<EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD>ߣ<EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* Խ<EFBFBD>ߣ<EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>Խ<EFBFBD><EFBFBD>
* @param wbits {zlib_wbits_t} ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵԽ<EFBFBD><EFB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21 +08:00
*/
bool zip_begin(zlib_level_t level = zlib_default,
int wbits = zlib_wbits_15,
zlib_mlevel_t mlevel = zlib_mlevel_9);
2014-11-19 00:25:21 +08:00
/**
* ѭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD>
* @param in {const char*} Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param len {int} Դ<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
* @param out {string*} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӷ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
* <EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϵ<EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* ǰ<EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD>ɸú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBF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EFBFBD>ܻᲿ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* zlib_flush_sync: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* zlib_flush_full: <EFBFBD><EFBFBD> zlib <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* zlib_flush_finish: <EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> zip_finish <EFBFBD>󣬻<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ʧ<EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
*/
bool zip_update(const char* in, int len, string* out,
zlib_flush_t flag = zlib_flush_off);
/**
* <EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD><EFBFBD><EFBFBD>
* @param out {string} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD> zlib <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵķ<EFBFBD>ʽ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
2014-11-19 00:25:21 +08:00
*/
bool zip_finish(string* out);
/**
* <EFBFBD>ж<EFBFBD>ѹ<EFBFBD><EFBFBD>/<EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool}
*/
bool is_finished(void) const
{
return finished_;
}
2014-11-19 00:25:21 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ֻ<EFBFBD>е<EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Ż<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
2014-11-19 00:25:21 +08:00
*/
bool zip_reset(void);
2014-11-19 00:25:21 +08:00
2015-08-22 18:05:46 +08:00
/**
* <EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD>ʹ<EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD> crc32 У<EFBFBD><EFBFBD>ֵ
* @param n {unsigned} <EFBFBD>ϴμ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>д 0
* @param buf {const void*} <EFBFBD><EFBFBD>ҪУ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ʱд NULL
* @param dlen {size_t} buf <EFBFBD><EFBFBD><EFBFBD>ݵij<EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ʱд 0
* @return {unsinged} <EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
2015-08-22 18:05:46 +08:00
*/
unsigned crc32_update(unsigned n, const void* buf, size_t dlen);
2014-11-19 00:25:21 +08:00
/**
* <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD>
* unzip_begin->unzip_update->unzip_finish<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD>κ<EFBFBD>һ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD> unzip_reset
* @param have_zlib_header {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD> zlib_header ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ϊ false
* @param wsize {int} <EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>С
* @return {bool} <EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܵ<EFBFBD>ԭ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
* Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>
2014-11-19 00:25:21 +08:00
*/
bool unzip_begin(bool have_zlib_header = true, int wsize = 15);
/**
* ѭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD>н<EFBFBD>ѹ<EFBFBD><EFBFBD>
* @param in {const char*} ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param len {int} Դ<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
* @param out {string*} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><E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BFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><EFBFBD>ʽ
* zlib_flush_off: <EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* zlib <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD>µķ<EFBFBD>ʽ
* zlib_flush_partial: <EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܻᲿ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* zlib_flush_sync: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* zlib_flush_full: <EFBFBD><EFBFBD> zlib <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* zlib_flush_finish: <EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> zip_finish <EFBFBD>󣬻<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ʧ<EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
*/
bool unzip_update(const char* in, int len, string* out,
zlib_flush_t flag = zlib_flush_off);
/**
* <EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD><EFBFBD><EFBFBD>
* @param out {string} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD> zlib <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵķ<EFBFBD>ʽ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
2014-11-19 00:25:21 +08:00
*/
bool unzip_finish(string* out);
/**
* <EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ֻ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Ż<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
2014-11-19 00:25:21 +08:00
*/
bool unzip_reset(void);
2014-11-19 00:25:21 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><EFBFBD> zstream <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {z_stream*}
*/
z_stream* get_zstream(void) const
{
return zstream_;
}
2015-08-22 18:05:46 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ȫ·<EFBFBD><EFBFBD>
2015-08-22 18:05:46 +08:00
*/
static void set_loadpath(const char* path);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ·<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ·<EFBFBD><EFBFBD>
* @return {const char*} <EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>򷵻<EFBFBD> NULL
2015-08-22 18:05:46 +08:00
*/
static const char* get_loadpath(void);
/**
* <EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD> zlib <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EF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once(void);
2015-08-22 18:05:46 +08:00
2014-11-19 00:25:21 +08:00
///////////////////////////////////////////////////////////////
bool pipe_zip_begin(zlib_level_t level = zlib_default,
zlib_flush_t flag = zlib_flush_off);
bool pipe_unzip_begin(zlib_flush_t flag = zlib_flush_off);
// pipe_stream <20><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
virtual int push_pop(const char* in, size_t len,
string* out, size_t max = 0);
virtual int pop_end(string* out, size_t max = 0);
virtual void clear(void);
2014-11-19 00:25:21 +08:00
private:
z_stream* zstream_;
bool finished_;
bool is_compress_;
zlib_flush_t flush_;
bool update(int (*func)(z_stream*, int), zlib_flush_t flag,
const char* in, int len, string* out);
bool flush_out(int (*func)(z_stream*, int),
zlib_flush_t flag, string* out);
};
} // namespace acl