add nf7::File::Touch()

This commit is contained in:
falsycat 2022-06-10 19:34:14 +09:00
parent 85f7eccdad
commit 34dff99a1b
5 changed files with 7 additions and 11 deletions

View File

@ -86,11 +86,6 @@ class Obj final : public nf7::File,
nf7::FileRef src_;
void Touch() noexcept {
if (!id()) return;
env().Handle({.id = id(), .type = Event::kUpdate});
}
void Reset() noexcept;
};

View File

@ -153,9 +153,6 @@ class Network final : public nf7::File,
std::make_shared<nf7::GenericContext>(*this, "applying command to redo"),
[this]() { history_.ReDo(); });
}
void Touch() {
env().Handle({ .id = id(), .type = Event::kUpdate, });
}
void QueueCommand(const std::shared_ptr<nf7::Context>& ctx,
std::unique_ptr<History::Command>&& cmd) noexcept {

View File

@ -98,9 +98,6 @@ class NativeFile final : public File,
nf7::NativeFile>(*this, env().npath()/npath_, flags, exlock);
buf_ = std::make_shared<nf7::AsyncBufferAdaptor>(buf, buf);
}
void Touch() noexcept {
env().Handle({.id = id(), .type = Event::kUpdate,});
}
};
void NativeFile::Update() noexcept {

4
nf7.cc
View File

@ -142,6 +142,10 @@ File& File::ancestorOrThrow(size_t dist) const {
if (!f) throw NotFoundException("cannot go up over the root");
return const_cast<File&>(*f);
}
void File::Touch() noexcept {
if (!id()) return;
env().Handle({.id = id(), .type = Event::kUpdate});
}
File::TypeInfo::TypeInfo(const std::string& name,
std::unordered_set<std::string>&& flags) noexcept :

3
nf7.hh
View File

@ -117,6 +117,9 @@ class File {
File* parent() const noexcept { return parent_; }
const std::string& name() const noexcept { return name_; }
protected:
void Touch() noexcept;
private:
const TypeInfo* const type_;
Env* const env_;