From 1245d4e4678df6d7ddf89480589a3ebe5595975a Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Thu, 12 Sep 2019 15:26:53 +0200 Subject: [PATCH] Use a macro to get the content of the metadata. --- src/reader.cpp | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/reader.cpp b/src/reader.cpp index 7c3e18985..b62523146 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -289,11 +289,11 @@ bool Reader::getMetatag(const string& name, string& value) const } } +#define METATAG(NAME) std::string v; getMetatag(NAME, v); return v; + string Reader::getName() const { - string value; - this->getMetatag("Name", value); - return value; + METATAG("Name") } string Reader::getTitle() const @@ -311,23 +311,17 @@ string Reader::getTitle() const string Reader::getCreator() const { - string value; - this->getMetatag("Creator", value); - return value; + METATAG("Creator") } string Reader::getPublisher() const { - string value; - this->getMetatag("Publisher", value); - return value; + METATAG("Publisher") } string Reader::getDate() const { - string value; - this->getMetatag("Date", value); - return value; + METATAG("Date") } string Reader::getDescription() const @@ -345,17 +339,14 @@ string Reader::getDescription() const string Reader::getLanguage() const { - string value; - this->getMetatag("Language", value); - return value; + METATAG("Language") } string Reader::getTags() const { - string value; - this->getMetatag("Tags", value); - return value; + METATAG("Tags") } +#undef METATAG string Reader::getOrigId() const {