+ code to pupulate publisher list in the content manager

This commit is contained in:
kelson42 2011-10-11 20:33:08 +00:00
parent 8b5559af2b
commit 5cd20c8fa7
2 changed files with 17 additions and 0 deletions

View File

@ -345,6 +345,22 @@ namespace kiwix {
return booksLanguages;
}
vector<string> Manager::getBooksPublishers() {
std::vector<string> booksPublishers;
std::vector<kiwix::Book>::iterator itr;
std::map<string, bool> booksPublishersMap;
std::sort(library.books.begin(), library.books.end(), kiwix::Book::sortByPublisher);
for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) {
if (booksPublishersMap.find(itr->creator) == booksPublishersMap.end()) {
booksPublishersMap[itr->creator] = true;
booksPublishers.push_back(itr->creator);
}
}
return booksPublishers;
}
kiwix::Library Manager::cloneLibrary() {
return this->library;
}

View File

@ -65,6 +65,7 @@ namespace kiwix {
void removeBookPaths();
bool listBooks(const supportedListMode mode, const supportedListSortBy sortBy, const unsigned int maxSize);
vector<string> getBooksLanguages();
vector<string> getBooksPublishers();
string writableLibraryPath;