ff7tk 0.80.25
Work with Final Fantasy 7 game data
LZS.h
Go to the documentation of this file.
1/****************************************************************************/
2// copyright 2012 Jérôme Arzel <myst6re@gmail.com> //
3// //
4// This file is part of FF7tk //
5// //
6// FF7tk is free software: you can redistribute it and/or modify //
7// it under the terms of the GNU General Public License as published by //
8// the Free Software Foundation, either version 3 of the License, or //
9// (at your option) any later version. //
10// //
11// FF7tk is distributed in the hope that it will be useful, //
12// but WITHOUT ANY WARRANTY; without even the implied warranty of //
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
14// GNU General Public License for more details. //
15/****************************************************************************/
16/***************************************************************
17 4/6/1989 Haruhiko Okumura
18 Use, distribute, and modify this program freely.
19 Please send me your improved versions.
20 PC-VAN SCIENCE
21 NIFTY-Serve PAF01022
22 CompuServe 74050,1022
23**************************************************************/
24#pragma once
25
26#include <QtCore>
27#include "ff7tkutils_export.h"
28
29class FF7TKUTILS_EXPORT LZS
30{
31public:
32 // Theses functions are limited to "small" data sizes
33 static const QByteArray &decompress(const QByteArray &data, int max);
34 static const QByteArray &decompress(const char *data, int fileSize, int max);
35 static const QByteArray &decompressAll(const QByteArray &data);
36 static const QByteArray &decompressAll(const char *data, int fileSize);
37 static const QByteArray &decompressAllWithHeader(const QByteArray &data);
38 static const QByteArray &decompressAllWithHeader(const char *data, int size);
39 static const QByteArray &compress(const QByteArray &fileData);
40 static const QByteArray &compress(const char *data, int sizeData);
41 static const QByteArray &compressWithHeader(const QByteArray &fileData);
42 static const QByteArray &compressWithHeader(const char *data, int sizeData);
43 // To reset the cache
44 static void clear();
45private:
46 static void InsertNode(qint32 r);
47 static void DeleteNode(qint32 p);
48 static qint32 match_length; // of longest match. These are set by the InsertNode() procedure.
49 static qint32 match_position;
50 static qint32 lson[4097]; // left & right children & parents -- These constitute binary search trees.
51 static qint32 rson[4353];
52 static qint32 dad[4097];
53 static unsigned char text_buf[4113]; // ring buffer of size 4096, with extra 17 bytes to facilitate string comparison
54 static QByteArray result;
55};
Definition: LZS.h:30