BaseKeeper(3)

BaseKeeper(3) Library Functions Manual BaseKeeper(3)

NAME

BaseKeeper - The BaseKeeper class.

SYNOPSIS

#include <BaseKeeper.h>

Inherits UDBase.

Public Member Functions


BaseKeeper (const std::shared_ptr< MLBookProc > &mlbp)
BaseKeeper constructor. void loadCollection (const std::filesystem::path &base_path)
size_t getBooksQuantity ()
size_t getFilesQuantity ()
UDBase searchBook (const std::vector< UDBElement > &requests, const double &coef_coincedence)
void cancelSearch ()
std::string getCollectionType ()
std::filesystem::path getBooksDirectory ()
void editBookEntry (const UDBElement &book_search_result)
UDBase searchBooksWithNotes (const std::shared_ptr< NotesKeeper > &notes)
UDBase getAllFiles ()
UDBase listAllAuthors ()
void exportBase (const std::filesystem::path &result_path)
std::filesystem::path getCurrentCollectionBasePath ()
void unloadCollection ()

Static Public Member Functions


static UDBElement getBaseAnchorFileName (const std::filesystem::path &base_path)
static void importCollectionBase (const std::filesystem::path &source_base_path, const std::filesystem::path &coll_base_path, const std::filesystem::path &anchor_file)

Detailed Description

The BaseKeeper class.

This class keeps collection database and contains various methods to work with this database.

Constructor & Destructor Documentation

BaseKeeper::BaseKeeper (const std::shared_ptr< MLBookProc > & mlbp)

BaseKeeper constructor.

Parameters

mlbp Smart pointer to MLBookProc object.

Member Function Documentation

void BaseKeeper::cancelSearch ()

Interrupts all search operations.

void BaseKeeper::editBookEntry (const UDBElement & book_search_result)

Edits book entry in database (book file or book file path will not be modified).

Parameters

book_search_result UDBElement of BaseID::BookSearchResult type with edited values.

void BaseKeeper::exportBase (const std::filesystem::path & result_path)

Exports loaded collection database to file. This method should be used if you want share your collection database.

Note

This method can throw std::exception in case of errors.

Parameters

result_path Absolute path to file of result.

UDBase BaseKeeper::getAllFiles ()

Returns all collection files.

Note

This method can throw std::exception in case of errors.

Returns

UDBase object containing found BaseID::File objects.

UDBElement BaseKeeper::getBaseAnchorFileName (const std::filesystem::path & base_path) [static]

This method can be used to obtain anchor base path from file, obtained as a result of exportBase() method.

Parameters

base_path Path to base file.

Returns

UDBElement of BaseID::AnchorBasePath or BaseID::Error types.

std::filesystem::path BaseKeeper::getBooksDirectory ()

Returns books directory. Valid only for 'inpx' and 'legacy' collections.

Note

This method can throw std::exception in case of errors.

Returns

Path to collection books directory.

size_t BaseKeeper::getBooksQuantity ()

Returns collection books quantity.

Returns

Books quantity.

std::string BaseKeeper::getCollectionType ()

Returns loaded collection type.

Note

This method can throw std::exception in case of errors.

Returns

UTF-8 collection type string. Possible values: 'native', 'inpx', 'legacy'.

std::filesystem::path BaseKeeper::getCurrentCollectionBasePath ()

Returns loaded collection database file path.

Returns

Absolute path to loaded collection database file.

size_t BaseKeeper::getFilesQuantity ()

Returns collection files quantity.

Returns

Files quantity.

void BaseKeeper::importCollectionBase (const std::filesystem::path & source_base_path, const std::filesystem::path & coll_base_path, const std::filesystem::path & anchor_file) [static]

Imports collection database. Valid only for databases obtained by exportBase() method.

Note

This method can throw std::exception in case of errors.

Parameters

source_base_path Path to base which should be imported.
coll_base_path Path to base which should be created as a result.
anchor_file Absolute path to anchor file, obtained by getBaseAnchorFileName() method.

UDBase BaseKeeper::listAllAuthors ()

Collects all loaded collection authors.

Returns

UDBase object containing BaseID::AuthorSearchResult objects.

void BaseKeeper::loadCollection (const std::filesystem::path & base_path)

Loads collection database to memory.

Note

This method can throw std::exception in case of errors.

Parameters

base_path Path to collection database file.

UDBase BaseKeeper::searchBook (const std::vector< UDBElement > & requests, const double & coef_coincedence)

Searches books in loaded base.

requests vector can contain objects of following types: BaseID::Author, BaseID::BookTitle, BaseID::Sequence, BaseID::Genre.

Note

This method can throw std::exception in case of errors.

Parameters

requests Search parameters.
coef_coincedence Coefficient of coincidence. Should be more than 0 and less than or equal to 1.0.

Returns

UDBase object, containing search results (BaseID::BookSearchResult type) and BaseID::CollectionInfo object.

UDBase BaseKeeper::searchBooksWithNotes (const std::shared_ptr< NotesKeeper > & notes)

Searches books with notes in loaded collection database.

Note

This method can throw std::exception in case of errors.

Parameters

notes Smart pointer to NotesKeeper object.

Returns

UDBase object containing BaseID::BookSearchResult objects and BaseID::CollectionInfo object.

void BaseKeeper::unloadCollection ()

Clears collection database.

Author

Generated automatically by Doxygen for MLBookProc from the source code.

Version 2.1 MLBookProc