From 660d5d7fb760eacce7322bd1521995a368a81e35 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 16 Sep 2019 10:30:39 +0200 Subject: [PATCH] [API Change] Rename getMatatag to getMetadata. --- include/reader.h | 2 +- src/reader.cpp | 38 +++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/reader.h b/include/reader.h index 9c0286792..77d4e9793 100644 --- a/include/reader.h +++ b/include/reader.h @@ -158,7 +158,7 @@ class Reader * @param[out] value The value will be set to the content of the metadata. * @return True if it was possible to get the content of the metadata. */ - bool getMetatag(const string& name, string& value) const; + bool getMetadata(const string& name, string& value) const; /** * Get the name of the zim file. diff --git a/src/reader.cpp b/src/reader.cpp index 7e7dc79e0..0a02985e7 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -278,7 +278,7 @@ string Reader::getZimFilePath() const return this->zimFilePath; } /* Return a metatag value */ -bool Reader::getMetatag(const string& name, string& value) const +bool Reader::getMetadata(const string& name, string& value) const { try { auto entry = getEntryFromPath("M/"+name); @@ -289,17 +289,17 @@ bool Reader::getMetatag(const string& name, string& value) const } } -#define METATAG(NAME) std::string v; getMetatag(NAME, v); return v; +#define METADATA(NAME) std::string v; getMetadata(NAME, v); return v; string Reader::getName() const { - METATAG("Name") + METADATA("Name") } string Reader::getTitle() const { string value; - this->getMetatag("Title", value); + this->getMetadata("Title", value); if (value.empty()) { value = getLastPathElement(zimFileHandler->getFilename()); std::replace(value.begin(), value.end(), '_', ' '); @@ -311,27 +311,27 @@ string Reader::getTitle() const string Reader::getCreator() const { - METATAG("Creator") + METADATA("Creator") } string Reader::getPublisher() const { - METATAG("Publisher") + METADATA("Publisher") } string Reader::getDate() const { - METATAG("Date") + METADATA("Date") } string Reader::getDescription() const { string value; - this->getMetatag("Description", value); + this->getMetadata("Description", value); /* Mediawiki Collection tends to use the "Subtitle" name */ if (value.empty()) { - this->getMetatag("Subtitle", value); + this->getMetadata("Subtitle", value); } return value; @@ -339,49 +339,49 @@ string Reader::getDescription() const string Reader::getLongDescription() const { - METATAG("LongDescription") + METADATA("LongDescription") } string Reader::getLanguage() const { - METATAG("Language") + METADATA("Language") } string Reader::getLicense() const { - METATAG("License") + METADATA("License") } string Reader::getTags() const { - METATAG("Tags") + METADATA("Tags") } string Reader::getRelation() const { - METATAG("Relation") + METADATA("Relation") } string Reader::getFlavour() const { - METATAG("Flavour") + METADATA("Flavour") } string Reader::getSource() const { - METATAG("Source") + METADATA("Source") } string Reader::getScraper() const { - METATAG("Scraper") + METADATA("Scraper") } -#undef METATAG +#undef METADATA string Reader::getOrigId() const { string value; - this->getMetatag("startfileuid", value); + this->getMetadata("startfileuid", value); if (value.empty()) { return ""; }