Unravel Engine C++ Reference
Loading...
Searching...
No Matches
fs::syncer Class Reference

#include <syncer.h>

Classes

struct  mapping
 

Public Types

using rename_pair_t = std::pair<fs::path, fs::path>
 
using on_entry_created_t = std::function<void(const std::string&, const fs::path&, const std::vector<fs::path>&, bool)>
 
using on_entry_modified_t = std::function<void(const std::string&, const fs::path&, const std::vector<fs::path>&, bool)>
 
using on_entry_removed_t = std::function<void(const std::string&, const fs::path&, const std::vector<fs::path>&)>
 
using on_entry_renamed_t = std::function<void(const std::string&, const rename_pair_t&, const std::vector<rename_pair_t>&)>
 
using mapping_t = std::unordered_map<std::string, mapping>
 

Public Member Functions

 syncer ()=default
 
 ~syncer ()
 
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. You will get notified with entries of the synced directory with 'synced_ext' when an entry with the ref_ext in the reference directory gets changed.
 
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)
 
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 reference_dir will be reported on entries in the synced_dir.
 
void unsync ()
 Stops syncing.
 

Detailed Description

Definition at line 13 of file syncer.h.

Member Typedef Documentation

◆ mapping_t

using fs::syncer::mapping_t = std::unordered_map<std::string, mapping>

Definition at line 31 of file syncer.h.

◆ on_entry_created_t

using fs::syncer::on_entry_created_t = std::function<void(const std::string&, const fs::path&, const std::vector<fs::path>&, bool)>

Definition at line 18 of file syncer.h.

◆ on_entry_modified_t

using fs::syncer::on_entry_modified_t = std::function<void(const std::string&, const fs::path&, const std::vector<fs::path>&, bool)>

Definition at line 19 of file syncer.h.

◆ on_entry_removed_t

using fs::syncer::on_entry_removed_t = std::function<void(const std::string&, const fs::path&, const std::vector<fs::path>&)>

Definition at line 20 of file syncer.h.

◆ on_entry_renamed_t

using fs::syncer::on_entry_renamed_t = std::function<void(const std::string&, const rename_pair_t&, const std::vector<rename_pair_t>&)>

Definition at line 21 of file syncer.h.

◆ rename_pair_t

using fs::syncer::rename_pair_t = std::pair<fs::path, fs::path>

Definition at line 16 of file syncer.h.

Constructor & Destructor Documentation

◆ syncer()

fs::syncer::syncer ( )
default

◆ ~syncer()

fs::syncer::~syncer ( )

Definition at line 19 of file syncer.cpp.

Member Function Documentation

◆ set_directory_mapping()

void fs::syncer::set_directory_mapping ( syncer::on_entry_created_t on_entry_created,
syncer::on_entry_modified_t on_entry_modified,
syncer::on_entry_removed_t on_entry_removed,
syncer::on_entry_renamed_t on_entry_renamed )

Definition at line 40 of file syncer.cpp.

◆ set_mapping()

void fs::syncer::set_mapping ( const std::string & ref_ext,
const std::vector< std::string > & synced_ext,
on_entry_created_t on_entry_created = nullptr,
on_entry_modified_t on_entry_modified = nullptr,
on_entry_removed_t on_entry_removed = nullptr,
on_entry_renamed_t on_entry_renamed = nullptr )

Remaps a specific extension of the reference directory to extensions of the synced directory. You will get notified with entries of the synced directory with 'synced_ext' when an entry with the ref_ext in the reference directory gets changed.

Definition at line 24 of file syncer.cpp.

◆ sync()

void fs::syncer::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 reference_dir will be reported on entries in the synced_dir.

Definition at line 90 of file syncer.cpp.

◆ unsync()

void fs::syncer::unsync ( )

Stops syncing.

Definition at line 53 of file syncer.cpp.


The documentation for this class was generated from the following files: