Cogs.Core
FileSystemWatcher.h
1#pragma once
2
3#include "../StringView.h"
4
5#include <functional>
6#include <memory>
7
8namespace Cogs {
9 struct Storage;
10
11 class COGSFOUNDATION_API FileSystemWatcher {
12 public:
13 enum class EventType {
14 None = 0,
15 FileCreated = 1,
16 FileDeleted = 2,
17 FileRenamed = 3,
18 FileUpdated = 4,
19 };
20
21 struct Event {
22 StringView path;
23 EventType eventType;
24 };
25
26 using CallbackFn = std::function<void (const Event &)>;
27 using CallbackList = std::vector<CallbackFn>;
28
31
32 bool watchFile(const StringView& path, const CallbackFn& callback);
33 bool unwatchFile(const StringView& path);
34
35 private:
36 Storage* storage = nullptr;
37 };
38}
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains all Cogs related functionality.
Definition: FieldSetter.h:23