File indexing completed on 2024-04-28 04:18:58

0001 /***************************************************************************
0002  *   Copyright (C) 2008 by Jakub Stachowski <qbast@go2.pl>                 *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  ***************************************************************************/
0009 
0010 #ifndef MOBI_DECOMPRESSOR_H
0011 #define MOBI_DECOMPRESSOR_H
0012 
0013 #include <QByteArray>
0014 namespace Mobipocket {
0015 
0016 class PDB;
0017 
0018 class Decompressor {
0019 public:
0020     Decompressor(const PDB& p) : pdb(p), valid(true) {}
0021     virtual QByteArray decompress(const QByteArray& data) = 0; 
0022     virtual ~Decompressor() {}
0023     bool isValid() const { return valid; }
0024 
0025     static Decompressor* create(quint8 type, const PDB& pdb);
0026 protected:
0027     const PDB& pdb;
0028     bool valid;
0029 };
0030 
0031 quint32 readBELong(const QByteArray& data, int offset);
0032 }
0033 #endif