Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfData.h
Show All 23 Lines | |||||
24 | 24 | | |||
25 | #include <memory> | 25 | #include <memory> | ||
26 | 26 | | |||
27 | #include <QObject> | 27 | #include <QObject> | ||
28 | #include <QXmlStreamReader> | 28 | #include <QXmlStreamReader> | ||
29 | 29 | | |||
30 | #include "AcbfDocument.h" | 30 | #include "AcbfDocument.h" | ||
31 | #include "AcbfBinary.h" | 31 | #include "AcbfBinary.h" | ||
32 | 32 | /** | |||
33 | * \brief Class to handle the list of embedded data in an ACBF document. | ||||
34 | * | ||||
35 | * ACBF allows embedding images and fonts as Base64 bytearrays. | ||||
36 | * They are stored in the data section of the file, with a binary | ||||
37 | * element each. | ||||
38 | * | ||||
39 | * This class holds Binary objects which in turn hold the binary data. | ||||
40 | * This class cannot yet modify the entries or add and remove entries. | ||||
41 | */ | ||||
33 | namespace AdvancedComicBookFormat | 42 | namespace AdvancedComicBookFormat | ||
34 | { | 43 | { | ||
35 | class ACBF_EXPORT Data : public QObject | 44 | class ACBF_EXPORT Data : public QObject | ||
36 | { | 45 | { | ||
37 | Q_OBJECT | 46 | Q_OBJECT | ||
38 | public: | 47 | public: | ||
39 | explicit Data(Document* parent = nullptr); | 48 | explicit Data(Document* parent = nullptr); | ||
40 | ~Data() override; | 49 | ~Data() override; | ||
41 | 50 | | |||
51 | /** | ||||
52 | * \brief writes the data section and its entries to the file. | ||||
53 | */ | ||||
42 | void toXml(QXmlStreamWriter *writer); | 54 | void toXml(QXmlStreamWriter *writer); | ||
55 | /** | ||||
56 | * \brief load the data section from the xml into this object. | ||||
57 | * @return True if the xmlReader encountered no errors. | ||||
58 | */ | ||||
43 | bool fromXml(QXmlStreamReader *xmlReader); | 59 | bool fromXml(QXmlStreamReader *xmlReader); | ||
44 | 60 | | |||
61 | /** | ||||
62 | * @param id - the id that is used to reference to this object. | ||||
63 | * @return the binary object referenced by this id. | ||||
64 | */ | ||||
45 | Binary* binary(const QString& id) const; | 65 | Binary* binary(const QString& id) const; | ||
46 | private: | 66 | private: | ||
47 | class Private; | 67 | class Private; | ||
48 | std::unique_ptr<Private> d; | 68 | std::unique_ptr<Private> d; | ||
49 | }; | 69 | }; | ||
50 | } | 70 | } | ||
51 | 71 | | |||
52 | #endif // ACBFDATA_H | 72 | #endif // ACBFDATA_H |