File: mobipocket.h

package info (click to toggle)
kdegraphics-mobipocket 4:20.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 196 kB
  • sloc: cpp: 586; xml: 149; makefile: 3
file content (71 lines) | stat: -rw-r--r-- 2,008 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/***************************************************************************
 *   Copyright (C) 2008 by Jakub Stachowski <qbast@go2.pl>                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#ifndef MOBIPOCKET_H
#define MOBIPOCKET_H

#include <QString>
#include <QByteArray>
#include <QMap>
#include <QtGui/QImage>

#include "qmobipocket_export.h"

class QIODevice;

namespace Mobipocket {

/** 
Minimalistic stream abstraction. It is supposed to allow mobipocket document classes to be
used with QIODevice (for Okular generator), and previously also with InputStream for Strigi
analyzer.
*/
class QMOBIPOCKET_EXPORT Stream {
public:
    virtual int read(char* buf, int size)=0;
    virtual bool seek(int pos)=0;

    QByteArray readAll();
    QByteArray read(int len);
    virtual ~Stream() {}
};

struct PDBPrivate;
class PDB {
public:
    PDB(Stream* s);
    ~PDB();
    QString fileType() const;
    int recordCount() const;
    QByteArray getRecord(int i) const;
    bool isValid() const;
private:
    PDBPrivate* const d;
};

struct DocumentPrivate;
class QMOBIPOCKET_EXPORT Document {
public:
    enum MetaKey { Title, Author, Copyright, Description, Subject };
    ~Document();
    Document(Stream* s);
    QMap<MetaKey,QString> metadata() const;
    QString text(int size=-1) const;
    int imageCount() const;
    QImage getImage(int i) const;
    QImage thumbnail() const;
    bool isValid() const;
    
    // if true then it is impossible to get text of book. Images should still be readable
    bool hasDRM() const;
private:
    DocumentPrivate* const d;
};
}
#endif