OROCHI
 
Loading...
Searching...
No Matches
GxZlib.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13GX_CORE_NAMESPACE_BEGIN()
14
15//===========================================================================
17//===========================================================================
18class GxZlib
19{
20 //-------------------------------
22 //-------------------------------
24public:
26 static constexpr u32 DECODE_BUFFER_SIZE = GxMath::VALUE_64K;
28 static constexpr u32 ENCODE_LEVEL_DEFAULT = 7;
30 static constexpr u32 ENCODE_LEVEL_MAX = 9;
32 static constexpr u32 FOURCC_CODE_ZLIB = GX_FOURCC('Z','L','I','B');
33
35 enum class RESULT
36 {
37 CANCELED = -2,
38 ERROR_ = -1,
39 OK = 0
40 };
41
50
52 //-------------------------------
54 //-------------------------------
56public:
58 GxZlib(void);
60 ~GxZlib(void);
61
63 //-------------------------------
65 //-------------------------------
67public:
69 RESULT decode(GxStreamReader& reader, void* pOutput, u32 outputSize);
71 RESULT decode(GxStreamReader& reader, GxMemoryStream* pOutput, b32 isAppend = false);
73 RESULT encode(GxStreamWriter& writer, void* pInput, u32 inputSize, u32 level = ENCODE_LEVEL_DEFAULT);
75 RESULT encode(GxStreamWriter& writer, GxMemoryStream* pInput, u32 level = ENCODE_LEVEL_DEFAULT);
77 void cancel(void);
79 void clear(void);
80
82 //-------------------------------
84 //-------------------------------
86public:
88 static b32 getEncodeHeader(GxEncodeHeader& dst, const void* pSrc);
90 static b32 getEncodeHeader(GxEncodeHeader& dst, const GxStreamReader& reader);
91
94 static b32 readHeader(GxEncodeHeader& dst, GxStreamReader* pStreamReader);
96 static void* createDecoderHandle(u32 chunkSizeByte);
98 static b32 decodeByHandle(void* pHandle, GxStreamReader* pStreamReader, void* pOutput, u32 outputSize, u32& encodeSize);
100 static b32 deleteDecoderHandle(void* pHandle);
101
103 //-------------------------------
105 //-------------------------------
107private:
108 b32 _isRequestCancel;
109
111};
112
113GX_CORE_NAMESPACE_END()
static constexpr u32 VALUE_64K
64K
Definition GxMath.h:135
メモリストリームクラス
Definition GxStream.h:248
ストリーム読み込みクラス
Definition GxStreamReader.h:19
ストリーム書き込みクラス
Definition GxStreamWriter.h:19
GxZlib圧縮・展開処理クラス
Definition GxZlib.h:19
RESULT
処理結果
Definition GxZlib.h:36
圧縮ヘッダー
Definition GxZlib.h:44
u32 _encodeLevel
圧縮レベル (0~9)
Definition GxZlib.h:48
u32 _decodeSize
展開データサイズ
Definition GxZlib.h:46
u32 _encodeSize
圧縮データサイズ
Definition GxZlib.h:47
u32 _fourCC
FourCC.
Definition GxZlib.h:45
32bitブーリアン
Definition GxDefine.h:173