The BaseKeeper class.
More...
#include <BaseKeeper.h>
|
| static std::filesystem::path | get_books_path (const std::string &collection_name, const std::shared_ptr< AuxFunc > &af) |
| | Returns absolute path to directory containing collection books.
|
The BaseKeeper class.
This class is intended to keep and operate collections databases. loadCollection() method should be called first.
◆ BaseKeeper()
| BaseKeeper::BaseKeeper |
( |
const std::shared_ptr< AuxFunc > & | af | ) |
|
◆ booksWithNotes()
Lists all books of current collection, which have notes.
- Parameters
-
| notes | vector of notes (see NotesKeeper class documentation). |
- Returns
- Vector of books with notes.
◆ collectionAuthors()
| std::vector< std::string > BaseKeeper::collectionAuthors |
( |
| ) |
|
Lists all authors, found in collection.
- Returns
- Vector containing UTF-8 author's names strings.
◆ get_base_vector()
Returns copy of inner database vector.
- Returns
- Database vector.
◆ get_books_path()
| std::filesystem::path BaseKeeper::get_books_path |
( |
const std::string & | collection_name, |
|
|
const std::shared_ptr< AuxFunc > & | af ) |
|
static |
Returns absolute path to directory containing collection books.
This method can be called without collection loading to memory.
- Note
- This method can throw std::exception in case of errors.
- Parameters
-
| collection_name | collection name. |
| af | smart pointer to AuxFunc object. |
- Returns
- Absolute path to books directory.
◆ getBooksQuantity()
| size_t BaseKeeper::getBooksQuantity |
( |
| ) |
|
Returns total quantity of books in loaded collection.
- Note
- If this method is called during collection loading, it will block calling thread execution until collection is loaded.
- Returns
- Total books quantity in loaded collection.
◆ loadCollection()
| void BaseKeeper::loadCollection |
( |
const std::string & | col_name | ) |
|
Loads collection database to memory.
- Note
- This method can throw std::exception in case of errors.
- Parameters
-
◆ searchBook()
| std::vector< BookBaseEntry > BaseKeeper::searchBook |
( |
const BookBaseEntry & | search, |
|
|
const double & | coef_coincedence = double(0.7) ) |
Searches book in collection.
BookBaseEntry object must be provided as search request. It is necessary to fill in any field in the inner BookParseEntry object to receive particular result. Otherwise complete collection book list will be returned.
- Parameters
-
| search | BookBaseEntry object. If author search is needed bpe.book_author field must be in the following form: "Surname\7First
Name\7Second name". |
| coef_coincedence | Required coefficent of coincedence for search result. Allowed values are from 0.0 to 1.0. Default value is 0.7. If value is greater then 1.0, it means "exact match". In that case this method will return only results with the exact match for all search fields (empty search parameters are ignored). |
- Returns
- Vector of BookBaseEntry objects, containing search results.
◆ auth_show_progr
| std::function<void(const double &progr, const double &sz)> BaseKeeper::auth_show_progr |
collectionAuthors() progress callback
collectionAuthors() method execution can take some time. This callback indicates progress. progr is current progress in conventional units. sz is total quantity of conventional units to be processed.