void DirEntryList::remove(const string &name) { auto found = _findByName(name); if (found == _entries.end()) { throw fspp::fuse::FuseErrnoException(ENOENT); } _entries.erase(found); }
boost::optional<const DirEntry&> DirEntryList::get(const string &name) const { auto found = _findByName(name); if (found == _entries.end()) { return boost::none; } return *found; }
shared_ptr<HtmlAttribute> HtmlAttributes::get(const String &name) const { iterator i = _findByName(name); if(i != m_attributes.end()) return *i; return nullptr; }
void DirEntryList::rename(const blockstore::Key &key, const std::string &name, std::function<void (const blockstore::Key &key)> onOverwritten) { auto foundSameName = _findByName(name); if (foundSameName != _entries.end() && foundSameName->key() != key) { _checkAllowedOverwrite(foundSameName->type(), _findByKey(key)->type()); onOverwritten(foundSameName->key()); _entries.erase(foundSameName); } _findByKey(key)->setName(name); }
void DirEntryList::addOrOverwrite(const string &name, const Key &blobKey, fspp::Dir::EntryType entryType, mode_t mode, uid_t uid, gid_t gid, timespec lastAccessTime, timespec lastModificationTime, std::function<void (const blockstore::Key &key)> onOverwritten) { auto found = _findByName(name); if (found != _entries.end()) { onOverwritten(found->key()); _overwrite(found, name, blobKey, entryType, mode, uid, gid, lastAccessTime, lastModificationTime); } else { _add(name, blobKey, entryType, mode, uid, gid, lastAccessTime, lastModificationTime); } }
void HtmlAttributes::remove(const String &name) { iterator i = _findByName(name); if(i != m_attributes.end()) m_attributes.erase(i); }
bool HtmlAttributes::exists(const String &name) const { return _findByName(name) != m_attributes.end(); }
bool DirEntryList::_hasChild(const string &name) const { return _entries.end() != _findByName(name); }