Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfDocumentinfo.h
Show All 21 Lines | |||||
22 | #ifndef ACBFDOCUMENTINFO_H | 22 | #ifndef ACBFDOCUMENTINFO_H | ||
23 | #define ACBFDOCUMENTINFO_H | 23 | #define ACBFDOCUMENTINFO_H | ||
24 | 24 | | |||
25 | #include <memory> | 25 | #include <memory> | ||
26 | 26 | | |||
27 | #include "AcbfMetadata.h" | 27 | #include "AcbfMetadata.h" | ||
28 | 28 | | |||
29 | #include <QDate> | 29 | #include <QDate> | ||
30 | 30 | /** | |||
31 | * \brief Class to handle the DocumentInfo section. | ||||
32 | * | ||||
33 | * DocumentInfo, in ACBF is the data about the ACBF file itself. | ||||
34 | * It contains the ACBF author, creation date, original source, version | ||||
35 | * number and a version history. | ||||
36 | * | ||||
37 | * Sources is a stringlist, which is useful when the ACBF encompasses several | ||||
38 | * pages of a webcomic, for example. | ||||
39 | */ | ||||
31 | namespace AdvancedComicBookFormat | 40 | namespace AdvancedComicBookFormat | ||
32 | { | 41 | { | ||
33 | class Author; | 42 | class Author; | ||
34 | class ACBF_EXPORT DocumentInfo : public QObject | 43 | class ACBF_EXPORT DocumentInfo : public QObject | ||
35 | { | 44 | { | ||
36 | Q_OBJECT | 45 | Q_OBJECT | ||
37 | public: | 46 | public: | ||
38 | explicit DocumentInfo(Metadata* parent = nullptr); | 47 | explicit DocumentInfo(Metadata* parent = nullptr); | ||
39 | ~DocumentInfo() override; | 48 | ~DocumentInfo() override; | ||
40 | 49 | | |||
41 | Metadata* metadata() const; | 50 | Metadata* metadata() const; | ||
42 | 51 | | |||
52 | /** | ||||
53 | * \brief write the documentinfo into the XML writer. | ||||
54 | */ | ||||
43 | void toXml(QXmlStreamWriter *writer); | 55 | void toXml(QXmlStreamWriter *writer); | ||
56 | /** | ||||
57 | * \brief load the DocumentInfo into this object. | ||||
58 | * @return True if the xmlReader encountered no errors. | ||||
59 | */ | ||||
44 | bool fromXml(QXmlStreamReader *xmlReader); | 60 | bool fromXml(QXmlStreamReader *xmlReader); | ||
45 | 61 | | |||
62 | /** | ||||
63 | * \brief the list of authors that worked on this specific acbf. | ||||
64 | * @return a list of author objects. | ||||
65 | */ | ||||
46 | QList<Author*> author() const; | 66 | QList<Author*> author() const; | ||
67 | /** | ||||
68 | * \brief add an Author object to the list of authors. | ||||
69 | * @param author - an author object. | ||||
70 | */ | ||||
47 | void addAuthor(Author* author); | 71 | void addAuthor(Author* author); | ||
72 | /** | ||||
73 | * \brief remove an Author object from the list of authors. | ||||
74 | * @param author - an author object. | ||||
75 | */ | ||||
48 | void removeAuthor(Author* author); | 76 | void removeAuthor(Author* author); | ||
49 | 77 | | |||
78 | /** | ||||
79 | * @return a QDate with the creation date of this file. | ||||
80 | */ | ||||
50 | QDate creationDate() const; | 81 | QDate creationDate() const; | ||
82 | /** | ||||
83 | * \brief set the creation date of this file. | ||||
84 | * @param creationDate - a QDate object holding the creation date. | ||||
85 | */ | ||||
51 | void setCreationDate(const QDate& creationDate); | 86 | void setCreationDate(const QDate& creationDate); | ||
52 | 87 | | |||
88 | /** | ||||
89 | * @return a list of sources that this ACBF is an adaptation of. | ||||
90 | */ | ||||
53 | QStringList source() const; | 91 | QStringList source() const; | ||
92 | /** | ||||
93 | * \brief set the list of source that this ACBF is an adaptation of. | ||||
94 | * @param source - a stringlist of sources. | ||||
95 | */ | ||||
54 | void setSource(const QStringList& source); | 96 | void setSource(const QStringList& source); | ||
55 | 97 | | |||
98 | /** | ||||
99 | * @returns the unique id of this ACBF document, used for cataloguing purposes. | ||||
100 | */ | ||||
56 | QString id() const; | 101 | QString id() const; | ||
102 | /** | ||||
103 | * \brief set the unique ID for this file used for cataloguing purposes. | ||||
104 | * @param id - a unique ID. Can be any kind of string, a UUID is recommended as default. | ||||
105 | */ | ||||
57 | void setId(const QString& id); | 106 | void setId(const QString& id); | ||
58 | 107 | | |||
108 | /** | ||||
109 | * @return the version of this document. | ||||
110 | */ | ||||
59 | QString version() const; | 111 | QString version() const; | ||
112 | /** | ||||
113 | * \brief set the version of this document | ||||
114 | * @param version - the version as a string. | ||||
115 | * TODO: The official XSD requires a floating point number here. | ||||
116 | */ | ||||
60 | void setVersion(const QString& version); | 117 | void setVersion(const QString& version); | ||
61 | 118 | | |||
119 | /** | ||||
120 | * @return a list of history entries as a stringlist. | ||||
121 | */ | ||||
62 | QStringList history() const; | 122 | QStringList history() const; | ||
123 | /** | ||||
124 | * \brief set the whole history list as a single stringlist. | ||||
125 | * @param history - the whole history of the document as a stringlist. | ||||
126 | */ | ||||
63 | void setHistory(const QStringList& history); | 127 | void setHistory(const QStringList& history); | ||
128 | /** | ||||
129 | * \brief add a single entry to the document history. | ||||
130 | * @param historyLine - a single entry in the document. | ||||
131 | */ | ||||
64 | void addHistoryLine(const QString& historyLine); | 132 | void addHistoryLine(const QString& historyLine); | ||
65 | private: | 133 | private: | ||
66 | class Private; | 134 | class Private; | ||
67 | Private* d; | 135 | Private* d; | ||
68 | }; | 136 | }; | ||
69 | } | 137 | } | ||
70 | 138 | | |||
71 | #endif//ACBFDOCUMENTINFO_H | 139 | #endif//ACBFDOCUMENTINFO_H |