+ improve filter

This commit is contained in:
kelson42 2011-10-11 22:22:14 +00:00
parent 5cd20c8fa7
commit aadce46adf
2 changed files with 10 additions and 2 deletions

View File

@ -435,7 +435,8 @@ namespace kiwix {
return result;
}
bool Manager::listBooks(const supportedListMode mode, const supportedListSortBy sortBy, const unsigned int maxSize) {
bool Manager::listBooks(const supportedListMode mode, const supportedListSortBy sortBy, const unsigned int maxSize,
const string language, const string publisher) {
this->bookIdList.clear();
std::vector<kiwix::Book>::iterator itr;
@ -470,6 +471,12 @@ namespace kiwix {
if (atoi(itr->size.c_str()) > maxSize * 1024 * 1024)
ok = false;
if (!language.empty() && itr->language != language)
ok = false;
if (!publisher.empty() && itr->creator != publisher)
ok = false;
if (ok == true)
this->bookIdList.push_back(itr->id);
}

View File

@ -63,7 +63,8 @@ namespace kiwix {
unsigned int getBookCount(const bool localBooks, const bool remoteBooks);
bool updateBookLastOpenDateById(const string id);
void removeBookPaths();
bool listBooks(const supportedListMode mode, const supportedListSortBy sortBy, const unsigned int maxSize);
bool listBooks(const supportedListMode mode, const supportedListSortBy sortBy, const unsigned int maxSize,
const string language, const string publisher);
vector<string> getBooksLanguages();
vector<string> getBooksPublishers();