ff7tk  0.02
Toolkit for making FF7 Tools
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 #ifndef DEF_LZS
25 #define DEF_LZS
26 
27 #include <QtCore>
28 
29 class LZS
30 {
31 public:
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();
45 private:
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 };
56 
57 #endif
static const QByteArray & decompressAllWithHeader(const QByteArray &data)
Definition: LZS.cpp:165
static unsigned char text_buf[4113]
Definition: LZS.h:53
static void DeleteNode(qint32 p)
Definition: LZS.cpp:263
static qint32 match_position
Definition: LZS.h:49
static QByteArray result
Definition: LZS.h:54
Definition: LZS.h:29
static void InsertNode(qint32 r)
Definition: LZS.cpp:188
static const QByteArray & compressWithHeader(const QByteArray &fileData)
Definition: LZS.cpp:308
static const QByteArray & decompress(const QByteArray &data, int max)
Definition: LZS.cpp:34
static void clear()
Definition: LZS.cpp:438
static qint32 lson[4097]
Definition: LZS.h:50
static qint32 match_length
Definition: LZS.h:48
static qint32 dad[4097]
Definition: LZS.h:52
static const QByteArray & compress(const QByteArray &fileData)
Definition: LZS.cpp:321
static qint32 rson[4353]
Definition: LZS.h:51
static const QByteArray & decompressAll(const QByteArray &data)
Definition: LZS.cpp:103