Debian Codegraph @

Source/Core/Common/FilesystemWatcher.h

raw symbols SCIP
1 // Copyright 2025 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <map>
7 #include <memory>
8 #include <string>
9 #include <string_view>
10
11 namespace wtr
12 {
13 inline namespace watcher
14 {
15 class watch;
16 }
17 } // namespace wtr
18
19 namespace Common
20 {
21 // A class that can watch a path and receive callbacks
22 // when files or directories underneath that path receive events
23 class FilesystemWatcher
24 {
25 public:
26 FilesystemWatcher();
27 virtual ~FilesystemWatcher();
28
29 void Watch(const std::string& path);
30 void Unwatch(const std::string& path);
31
32 private:
33 // A new file or folder was added to one of the watched paths
34 virtual void PathAdded(std::string_view path) {}
35
36 // A file or folder was modified in one of the watched paths
37 virtual void PathModified(std::string_view path) {}
38
39 // A file or folder was renamed in one of the watched paths
40 virtual void PathRenamed(std::string_view old_path, std::string_view new_path) {}
41
42 // A file or folder was deleted in one of the watched paths
43 virtual void PathDeleted(std::string_view path) {}
44
45 std::map<std::string, std::unique_ptr<wtr::watch>> m_watched_paths;
46 };
47 } // namespace Common