mirror of https://github.com/kiwix/libkiwix.git
+ introduction of ternary operators
This commit is contained in:
parent
8dce6d645e
commit
7e00a3339d
|
@ -62,15 +62,10 @@ namespace kiwix {
|
||||||
book.faviconMimeType = bookNode.attribute("faviconMimeType").value();
|
book.faviconMimeType = bookNode.attribute("faviconMimeType").value();
|
||||||
|
|
||||||
/* Compute absolute paths if relative one are used */
|
/* Compute absolute paths if relative one are used */
|
||||||
if (isRelativePath(book.path))
|
book.pathAbsolute = isRelativePath(book.path) ?
|
||||||
book.pathAbsolute = computeAbsolutePath(libraryPath, book.path);
|
computeAbsolutePath(libraryPath, book.path) : book.path;
|
||||||
else
|
book.indexPathAbsolute = isRelativePath(book.indexPath) ?
|
||||||
book.pathAbsolute = book.path;
|
computeAbsolutePath(libraryPath, book.indexPath) : book.indexPath;
|
||||||
|
|
||||||
if (isRelativePath(book.indexPath))
|
|
||||||
book.indexPathAbsolute = computeAbsolutePath(libraryPath, book.indexPath);
|
|
||||||
else
|
|
||||||
book.indexPathAbsolute = book.indexPath;
|
|
||||||
|
|
||||||
/* Update the book properties with the new importer */
|
/* Update the book properties with the new importer */
|
||||||
if (libraryVersion.empty() || atoi(libraryVersion.c_str()) < atoi(KIWIX_LIBRARY_VERSION)) {
|
if (libraryVersion.empty() || atoi(libraryVersion.c_str()) < atoi(KIWIX_LIBRARY_VERSION)) {
|
||||||
|
@ -156,10 +151,10 @@ namespace kiwix {
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
this->parseXmlDom(doc, readOnly, path);
|
this->parseXmlDom(doc, readOnly, path);
|
||||||
}
|
|
||||||
|
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
this->writableLibraryPath = path;
|
this->writableLibraryPath = path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -171,11 +166,11 @@ namespace kiwix {
|
||||||
/* Add the library node */
|
/* Add the library node */
|
||||||
pugi::xml_node libraryNode = doc.append_child("library");
|
pugi::xml_node libraryNode = doc.append_child("library");
|
||||||
|
|
||||||
if (library.current != "") {
|
if (!library.current.empty()) {
|
||||||
libraryNode.append_attribute("current") = library.current.c_str();
|
libraryNode.append_attribute("current") = library.current.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (library.version != "")
|
if (!library.version.empty())
|
||||||
libraryNode.append_attribute("version") = library.version.c_str();
|
libraryNode.append_attribute("version") = library.version.c_str();
|
||||||
|
|
||||||
/* Add each book */
|
/* Add each book */
|
||||||
|
@ -186,14 +181,14 @@ namespace kiwix {
|
||||||
pugi::xml_node bookNode = libraryNode.append_child("book");
|
pugi::xml_node bookNode = libraryNode.append_child("book");
|
||||||
bookNode.append_attribute("id") = itr->id.c_str();
|
bookNode.append_attribute("id") = itr->id.c_str();
|
||||||
|
|
||||||
if (itr->path != "")
|
if (!itr->path.empty())
|
||||||
bookNode.append_attribute("path") = itr->path.c_str();
|
bookNode.append_attribute("path") = itr->path.c_str();
|
||||||
|
|
||||||
if (itr->last != "" && itr->last != "undefined") {
|
if (!itr->last.empty() && itr->last != "undefined") {
|
||||||
bookNode.append_attribute("last") = itr->last.c_str();
|
bookNode.append_attribute("last") = itr->last.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itr->indexPath != "") {
|
if (!itr->indexPath.empty()) {
|
||||||
bookNode.append_attribute("indexPath") = itr->indexPath.c_str();
|
bookNode.append_attribute("indexPath") = itr->indexPath.c_str();
|
||||||
if (itr->indexType == XAPIAN)
|
if (itr->indexType == XAPIAN)
|
||||||
bookNode.append_attribute("indexType") = "xapian";
|
bookNode.append_attribute("indexType") = "xapian";
|
||||||
|
@ -201,7 +196,7 @@ namespace kiwix {
|
||||||
bookNode.append_attribute("indexType") = "clucene";
|
bookNode.append_attribute("indexType") = "clucene";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itr->title != "")
|
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 != "")
|
||||||
|
|
Loading…
Reference in New Issue