ZFFramework
 
Loading...
Searching...
No Matches
ZFCompress.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFCompress_h_
7#define _ZFI_ZFCompress_h_
8
9#include "ZFAlgorithmDef.h"
11
16 ZFENUM_VALUE(NoCompress)
17 ZFENUM_VALUE(BestSpeed)
18 ZFENUM_VALUE(GoodSpeed)
20 ZFENUM_VALUE(GoodCompress)
21 ZFENUM_VALUE(BestCompress)
23 ZFENUM_VALUE_REGISTER(NoCompress)
24 ZFENUM_VALUE_REGISTER(BestSpeed)
25 ZFENUM_VALUE_REGISTER(GoodSpeed)
27 ZFENUM_VALUE_REGISTER(GoodCompress)
28 ZFENUM_VALUE_REGISTER(BestCompress)
31
33zfabstract ZFLIB_ZFAlgorithm ZFCompressToken : zfextend ZFIOToken {
34 ZFOBJECT_DECLARE_ABSTRACT(ZFCompressToken, ZFIOToken)
35
36#if 0
37public:
38 virtual zfstring pathType(void) zfpurevirtual;
39 virtual zfstring pathData(void) zfpurevirtual;
41public:
42 virtual zfbool ioClose(void) zfpurevirtual;
43#endif
44
45public:
47 virtual zfbool ioRead(
49 , ZF_IN const zfstring &itemPath
52 virtual zfbool ioWrite(
54 , ZF_IN const ZFInput &input
56
61
67 virtual zfbool ioMove(
68 ZF_IN const zfstring &itemPathFrom
69 , ZF_IN const zfstring &itemPathTo
71
75 , ZF_IN const zfstring &itemPath
81
84 return this->itemIndex(itemPath) != zfindexMax();
85 }
86
90
97 zfstring ret;
98 if(this->itemPathT(ret, itemIndex)) {
99 return ret;
100 }
101 else {
102 return zfnull;
103 }
104 }
105
110
111private:
113 virtual zfindex ioRead(
114 ZF_OUT void *buf
115 , ZF_IN zfindex maxByteSize
116 ) {
118 return 0;
119 }
121 virtual zfindex ioWrite(
122 ZF_IN const void *src
123 , ZF_IN_OPT zfindex maxByteSize = zfindexMax()
124 ) {
126 return 0;
127 }
129 virtual zfbool ioSeek(
130 ZF_IN zfindex byteSize
131 , ZF_IN_OPT ZFSeekPos seekPos = ZFSeekPosBegin
132 ) {
134 return zffalse;
135 }
137 virtual zfindex ioTell(void) {
139 return zfindexMax();
140 }
142 virtual zfindex ioSize(void) {
144 return zfindexMax();
145 }
146};
147
148// ============================================================
180 , ZFMP_IN(const ZFPathInfo &, pathInfo)
184
185// ============================================================
186// util
189 , ZFMP_IN_OUT(const ZFPathInfo &, outputCompress)
190 , ZFMP_IN_OUT(const ZFInput &, inputRaw)
191 , ZFMP_IN_OPT(const zfstring &, itemPath, zftext("content"))
192 , ZFMP_IN_OPT(ZFCompressLevel, compressLevel, v_ZFCompressLevel::EnumDefault())
196 , ZFMP_IN_OUT(const ZFOutput &, outputRaw)
197 , ZFMP_IN_OUT(const ZFPathInfo &, inputCompress)
198 , ZFMP_IN_OPT(const zfstring &, itemPath, zftext("content"))
200
233 , ZFMP_IN_OUT(const ZFPathInfo &, outputCompress)
234 , ZFMP_IN(const ZFPathInfo &, inputPathInfo)
235 , ZFMP_IN_OPT(const zfstring &, itemPath, zfnull)
237 , ZFMP_IN_OPT(ZFCompressLevel, compressLevel, v_ZFCompressLevel::EnumDefault())
241 , ZFMP_IN(const ZFPathInfo &, outputPathInfo)
242 , ZFMP_IN_OUT(const ZFPathInfo &, inputCompress)
244
246#endif // #ifndef _ZFI_ZFCompress_h_
247
global header for ZFAlgorithm module
#define ZFLIB_ZFAlgorithm
used to export symbols
Definition ZFAlgorithmDef.h:14
v_ZFCompressLevel::ZFEnumType ZFCompressLevel
see v_ZFCompressLevel
Definition ZFCompress.h:29
zfautoT< ZFCompressToken > ZFCompressOpen(const ZFPathInfo &pathInfo, ZFIOOpenOptionFlags flags, ZFCompressLevel compressLevel=(v_ZFCompressLevel::EnumDefault()))
open compress file for read or write
zfbool ZFDecompressFile(const ZFOutput &outputRaw, const ZFPathInfo &inputCompress, const zfstring &itemPath=(zfstring::shared("content")))
see ZFCompressOpen
zfbool ZFDecompressDir(const ZFPathInfo &outputPathInfo, const ZFPathInfo &inputCompress)
see ZFCompressOpen
zfbool ZFCompressDir(const ZFPathInfo &outputCompress, const ZFPathInfo &inputPathInfo, const zfstring &itemPath=(zft_zfnull), ZFIOOpenOptionFlags flags=(v_ZFIOOpenOption::e_Modify), ZFCompressLevel compressLevel=(v_ZFCompressLevel::EnumDefault()))
see ZFCompressOpen
zfbool ZFCompressFile(const ZFPathInfo &outputCompress, const ZFInput &inputRaw, const zfstring &itemPath=(zfstring::shared("content")), ZFCompressLevel compressLevel=(v_ZFCompressLevel::EnumDefault()))
see ZFCompressOpen
#define ZFCoreCriticalNotSupported()
log that likes "[file function (line)] not supported"
Definition ZFCoreLog_CommonLog.h:143
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfpurevirtual
dummy macro shows that a method is pure virtual method
Definition ZFCoreTypeDef_ClassType.h:68
#define zfoverride
dummy macro shows that method override parent's method
Definition ZFCoreTypeDef_ClassType.h:58
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:184
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:188
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:196
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
#define zfindexMax()
(zfindex)-1, indicate a max index value, see zfindex
Definition ZFCoreTypeDef_CoreType.h:159
#define zffalse
bool false type
Definition ZFCoreTypeDef_CoreType.h:111
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
ZFSeekPos
seek position similar to SEEK_SET of FILE operation
Definition ZFCoreTypeDef_OtherType.h:47
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZFENUM_SEPARATOR()
see ZFENUM_BEGIN
Definition ZFEnumDeclare.h:158
#define ZFENUM_VALUE_REGISTER(Value)
see ZFENUM_BEGIN
Definition ZFEnumDeclare.h:168
#define ZFENUM_REG(ZFLIB_, EnumName,...)
see ZFENUM_BEGIN
Definition ZFEnumDeclare.h:186
#define ZFENUM_END_WITH_DEFAULT(ZFLIB_, EnumName, defaultEnum)
see ZFENUM_BEGIN
Definition ZFEnumDeclare.h:175
#define ZFENUM_VALUE(Value)
see ZFENUM_BEGIN
Definition ZFEnumDeclare.h:151
#define ZFENUM_BEGIN(ZFLIB_, EnumName)
macros to define reflectable enum type
Definition ZFEnumDeclare.h:147
#define ZFMP_IN_OUT(ParamType, paramName)
see ZFMP_IN
Definition ZFMethod.h:117
#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue)
see ZFMP_IN
Definition ZFMethod.h:108
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMETHOD_FUNC_DECLARE_5(ZFLIB_, ReturnType, MethodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:1228
#define ZFMETHOD_FUNC_DECLARE_2(ZFLIB_, ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:763
#define ZFMETHOD_FUNC_DECLARE_3(ZFLIB_, ReturnType, MethodName, ZFMP_0, ZFMP_1, ZFMP_2)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:910
#define ZFMETHOD_FUNC_DECLARE_4(ZFLIB_, ReturnType, MethodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:1065
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define zfabstract
typename for class showing that its abstract
Definition ZFObjectClassTypeFwd.h:42
#define ZFOBJECT_DECLARE_ABSTRACT(ChildClass, SuperClass,...)
necessary for every abstract class inherit from ZFObject
Definition ZFObjectDeclare.h:152
virtual zfbool ioMove(const zfstring &itemPathFrom, const zfstring &itemPathTo)=0
see ZFCompressOpen
virtual zfstring itemPath(zfindex itemIndex)
see ZFCompressOpen
Definition ZFCompress.h:96
virtual zfbool ioRemove(const zfstring &itemPath)=0
see ZFCompressOpen
virtual zfbool ioFindFirst(ZFIOFindData &fd, const zfstring &itemPath)=0
see ZFCompressOpen
virtual ZFOutput output(const zfstring &itemPath)
get output of specified item
virtual void ioFindClose(ZFIOFindData &fd)=0
see ZFCompressOpen
virtual zfindex itemCount(void)=0
see ZFCompressOpen
virtual zfbool ioIsDirAt(zfindex itemIndex)=0
see ZFCompressOpen
virtual ZFInput input(const zfstring &itemPath)
get input of specified item
virtual zfbool ioFindNext(ZFIOFindData &fd)=0
see ZFCompressOpen
virtual zfbool ioIsExist(const zfstring &itemPath)
see ZFCompressOpen
Definition ZFCompress.h:83
virtual zfbool ioPathCreate(const zfstring &itemPath)=0
see ZFCompressOpen
virtual zfbool ioIsDir(const zfstring &itemPath)=0
see ZFCompressOpen
virtual zfbool itemPathT(zfstring &itemPath, zfindex itemIndex)=0
see ZFCompressOpen
virtual zfbool ioWrite(const zfstring &itemPath, const ZFInput &input)=0
see ZFCompressOpen
virtual zfindex itemIndex(const zfstring &itemPath)=0
see ZFCompressOpen
virtual zfbool ioRead(const ZFOutput &output, const zfstring &itemPath)=0
see ZFCompressOpen
data used by ZFIO when finding files
Definition ZFIODef_fwd.h:71
see v_ZFIOOpenOption, ZFIOOpenOptionFlagsToString, ZFIOOpenOptionFlagsFromString
Definition ZFIODef_fwd.h:49
virtual zfstring pathData(void)=0
path info for this token
virtual ZFIOOpenOptionFlags ioFlags(void)=0
open flags for this token
virtual zfstring pathType(void)=0
path info for this token
virtual zfbool ioClose(void)=0
see ZFIOImplForPathType
general input callback
Definition ZFIOCallback_input.h:35
general output callback
Definition ZFIOCallback_output.h:37
path related info storage for impl, actual meaning of the info depends on impl
Definition ZFPathInfo.h:34
compress level for ZFCompressOpen
Definition ZFCompress.h:15
static v_ZFCompressLevel::ZFEnumType EnumDefault(void)
default value for ZFCompressLevel
Definition ZFCompress.h:29
file open option
Definition ZFIODef_fwd.h:41
type restrict version of zfauto
Definition zfautoFwd.h:113
#define zftext(s)
util macro for zfstring::shared
Definition zfstring.h:704