Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfBinary.h
Context not available. | |||||
31 | class QXmlStreamReader; | 31 | class QXmlStreamReader; | ||
---|---|---|---|---|---|
32 | class QXmlStreamWriter; | 32 | class QXmlStreamWriter; | ||
33 | 33 | | |||
34 | /** | ||||
35 | * \brief Class for handling the embedded data in ACBF | ||||
36 | * | ||||
37 | * ACBF allows for embedding images and fonts as Base64 bytearrays. | ||||
38 | * | ||||
39 | * The images are used to allow ACBF to be standalone. | ||||
40 | * | ||||
41 | * The fonts are used to indicate the appropriate style | ||||
42 | * for text areas. | ||||
43 | * | ||||
44 | * This class holds the bytearray and mimetype, | ||||
45 | * handling reading and loading from the xml. | ||||
46 | * | ||||
47 | * It does not convert the bytearrays | ||||
48 | * to the appropriate object. | ||||
49 | */ | ||||
50 | | ||||
34 | namespace AdvancedComicBookFormat | 51 | namespace AdvancedComicBookFormat | ||
35 | { | 52 | { | ||
36 | class Data; | 53 | class Data; | ||
Context not available. | |||||
41 | explicit Binary(Data* parent = nullptr); | 58 | explicit Binary(Data* parent = nullptr); | ||
42 | ~Binary() override; | 59 | ~Binary() override; | ||
43 | 60 | | |||
61 | /** | ||||
62 | *\brief Load binary data into xml. | ||||
63 | */ | ||||
44 | void toXml(QXmlStreamWriter *writer); | 64 | void toXml(QXmlStreamWriter *writer); | ||
65 | | ||||
66 | /** | ||||
67 | * \brief Load binary data from xml. | ||||
68 | * @return True if the xmlReader encountered no errors. | ||||
69 | */ | ||||
45 | bool fromXml(QXmlStreamReader *xmlReader); | 70 | bool fromXml(QXmlStreamReader *xmlReader); | ||
46 | 71 | | |||
72 | /** | ||||
73 | * @return The ID of this binary data element as a QString. | ||||
74 | * Used to identify it from other parts of the | ||||
75 | * ACBF document. | ||||
76 | */ | ||||
47 | QString id() const; | 77 | QString id() const; | ||
78 | | ||||
79 | /** | ||||
80 | * \brief Set the ID for this binary element. | ||||
81 | * This is used to reference this element from | ||||
82 | * other parts of the ACBF document. | ||||
83 | * @param newId - The new ID as a string. | ||||
84 | */ | ||||
48 | void setId(const QString& newId); | 85 | void setId(const QString& newId); | ||
49 | 86 | | |||
87 | /** | ||||
88 | * @return the mimetype of the binary data as a QString. | ||||
89 | */ | ||||
50 | QString contentType() const; | 90 | QString contentType() const; | ||
91 | | ||||
92 | /** | ||||
93 | * \brief Indicate the mimetype of the binary data. | ||||
94 | * @param newContentType - the mimetype in string format. | ||||
95 | */ | ||||
51 | void setContentType(const QString& newContentType); | 96 | void setContentType(const QString& newContentType); | ||
52 | 97 | | |||
98 | /** | ||||
99 | * @return The binary data as a QByteArray. | ||||
100 | */ | ||||
53 | QByteArray data() const; | 101 | QByteArray data() const; | ||
102 | | ||||
103 | /** | ||||
104 | * \brief Set the binary data to store in this element. | ||||
105 | * | ||||
106 | * @param newData - This should be a QByteArray. | ||||
107 | */ | ||||
54 | void setData(const QByteArray& newData); | 108 | void setData(const QByteArray& newData); | ||
55 | private: | 109 | private: | ||
56 | class Private; | 110 | class Private; | ||
Context not available. |