SyncSnapshot.h header
#include <ew/app/SyncSnapshot.h>
Namespace ew::app
BinaryChanges struct
struct ew::app::BinaryChanges
The binary (media asset) files that differ between two fingerprint maps (see readBinaryFingerprints), classified as added, removed, or modified. Used to report that a co-author or sync client changed media assets since a project was opened.
Members
QStringList ew::app::BinaryChanges::added
Paths present in the current map but not the base (a new asset appeared on disk).
QStringList ew::app::BinaryChanges::removed
Paths present in the base but not the current map (an asset was deleted on disk).
QStringList ew::app::BinaryChanges::modified
Paths in both maps whose content hash differs (an asset was replaced on disk).
bool ew::app::BinaryChanges::any() const
Whether any asset changed.
int ew::app::BinaryChanges::count() const
The total number of changed assets (added + removed + modified).
Functions
bool ew::app::deleteTextFiles(const QString &directory, const std::vector< QString > &paths)
Deletes each of paths (forward-slash, directory-relative) from directory. A path already absent is treated as success (there is nothing to remove); the return is true only when every path is absent afterward – i.e. no existing file failed to delete. This is the removal counterpart to writeTextFiles: apply the deletions from a reconciled ReconcileApplyPlan so a file removed on one side is not silently resurrected when the project is reloaded from disk. Empty directories left behind are not pruned.
BinaryChanges ew::app::diffFingerprints(const QMap< QString, QString > &base, const QMap< QString, QString > ¤t)
Compares a base fingerprint map against a current one (both from readBinaryFingerprints) and reports which binary assets were added, removed, or modified.
bool ew::app::isTextProjectPath(const QString &path)
True when path is part of the folder-of-text store's mergeable text content by extension (.json, .md, .txt, .yaml, .yml) – the rule readTextSnapshot and readBinaryFingerprints partition the project tree by, exposed so the .ewriter bundle snapshot readers partition identically (the text/binary split must agree between a folder on disk and a bundle's entries, or the reconcile would compare mismatched sets).
QMap< QString, QString > ew::app::readBinaryFingerprints(const QString &directory)
Fingerprints every binary (non-text) file under directory into a map from forward-slash, directory-relative path to a content hash (hex SHA-1). These are the project's media assets – images, audio, video – which the folder-of-text reconcile deliberately skips (they cannot be line-merged), so this is the companion that lets external changes to them be detected. The text extensions readTextSnapshot reads are excluded here (the two partition the tree). A missing directory yields an empty map.
QMap< QString, QString > ew::app::readTextSnapshot(const QString &directory)
Reads every text file under directory (recursively) into a map from forward-slash, directory-relative path to the file's UTF-8 content. Only files with a text extension are included – .json, .md, .txt, .yaml, .yml – which is exactly the folder-of-text project store's canonical content; binary media assets and the derived index are skipped so they never reach the line-level merge. Paths use '/' on every platform for stable, mergeable keys. A missing directory yields an empty map. Pair with mergeProjectSnapshots to reconcile two checkouts of a project against a common base.
QStringList ew::app::watchableProjectPaths(const QString &directory)
The filesystem paths a change-watcher should watch to notice external edits to the folder-of-text project under directory: the directory itself, every subdirectory (so files added, removed, or renamed are noticed), and every text file the reconcile compares – the same text extensions readTextSnapshot reads, so in-place content edits are noticed too. Binary media assets are omitted because the reconcile ignores them. Returns absolute paths; empty if directory does not exist. Pair with readTextSnapshot/reconcileWithDisk so the watched set matches the reconciled set.
bool ew::app::writeTextFiles(const QString &directory, const QMap< QString, QString > &files)
Writes each entry of files (forward-slash, directory-relative path -> UTF-8 content) into directory, creating parent folders as needed and overwriting existing files. Returns true only if every file was written. This is the counterpart to readTextSnapshot: apply a reconciled set of file contents back to a project folder. It never deletes; callers handle removals separately.