1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#ifndef SYNCHRONIZATION_H_INCLUDED
#define SYNCHRONIZATION_H_INCLUDED
#include "fileHierarchy.h"
#include "library/processXml.h"
class StatusHandler;
namespace FreeFileSync
{
class SyncStatistics
{
public:
SyncStatistics(const HierarchyObject& hierObj);
SyncStatistics(const FolderComparison& folderCmp);
int getCreate( bool inclLeft = true, bool inclRight = true) const;
int getOverwrite(bool inclLeft = true, bool inclRight = true) const;
int getDelete( bool inclLeft = true, bool inclRight = true) const;
int getConflict() const;
wxULongLong getDataToProcess() const;
int getRowCount() const;
private:
void init();
void getNumbersRecursively(const HierarchyObject& hierObj);
void getFileNumbers(const FileMapping& fileObj);
void getDirNumbers(const DirMapping& dirObj);
int createLeft, createRight;
int overwriteLeft, overwriteRight;
int deleteLeft, deleteRight;
int conflict;
wxULongLong dataToProcess;
int rowsTotal;
};
bool synchronizationNeeded(const FolderComparison& folderCmp);
class SyncRecursively;
struct FolderPairSyncCfg
{
FolderPairSyncCfg(bool inAutomaticMode,
const DeletionPolicy handleDel,
const Zstring& custDelDir) :
updateSyncDB(inAutomaticMode),
handleDeletion(handleDel),
custDelFolder(custDelDir) {}
bool updateSyncDB; //update database if in automatic mode
DeletionPolicy handleDeletion;
Zstring custDelFolder;
};
std::vector<FolderPairSyncCfg> extractSyncCfg(const MainConfiguration& mainCfg);
//class handling synchronization process
class SyncProcess
{
public:
SyncProcess(const bool copyFileSymLinks,
const bool traverseDirSymLinks,
xmlAccess::OptionalDialogs& warnings,
const bool verifyCopiedFiles,
StatusHandler& handler);
//CONTRACT: syncConfig must have SAME SIZE folderCmp and correspond per row!
void startSynchronizationProcess(const std::vector<FolderPairSyncCfg>& syncConfig, FolderComparison& folderCmp);
private:
friend class SyncRecursively;
const bool m_copyFileSymLinks;
const bool m_traverseDirSymLinks;
const bool m_verifyCopiedFiles;
//warnings
xmlAccess::OptionalDialogs& m_warnings;
StatusHandler& statusUpdater;
};
}
#endif // SYNCHRONIZATION_H_INCLUDED
|