TpCompress 类
V0.2.1TpExtUtils
2025-11-14
基础信息
| 头文件: | include <TpCompress.h> |
|---|---|
| Cmake: | None |
| 发布版本: | V0.2.1 |
| 继承类: | |
| 派生类: |
Public 类型
enum TpCompress::TpCompressFormat
| 名称 | 值 | 描述 |
|---|---|---|
| TP_FORMAT_NONE | 0 | |
| TP_FORMAT_ZIP | 1 | |
| TP_FORMAT_RAR | 2 | |
| TP_FORMAT_7ZIP | 3 | |
| TP_FORMAT_ISO | 4 | |
| TP_FORMAT_PAX | 5 | |
| TP_FORMAT_RAW | 6 | |
| TP_FORMAT_TAR | 7 | |
| TP_FORMAT_AR | 8 | |
| TP_FORMAT_XAR | 9 | |
| TP_FORMAT_WARC | 10 | |
| TP_FORMAT_SHAR | 11 | |
| TP_FORMAT_TARGZ | 12 | |
| TP_FORMAT_TARBZ2 | 13 |
enum TpCompress::TpCompressFilter
| 名称 | 值 | 描述 |
|---|---|---|
| TP_FILTER_NONE | 0 | |
| TP_FILTER_GZIP | 1 | |
| TP_FILTER_BZIP2 | 2 | |
| TP_FILTER_XZ | 3 | |
| TP_FILTER_LZMA | 4 | |
| TP_FILTER_LZOP | 5 | |
| TP_FILTER_LZ4 | 6 | |
| TP_FILTER_ZSTD | 7 |
enum TpCompress::TpCompressType
| 名称 | 值 | 描述 |
|---|---|---|
| TP_TAR | 0 | tar格式打包 |
| TP_TAR_GZIP | 1 | tzr.gz格式压缩 |
| TP_TAR_BZIP2 | 2 | bzip格式压缩 |
| TP_TAR_XZ | 3 | tag.xz格式 |
| TP_TAR_LZMA | 4 | tar.lzma格式 |
| TP_TAR_LZOP | 5 | tar.lzop格式 |
| TP_TAR_LZ4 | 6 | tar.lz4格式 |
| TP_TAR_ZSTD | 7 | tar.zstd格式 |
| TP_AR | 8 | ar格式 |
| TP_AR_GZIP | 9 | ar.gz格式 |
| TP_AR_BZIP2 | 10 | ar.gz格式 |
| TP_AR_XZ | 11 | ar.xz格式 |
| TP_AR_LZMA | 12 | lzma格式 |
| TP_AR_LZOP | 13 | lzop格式 |
| TP_AR_LZ4 | 14 | lz4格式 |
| TP_AR_ZSTD | 15 | zstd格式 |
| TP_XAR | 16 | xar格式 |
| TP_XAR_GZIP | 17 | gz格式 |
| TP_XAR_BZIP2 | 18 | bz格式 |
| TP_XAR_XZ | 19 | xz格式 |
| TP_XAR_LZMA | 20 | lzma格式 |
| TP_XAR_LZ4 | 21 | lz4格式 |
| TP_XAR_LZOP | 22 | lzop格式 |
| TP_XAR_ZSTD | 23 | zstd格式 |
| TP_ZIP | 24 | zip格式 |
| TP_7ZIP | 25 | 7z格式 |
Public 成员函数
| TpCompress() | ||
|---|---|---|
| ~TpCompress() | ||
| addToCompress(const TpString &path_s, const TpString path_t, TpCompressType type=TP_ZIP) | 压缩文件 | |
| addToCompress(const TpString &path_s, const TpString path_t, const TpString pwd, const TpCompressFormat &type, const TpCompressFilter &filter) | 压缩文件 | |
| extractfromCompress(const TpString &path_s, const TpString &path_t) | 解压 |
成员函数说明
TpCompress::TpCompress()
暂无注释...
TpCompress::~TpCompress()
暂无注释...
int TpCompress::addToCompress(const TpString &path_s, const TpString path_t, TpCompressType type=TP_ZIP)
压缩文件...
压缩文件
参数:path_s: 源文件(末尾有/会遍历该目录下所有文件打包)
参数:path_t: 目标文件(目标文件目录需要存在)
参数:type: 压缩类型
返回值:压缩成功返回0,失败返回-1
int TpCompress::addToCompress(const TpString &path_s, const TpString path_t, const TpString pwd, const TpCompressFormat &type, const TpCompressFilter &filter)
压缩文件...
压缩文件
参数:path_s: 源文件(末尾有/会遍历该目录下所有文件打包)
参数:path_t: 目标文件(目标文件目录需要存在)目标文件(目标文件目录需要存在)
参数:pwd: 压缩密码(当前默认没有密码)
参数:type: 归档格式
参数:filter: 压缩格式
返回值:压缩成功返回0,失败返回-1
int TpCompress::extractfromCompress(const TpString &path_s, const TpString &path_t)
解压...
解压
参数:path_s: 源文件
参数:path_t: 目标文件
返回值:解压成功返回0,失败返回-1
