1 | // SPDX-FileCopyrightText: 2008 by Jakub Stachowski <qbast@go2.pl> |
2 | // SPDX-License-Identifier: GPL-2.0-or-later |
3 | |
4 | #ifndef MOBIPOCKET_H |
5 | #define MOBIPOCKET_H |
6 | |
7 | #include <QImage> |
8 | #include <QMap> |
9 | #include <QString> |
10 | |
11 | #include "qmobipocket_export.h" |
12 | |
13 | class QIODevice; |
14 | |
15 | namespace Mobipocket |
16 | { |
17 | struct DocumentPrivate; |
18 | class QMOBIPOCKET_EXPORT Document |
19 | { |
20 | public: |
21 | enum MetaKey { |
22 | Title, |
23 | Author, |
24 | Copyright, |
25 | Description, |
26 | Subject |
27 | }; |
28 | |
29 | /** |
30 | * Mobipocket::Document constructor |
31 | * |
32 | * @params device The IO device corresponding to the mobipocket document. The device must |
33 | * be open for read operations, not sequential and the document does not take ownership of |
34 | * the device. |
35 | */ |
36 | explicit Document(QIODevice *device); |
37 | virtual ~Document(); |
38 | |
39 | QMap<MetaKey, QString> metadata() const; |
40 | QString text(int size=-1) const; |
41 | int imageCount() const; |
42 | QImage getImage(int i) const; |
43 | QImage thumbnail() const; |
44 | bool isValid() const; |
45 | |
46 | // if true then it is impossible to get text of book. Images should still be readable |
47 | bool hasDRM() const; |
48 | |
49 | Q_DISABLE_COPY(Document); |
50 | private: |
51 | DocumentPrivate *const d; |
52 | }; |
53 | } |
54 | #endif |
55 | |