+ fix a few typo/style stuff

This commit is contained in:
kelson42 2013-09-22 13:11:19 +02:00
parent 1299c4c264
commit c9d1f562ff
4 changed files with 52 additions and 54 deletions

View File

@ -67,7 +67,7 @@ namespace kiwix {
string publisher;
string date;
string url;
string origID;
string origId;
string articleCount;
string mediaCount;
bool readOnly;

View File

@ -56,7 +56,7 @@ namespace kiwix {
book.creator = bookNode.attribute("creator").value();
book.publisher = bookNode.attribute("publisher").value();
book.url = bookNode.attribute("url").value();
book.origID = bookNode.attribute("origId").value();
book.origId = bookNode.attribute("origId").value();
book.articleCount = bookNode.attribute("articleCount").value();
book.mediaCount = bookNode.attribute("mediaCount").value();
book.size = bookNode.attribute("size").value();
@ -157,47 +157,45 @@ namespace kiwix {
bookNode.append_attribute("indexType") = "clucene";
}
if (itr->origID == "")
{
if (!itr->title.empty())
bookNode.append_attribute("title") = itr->title.c_str();
if (itr->origId.empty()) {
if (!itr->title.empty())
bookNode.append_attribute("title") = itr->title.c_str();
if (itr->description != "")
bookNode.append_attribute("description") = itr->description.c_str();
if (!itr->description.empty())
bookNode.append_attribute("description") = itr->description.c_str();
if (itr->language != "")
bookNode.append_attribute("language") = itr->language.c_str();
if (!itr->language.empty())
bookNode.append_attribute("language") = itr->language.c_str();
if (itr->date != "")
bookNode.append_attribute("date") = itr->date.c_str();
if (!itr->creator.empty())
bookNode.append_attribute("creator") = itr->creator.c_str();
if (itr->creator != "")
bookNode.append_attribute("creator") = itr->creator.c_str();
if (!itr->publisher.empty())
bookNode.append_attribute("publisher") = itr->publisher.c_str();
if (itr->publisher != "")
bookNode.append_attribute("publisher") = itr->publisher.c_str();
if (itr->favicon != "")
bookNode.append_attribute("favicon") = itr->favicon.c_str();
if (itr->faviconMimeType != "")
bookNode.append_attribute("faviconMimeType") = itr->faviconMimeType.c_str();
if (!itr->favicon.empty())
bookNode.append_attribute("favicon") = itr->favicon.c_str();
if (itr->faviconMimeType != "")
bookNode.append_attribute("faviconMimeType") = itr->faviconMimeType.c_str();
}
if (itr->url != "")
if (!itr->date.empty())
bookNode.append_attribute("date") = itr->date.c_str();
if (!itr->url.empty())
bookNode.append_attribute("url") = itr->url.c_str();
if (itr->origID != "")
bookNode.append_attribute("origId") = itr->origID.c_str();
if (!itr->origId.empty())
bookNode.append_attribute("origId") = itr->origId.c_str();
if (itr->articleCount != "")
if (!itr->articleCount.empty())
bookNode.append_attribute("articleCount") = itr->articleCount.c_str();
if (itr->mediaCount != "")
if (!itr->mediaCount.empty())
bookNode.append_attribute("mediaCount") = itr->mediaCount.c_str();
if (itr->size != "")
if (!itr->size.empty())
bookNode.append_attribute("size") = itr->size.c_str();
}
}
@ -266,7 +264,7 @@ namespace kiwix {
book->creator = reader->getCreator();
book->publisher = reader->getPublisher();
book->title = reader->getTitle();
book->origID=reader->getOrigID();
book->origId = reader->getOrigId();
std::ostringstream articleCountStream;
articleCountStream << reader->getArticleCount();
book->articleCount = articleCountStream.str();
@ -317,11 +315,11 @@ namespace kiwix {
std::map<string, bool> booksLanguagesMap;
std::sort(library.books.begin(), library.books.end(), kiwix::Book::sortByLanguage);
for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) {
for (itr = library.books.begin(); itr != library.books.end(); ++itr) {
if (booksLanguagesMap.find(itr->language) == booksLanguagesMap.end()) {
if(itr->origID=="") {
booksLanguagesMap[itr->language] = true;
booksLanguages.push_back(itr->language);
if (itr->origId.empty()) {
booksLanguagesMap[itr->language] = true;
booksLanguages.push_back(itr->language);
}
}
}
@ -335,11 +333,11 @@ namespace kiwix {
std::map<string, bool> booksCreatorsMap;
std::sort(library.books.begin(), library.books.end(), kiwix::Book::sortByCreator);
for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) {
for (itr = library.books.begin(); itr != library.books.end(); ++itr) {
if (booksCreatorsMap.find(itr->creator) == booksCreatorsMap.end()) {
if(itr->origID=="") {
booksCreatorsMap[itr->creator] = true;
booksCreators.push_back(itr->creator);
if (itr->origId.empty()) {
booksCreatorsMap[itr->creator] = true;
booksCreators.push_back(itr->creator);
}
}
}
@ -367,9 +365,9 @@ namespace kiwix {
std::sort(library.books.begin(), library.books.end(), kiwix::Book::sortByPublisher);
for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) {
if (booksPublishersMap.find(itr->publisher) == booksPublishersMap.end()) {
if(itr->origID=="") {
booksPublishersMap[itr->publisher] = true;
booksPublishers.push_back(itr->publisher);
if (itr->origId.empty()) {
booksPublishersMap[itr->publisher] = true;
booksPublishers.push_back(itr->publisher);
}
}
}

View File

@ -321,11 +321,11 @@ namespace kiwix {
return value;
}
string Reader::getOrigID() {
string value;
this->getMetatag("startfileuid", value);
if(value.empty())
return "";
string Reader::getOrigId() {
string origId;
this->getMetatag("startfileuid", origId);
if (!origId.empty()) {
std::string id=value;
std::string origID;
std::string temp="";

View File

@ -58,7 +58,7 @@ namespace kiwix {
string getDate();
string getCreator();
string getPublisher();
string getOrigID();
string getOrigId();
bool getFavicon(string &content, string &mimeType);
bool getPageUrlFromTitle(const string &title, string &url);
bool getContentByUrl(const string &url, string &content, unsigned int &contentLength, string &contentType);