mirror of https://github.com/kiwix/libkiwix.git
Remove the "current" book functionnality.
- This is not used by any application. - This is application specific and should not be stored in the library (who is a list of book).
This commit is contained in:
parent
c9eac04050
commit
541fb0cfd1
|
@ -23,7 +23,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -171,7 +170,6 @@ class Library
|
|||
*/
|
||||
std::vector<std::string> getBooksIds();
|
||||
|
||||
stack<string> current;
|
||||
friend class OPDSDumper;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -115,22 +115,6 @@ class Manager
|
|||
*/
|
||||
bool removeBookById(const string id);
|
||||
|
||||
/**
|
||||
* Set the current book.
|
||||
*
|
||||
* @param id The id to add to the stack of current books.
|
||||
* If id is empty, remove the current book from the stack.
|
||||
* @return True
|
||||
*/
|
||||
bool setCurrentBookId(const string id);
|
||||
|
||||
/**
|
||||
* Get the current book id.
|
||||
*
|
||||
* @return The id of the current book (or empty string if no current book).
|
||||
*/
|
||||
string getCurrentBookId() const;
|
||||
|
||||
/**
|
||||
* Set the path of the external fulltext index associated to a book.
|
||||
*
|
||||
|
@ -193,14 +177,6 @@ class Manager
|
|||
*/
|
||||
bool getBookById(const string id, Book& book);
|
||||
|
||||
/**
|
||||
* Get the current book.
|
||||
*
|
||||
* @param[out] The current book.
|
||||
* @return True if there is a current book.
|
||||
*/
|
||||
bool getCurrentBook(Book& book);
|
||||
|
||||
/**
|
||||
* Update the "last open date" of a book
|
||||
*
|
||||
|
|
|
@ -36,9 +36,6 @@ bool Manager::parseXmlDom(const pugi::xml_document& doc,
|
|||
{
|
||||
pugi::xml_node libraryNode = doc.child("library");
|
||||
|
||||
if (strlen(libraryNode.attribute("current").value()))
|
||||
this->setCurrentBookId(libraryNode.attribute("current").value());
|
||||
|
||||
string libraryVersion = libraryNode.attribute("version").value();
|
||||
|
||||
for (pugi::xml_node bookNode = libraryNode.child("book"); bookNode;
|
||||
|
@ -195,23 +192,6 @@ bool Manager::readFile(const string nativePath,
|
|||
}
|
||||
|
||||
|
||||
bool Manager::setCurrentBookId(const string id)
|
||||
{
|
||||
if (library.current.empty() || library.current.top() != id) {
|
||||
if (id.empty() && !library.current.empty()) {
|
||||
library.current.pop();
|
||||
} else {
|
||||
library.current.push(id);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
string Manager::getCurrentBookId() const
|
||||
{
|
||||
return library.current.empty() ? "" : library.current.top();
|
||||
}
|
||||
|
||||
/* Add a book to the library. Return empty string if failed, book id otherwise
|
||||
*/
|
||||
string Manager::addBookFromPathAndGetId(const string pathToOpen,
|
||||
|
@ -315,17 +295,6 @@ bool Manager::removeBookById(const string id)
|
|||
return library.removeBookById(id);
|
||||
}
|
||||
|
||||
bool Manager::getCurrentBook(Book& book)
|
||||
{
|
||||
string currentBookId = getCurrentBookId();
|
||||
if (currentBookId.empty()) {
|
||||
return false;
|
||||
} else {
|
||||
book = library.getBookById(currentBookId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool Manager::updateBookLastOpenDateById(const string id)
|
||||
try {
|
||||
auto book = library.getBookById(id);
|
||||
|
|
Loading…
Reference in New Issue