Use a map to store the Library's books.

Having the books sorted is useless.
We handle books by id not by index.
This commit is contained in:
Matthieu Gautier
2018-08-30 11:23:39 +02:00
parent 541fb0cfd1
commit 57ac6f0305
5 changed files with 27 additions and 58 deletions

View File

@ -24,7 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#include <map>
#include "common/regexTools.h"
#include "common/stringTools.h"
@ -88,7 +88,7 @@ class Book
*/
class Library
{
std::vector<kiwix::Book> books;
std::map<std::string, kiwix::Book> books;
public:
Library();
~Library();
@ -108,7 +108,6 @@ class Library
Book& getBookById(const std::string& id);
bool removeBookByIndex(const unsigned int bookIndex);
/**
* Remove a book from the library.
*