| 1 |
|
| 2 |
|
| 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 |
} |
| 18 |
|
| 19 |
namespace Common |
| 20 |
{ |
| 21 |
|
| 22 |
|
| 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 |
|
| 34 |
virtual void PathAdded(std::string_view path) {} |
| 35 |
|
| 36 |
|
| 37 |
virtual void PathModified(std::string_view path) {} |
| 38 |
|
| 39 |
|
| 40 |
virtual void PathRenamed(std::string_view old_path, std::string_view new_path) {} |
| 41 |
|
| 42 |
|
| 43 |
virtual void PathDeleted(std::string_view path) {} |
| 44 |
|
| 45 |
std::map<std::string, std::unique_ptr<wtr::watch>> m_watched_paths; |
| 46 |
}; |
| 47 |
} |