[API Change] Rename getMatatag to getMetadata.

This commit is contained in:
Matthieu Gautier 2019-09-16 10:30:39 +02:00
parent 157c1c939c
commit 660d5d7fb7
2 changed files with 20 additions and 20 deletions

View File

@ -158,7 +158,7 @@ class Reader
* @param[out] value The value will be set to the content of the metadata. * @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. * @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. * Get the name of the zim file.

View File

@ -278,7 +278,7 @@ string Reader::getZimFilePath() const
return this->zimFilePath; return this->zimFilePath;
} }
/* Return a metatag value */ /* Return a metatag value */
bool Reader::getMetatag(const string& name, string& value) const bool Reader::getMetadata(const string& name, string& value) const
{ {
try { try {
auto entry = getEntryFromPath("M/"+name); 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 string Reader::getName() const
{ {
METATAG("Name") METADATA("Name")
} }
string Reader::getTitle() const string Reader::getTitle() const
{ {
string value; string value;
this->getMetatag("Title", value); this->getMetadata("Title", value);
if (value.empty()) { if (value.empty()) {
value = getLastPathElement(zimFileHandler->getFilename()); value = getLastPathElement(zimFileHandler->getFilename());
std::replace(value.begin(), value.end(), '_', ' '); std::replace(value.begin(), value.end(), '_', ' ');
@ -311,27 +311,27 @@ string Reader::getTitle() const
string Reader::getCreator() const string Reader::getCreator() const
{ {
METATAG("Creator") METADATA("Creator")
} }
string Reader::getPublisher() const string Reader::getPublisher() const
{ {
METATAG("Publisher") METADATA("Publisher")
} }
string Reader::getDate() const string Reader::getDate() const
{ {
METATAG("Date") METADATA("Date")
} }
string Reader::getDescription() const string Reader::getDescription() const
{ {
string value; string value;
this->getMetatag("Description", value); this->getMetadata("Description", value);
/* Mediawiki Collection tends to use the "Subtitle" name */ /* Mediawiki Collection tends to use the "Subtitle" name */
if (value.empty()) { if (value.empty()) {
this->getMetatag("Subtitle", value); this->getMetadata("Subtitle", value);
} }
return value; return value;
@ -339,49 +339,49 @@ string Reader::getDescription() const
string Reader::getLongDescription() const string Reader::getLongDescription() const
{ {
METATAG("LongDescription") METADATA("LongDescription")
} }
string Reader::getLanguage() const string Reader::getLanguage() const
{ {
METATAG("Language") METADATA("Language")
} }
string Reader::getLicense() const string Reader::getLicense() const
{ {
METATAG("License") METADATA("License")
} }
string Reader::getTags() const string Reader::getTags() const
{ {
METATAG("Tags") METADATA("Tags")
} }
string Reader::getRelation() const string Reader::getRelation() const
{ {
METATAG("Relation") METADATA("Relation")
} }
string Reader::getFlavour() const string Reader::getFlavour() const
{ {
METATAG("Flavour") METADATA("Flavour")
} }
string Reader::getSource() const string Reader::getSource() const
{ {
METATAG("Source") METADATA("Source")
} }
string Reader::getScraper() const string Reader::getScraper() const
{ {
METATAG("Scraper") METADATA("Scraper")
} }
#undef METATAG #undef METADATA
string Reader::getOrigId() const string Reader::getOrigId() const
{ {
string value; string value;
this->getMetatag("startfileuid", value); this->getMetadata("startfileuid", value);
if (value.empty()) { if (value.empty()) {
return ""; return "";
} }