8#include <unordered_map>
18 using on_entry_created_t = std::function<void(
const std::string&,
const fs::path&,
const std::vector<fs::path>&,
bool)>;
19 using on_entry_modified_t = std::function<void(
const std::string&,
const fs::path&,
const std::vector<fs::path>&,
bool)>;
20 using on_entry_removed_t = std::function<void(
const std::string&,
const fs::path&,
const std::vector<fs::path>&)>;
31 using mapping_t = std::unordered_map<std::string, mapping>;
46 const std::vector<std::string>& synced_ext,
65 void sync(
const fs::path& reference_dir,
const fs::path& synced_dir);
76 auto get_mapping(
const std::string& ext) ->
mapping;
87 auto get_synced_directory(
const fs::path& path) -> fs::path;
95 auto get_synced_entries(
const fs::path& path,
bool is_directory) -> std::vector<fs::path>;
103 auto get_watch_path() -> fs::path;
110 fs::path reference_dir_;
112 fs::path synced_dir_;
114 std::atomic<std::uint64_t> watch_id_ = {0};
std::pair< fs::path, fs::path > rename_pair_t
std::function< void(const std::string &, const fs::path &, const std::vector< fs::path > &, bool)> on_entry_created_t
std::function< void(const std::string &, const fs::path &, const std::vector< fs::path > &, bool)> on_entry_modified_t
void unsync()
Stops syncing.
void set_mapping(const std::string &ref_ext, const std::vector< std::string > &synced_ext, on_entry_created_t on_entry_created, on_entry_modified_t on_entry_modified, on_entry_removed_t on_entry_removed, on_entry_renamed_t on_entry_renamed)
Remaps a specific extension of the reference directory to extensions of the synced directory....
std::function< void(const std::string &, const rename_pair_t &, const std::vector< rename_pair_t > &)> on_entry_renamed_t
void sync(const fs::path &reference_dir, const fs::path &synced_dir)
Start syncing the synced_dir with reference to the reference_dir i.e changes that occur in the refere...
void set_directory_mapping(on_entry_created_t on_entry_created, on_entry_modified_t on_entry_modified, on_entry_removed_t on_entry_removed, on_entry_renamed_t on_entry_renamed)
std::unordered_map< std::string, mapping > mapping_t
std::function< void(const std::string &, const fs::path &, const std::vector< fs::path > &)> on_entry_removed_t
std::vector< std::string > extensions
on_entry_removed_t on_entry_removed
on_entry_modified_t on_entry_modified
on_entry_renamed_t on_entry_renamed
on_entry_created_t on_entry_created