Skip to content

SourceWatcher

class SourceWatcher

Source Watcher.

Watches for changes of source files. The files to watch are specified by a glob pattern.

Variables

Name Description
patterns The patterns to watch.
tracked_files The tracked file paths and their last modification time.

Functions

Name Description
SourceWatcher Constructor for a list of patterns.
SourceWatcher Constructor for a single pattern.
changed Check if any of the watched files changed since the last call to changed() or diff().
diff Check if any of the watched files changed since the last call to changed() or diff().
filenames The current source files.

Variable Details

patterns

std::list<std::string> patterns

The patterns to watch.

tracked_files

std::unordered_map<std::filesystem::path, std::filesystem::file_time_type> tracked_files

The tracked file paths and their last modification time.

Function Details

SourceWatcher

SourceWatcher(std::list<std::string> patterns)

Constructor for a list of patterns.

patterns :

SourceWatcher(std::string pattern)

Constructor for a single pattern.

changed

bool changed()

Check if any of the watched files changed since the last call to changed() or diff().

diff

std::tuple<std::unordered_set<std::filesystem::path>, std::unordered_set<std::filesystem::path>, std::unordered_set<std::filesystem::path>> diff()

Check if any of the watched files changed since the last call to changed() or diff().

Return
A tuple containing sets of added, modified and deleted file paths.

filenames

std::unordered_set<std::filesystem::path> filenames()

The current source files.