+ 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 publisher;
string date; string date;
string url; string url;
string origID; string origId;
string articleCount; string articleCount;
string mediaCount; string mediaCount;
bool readOnly; bool readOnly;

View File

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

View File

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

View File

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