1 | /*************************************************************************** |
2 | * Copyright (C) 2008 by Jakub Stachowski <qbast@go2.pl> * |
3 | * * |
4 | * This program is free software; you can redistribute it and/or modify * |
5 | * it under the terms of the GNU General Public License as published by * |
6 | * the Free Software Foundation; either version 2 of the License, or * |
7 | * (at your option) any later version. * |
8 | ***************************************************************************/ |
9 | |
10 | #ifndef MOBI_DECOMPRESSOR_H |
11 | #define MOBI_DECOMPRESSOR_H |
12 | |
13 | #include <QByteArray> |
14 | namespace Mobipocket { |
15 | |
16 | class PDB; |
17 | |
18 | class Decompressor { |
19 | public: |
20 | Decompressor(const PDB& p) : pdb(p), valid(true) {} |
21 | virtual QByteArray decompress(const QByteArray& data) = 0; |
22 | virtual ~Decompressor() {} |
23 | bool isValid() const { return valid; } |
24 | |
25 | static Decompressor* create(quint8 type, const PDB& pdb); |
26 | protected: |
27 | const PDB& pdb; |
28 | bool valid; |
29 | }; |
30 | |
31 | quint32 readBELong(const QByteArray& data, int offset); |
32 | } |
33 | #endif |
34 | |