ff7tk  1.0.0.16
Work with Final Fantasy 7 game data
LZS.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2012 Arzel Jérôme <myst6re@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 /***************************************************************
4  4/6/1989 Haruhiko Okumura
5  Use, distribute, and modify this program freely.
6  Please send me your improved versions.
7  PC-VAN SCIENCE
8  NIFTY-Serve PAF01022
9  CompuServe 74050,1022
10 **************************************************************/
11 #pragma once
12 
13 #include <QtCore>
14 #include <ff7tkutils_export.h>
15 
16 class FF7TKUTILS_EXPORT LZS
17 {
18 public:
19  // Theses functions are limited to "small" data sizes
20  static const QByteArray &decompress(const QByteArray &data, int max);
21  static const QByteArray &decompress(const char *data, int fileSize, int max);
22  static const QByteArray &decompressAll(const QByteArray &data);
23  static const QByteArray &decompressAll(const char *data, int fileSize);
24  static const QByteArray &decompressAllWithHeader(const QByteArray &data);
25  static const QByteArray &decompressAllWithHeader(const char *data, int size);
26  static const QByteArray &compress(const QByteArray &fileData);
27  static const QByteArray &compress(const char *data, int sizeData);
28  static const QByteArray &compressWithHeader(const QByteArray &fileData);
29  static const QByteArray &compressWithHeader(const char *data, int sizeData);
30  // To reset the cache
31  static void clear();
32 private:
33  static void InsertNode(qint32 r);
34  static void DeleteNode(qint32 p);
35  static qint32 match_length; // of longest match. These are set by the InsertNode() procedure.
36  static qint32 match_position;
37  static qint32 lson[4097]; // left & right children & parents -- These constitute binary search trees.
38  static qint32 rson[4353];
39  static qint32 dad[4097];
40  static unsigned char text_buf[4113]; // ring buffer of size 4096, with extra 17 bytes to facilitate string comparison
41  static QByteArray result;
42 };
LZS
Definition: LZS.h:16