From 420be55bfa5eee363d56bfa3f7cac5f784043334 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Thu, 12 Sep 2019 15:24:17 +0200 Subject: [PATCH] Reorder methods to get metadata. Use the same order than https://wiki.openzim.org/wiki/Metadata --- include/reader.h | 56 ++++++++++++++++++++++++------------------------ src/reader.cpp | 40 +++++++++++++++++----------------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/include/reader.h b/include/reader.h index f9c64e6f7..c65859d72 100644 --- a/include/reader.h +++ b/include/reader.h @@ -160,6 +160,13 @@ class Reader */ bool getMetatag(const string& name, string& value) const; + /** + * Get the name of the zim file. + * + * @return The name of the zim file as specified in the zim metadata. + */ + string getName() const; + /** * Get the title of the zim file. * @@ -169,6 +176,27 @@ class Reader */ string getTitle() const; + /** + * Get the creator of the zim file. + * + * @return The creator of the zim file as specified in the zim metadata. + */ + string getCreator() const; + + /** + * Get the publisher of the zim file. + * + * @return The publisher of the zim file as specified in the zim metadata. + */ + string getPublisher() const; + + /** + * Get the date of the zim file. + * + * @return The date of the zim file as specified in the zim metadata. + */ + string getDate() const; + /** * Get the description of the zim file. * @@ -184,13 +212,6 @@ class Reader */ string getLanguage() const; - /** - * Get the name of the zim file. - * - * @return The name of the zim file as specified in the zim metadata. - */ - string getName() const; - /** * Get the tags of the zim file. * @@ -198,27 +219,6 @@ class Reader */ string getTags() const; - /** - * Get the date of the zim file. - * - * @return The date of the zim file as specified in the zim metadata. - */ - string getDate() const; - - /** - * Get the creator of the zim file. - * - * @return The creator of the zim file as specified in the zim metadata. - */ - string getCreator() const; - - /** - * Get the publisher of the zim file. - * - * @return The publisher of the zim file as specified in the zim metadata. - */ - string getPublisher() const; - /** * Get the origId of the zim file. * diff --git a/src/reader.cpp b/src/reader.cpp index aa778dc92..7c3e18985 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -289,6 +289,13 @@ bool Reader::getMetatag(const string& name, string& value) const } } +string Reader::getName() const +{ + string value; + this->getMetatag("Name", value); + return value; +} + string Reader::getTitle() const { string value; @@ -302,17 +309,24 @@ string Reader::getTitle() const return value; } -string Reader::getName() const +string Reader::getCreator() const { string value; - this->getMetatag("Name", value); + this->getMetatag("Creator", value); return value; } -string Reader::getTags() const +string Reader::getPublisher() const { string value; - this->getMetatag("Tags", value); + this->getMetatag("Publisher", value); + return value; +} + +string Reader::getDate() const +{ + string value; + this->getMetatag("Date", value); return value; } @@ -336,24 +350,10 @@ string Reader::getLanguage() const return value; } -string Reader::getDate() const +string Reader::getTags() const { string value; - this->getMetatag("Date", value); - return value; -} - -string Reader::getCreator() const -{ - string value; - this->getMetatag("Creator", value); - return value; -} - -string Reader::getPublisher() const -{ - string value; - this->getMetatag("Publisher", value); + this->getMetatag("Tags", value); return value; }