Changeset View
Changeset View
Standalone View
Standalone View
src/qtquick/BookDatabase.h
Show All 19 Lines | |||||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #ifndef BOOKDATABASE_H | 22 | #ifndef BOOKDATABASE_H | ||
23 | #define BOOKDATABASE_H | 23 | #define BOOKDATABASE_H | ||
24 | 24 | | |||
25 | #include <QObject> | 25 | #include <QObject> | ||
26 | 26 | | |||
27 | struct BookEntry; | 27 | struct BookEntry; | ||
28 | /** | ||||
29 | * \brief A Class to hold a cache of known books to reduce the amount of time spent indexing. | ||||
leinir: That it's SQL is less important (that's sort of exposing implementation over concept), the… | |||||
30 | * | ||||
31 | * BookDatabase handles holding the conversion between SQL entry and | ||||
32 | * BookEntry structs. | ||||
33 | * | ||||
34 | * The BookEntry struct is defined in CategoryEntriesModel. | ||||
35 | */ | ||||
28 | class BookDatabase : public QObject | 36 | class BookDatabase : public QObject | ||
29 | { | 37 | { | ||
30 | Q_OBJECT | 38 | Q_OBJECT | ||
31 | public: | 39 | public: | ||
32 | explicit BookDatabase(QObject* parent = nullptr); | 40 | explicit BookDatabase(QObject* parent = nullptr); | ||
33 | ~BookDatabase() override; | 41 | ~BookDatabase() override; | ||
34 | 42 | | |||
43 | /** | ||||
44 | * @return a list of all known books in the database. | ||||
leinir: "a list of all known books" | |||||
45 | */ | ||||
35 | QList<BookEntry*> loadEntries(); | 46 | QList<BookEntry*> loadEntries(); | ||
47 | /** | ||||
48 | * \brief Add a new book to the cache. | ||||
leinir: "Add a new book to the cache" or somesuch? | |||||
49 | * @param entry The entry to add. | ||||
50 | */ | ||||
36 | void addEntry(BookEntry* entry); | 51 | void addEntry(BookEntry* entry); | ||
37 | private: | 52 | private: | ||
38 | class Private; | 53 | class Private; | ||
39 | Private* d; | 54 | Private* d; | ||
40 | }; | 55 | }; | ||
41 | 56 | | |||
42 | #endif//BOOKDATABASE_H | 57 | #endif//BOOKDATABASE_H |
That it's SQL is less important (that's sort of exposing implementation over concept), the point of the class is to provide a cache of known books, to reduce the amount of time spent searching for books on application startup