From 1fb5194906884cb2f034738fdfa93d5262e8dd49 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Tue, 24 Jan 2012 12:45:22 +0000 Subject: [PATCH] + new getCurrentBook() method --- src/common/kiwix/manager.cpp | 10 ++++++++++ src/common/kiwix/manager.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/common/kiwix/manager.cpp b/src/common/kiwix/manager.cpp index 0200ddc8b..dfabebd8a 100644 --- a/src/common/kiwix/manager.cpp +++ b/src/common/kiwix/manager.cpp @@ -340,6 +340,16 @@ namespace kiwix { return this->library; } + bool Manager::getCurrentBook(Book &book) { + string currentBookId = getCurrentBookId(); + if (currentBookId.empty()) { + return false; + } else { + getBookById(currentBookId, book); + return true; + } + } + bool Manager::getBookById(const string id, Book &book) { std::vector::iterator itr; for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) { diff --git a/src/common/kiwix/manager.h b/src/common/kiwix/manager.h index 19dfcbdd2..9d415808c 100644 --- a/src/common/kiwix/manager.h +++ b/src/common/kiwix/manager.h @@ -60,6 +60,7 @@ namespace kiwix { const bool checkMetaData = false); Library cloneLibrary(); bool getBookById(const string id, Book &book); + bool getCurrentBook(Book &book); unsigned int getBookCount(const bool localBooks, const bool remoteBooks); bool updateBookLastOpenDateById(const string id); void removeBookPaths();