5 #include <unordered_map> 14 std::size_t
operator()(
const std::filesystem::path& path)
const {
15 return std::filesystem::hash_value(path);
22 std::shared_ptr< details::Entry >
23 BookStore::addEntry(
const std::shared_ptr< EntryBase > &entry,
25 key.
idx = _entries.size() ;
33 _entries.push_back( std::make_shared< details::Entry >(
details::Entry( entry, key ) ) ) ;
34 return _entries.back() ;
50 void BookStore::storeSelection(
58 return Selection::find( _entries.cbegin(), _entries.cend(), cond ) ;
64 return Selection::findFirst(_entries.cbegin(), _entries.cend(), cond);
69 void BookStore::remove(
const EntryKey &key ) {
get( key ).clear(); }
73 void BookStore::remove(
const Selection &selection ) {
81 void BookStore::clear() { _entries.resize( 0 ); }
85 std::size_t BookStore::Identifier::Hash::
87 return std::filesystem::hash_value(
id._path);
92 std::filesystem::path BookStore::normalizeDirPath(
const std::filesystem::path& path) {
93 if(!path.is_absolute() || path.has_filename()) {
96 +
"' is not an absolute path to folder!");
98 return std::filesystem::absolute(path);
Data selection to identify and manage an Entry.
#define MARLIN_BOOK_THROW(message)
std::filesystem::path path
virtual Entry path
Wrapper for weak pointer to Entry.
void writeSelection(const Selection &sel)
std::size_t operator()(const std::filesystem::path &path) const
helper to create a Condition.
Contains references to entries.
holds references for identify an entry.
std::size_t idx
unique number for Entry
class to store and manage objects in BookStore.
wrapper class for an Entry filter function.