Library::getBooksCategories()

Note: no unit test added
This commit is contained in:
Veloman Yunkan committed 2021-06-08 20:37:00 +04:00
1 parent 3c3cf08a1a
commit b259afa408
2 files changed
+23 -1

No files matched your search

+15
View File
@@ -201,6 +201,21 @@ std::vector<std::string> Library::getBooksLanguages() const
return booksLanguages;
}
std::vector<std::string> Library::getBooksCategories() const
{
std::set<std::string> categories;
for (const auto& pair: m_books) {
const auto& book = pair.second;
const auto& c = book.getCategory();
if ( !c.empty() ) {
categories.insert(c);
}
}
return std::vector<std::string>(categories.begin(), categories.end());
}
std::vector<std::string> Library::getBooksCreators() const
{
std::vector<std::string> booksCreators;