acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
aaa_gz.h
1
/* version: 1.0, Feb, 2003
2
Author : Gao Dasheng
3
Copyright (C) 1995-2002 Gao Dasheng(
[email protected]
)
4
5
This software is provided 'as-is', without any express or implied
6
warranty. In no happening will the authors be held liable for any damages
7
arising from the use of this software.
8
9
Permission is granted to anyone to use this software for any purpose,
10
including commercial applications, and to alter it and redistribute it
11
freely, topic to the following restrictions:
12
13
1. The origin of this software must not be misrepresented; you must not
14
claim that you wrote the original software. If you use this software
15
in a product, an acknowledgment in the product documentation would be
16
appreciated but is not required.
17
2. Altered source versions must be plainly marked as such, and must not be
18
misrepresented as being the original software.
19
3. This notice may not be erased or altered from any source distribution.
21
Introduce:
22
This file includes two classes CA2GZIP and CGZIP2A which do compressing and
23
uncompressing in memory. and It 's very easy to use for small data compressing.
24
Some compress and uncompress codes came from gzip unzip function of zlib 1.1.x.
25
26
Usage:
27
these two classes work used with zlib 1.1.x (http://www.gzip.org/zlib/).
28
They were tested in Window OS.
29
Exmaple:
30
#include "GZipHelper.h"
31
void main()
32
{
33
::i8 plainText[]="Plain text here";
34
CA2GZIP gzip(plainText,strlen(plainText)); // do compressing here;
35
LPGZIP pgzip=gzip.pgzip; // pgzip is zipped data pointer, you can use it directly
36
::i32 len=gzip.Length; // Length is length of zipped data;
37
38
CGZIP2A plain(pgzip,len); // do decompressing here
39
40
char_pointer pplain=plain.psz; // psz is plain data pointer
41
::i32 aLen=plain.Length; // Length is length of unzipped data.
42
}
44
*/
45
46
#pragma once
47
48
class
CLASS_DECL_ACME compress_gz :
49
virtual
public
::matter
50
{
51
public
:
52
53
54
::i32 m_iLevel;
55
56
57
compress_gz(::i32 iLevel = 6);
58
virtual
~compress_gz();
59
60
61
bool
transfer(
::file::file
* pfileOut,
::file::file
* pfileIn);
62
63
64
};
65
66
67
class
CLASS_DECL_ACME uncompress_gz :
68
virtual
public
::matter
69
{
70
public
:
71
72
73
uncompress_gz();
74
virtual
~uncompress_gz();
75
76
77
bool
transfer(
::file::file
* pfileOut,
::file::file
* pfileIn);
78
79
80
};
81
82
83
84
85
::i32 z_compress(
void
* dest, ::u64 * destLen,
const
void
*
source
, ::u64 sourceLen);
86
::i32 z_uncompress(
void
* dest, ::u64 * destLen,
const
void
*
source
, ::u64 sourceLen);
file::file
Definition
file.h:33
source
source is originator of subjects
Definition
source.h:11
aaa_compress1
aaa_gz.h
Generated by
1.17.0