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
91
92
93
94
95
96
97
98
99
100
|
// **************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under *
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) *
// **************************************************************************
//
#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;
typedef std::vector<std::pair<Zstring, wxString> > ConflictTexts; // Pair(filename/conflict text)
const ConflictTexts& getFirstConflicts() const; //get first few sync conflicts
wxULongLong getDataToProcess() const;
size_t 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;
ConflictTexts firstConflicts; //save the first few conflict texts to display as a warning message
wxULongLong dataToProcess;
size_t rowsTotal;
};
bool synchronizationNeeded(const FolderComparison& folderCmp);
class SynchronizeFolderPair;
struct FolderPairSyncCfg
{
FolderPairSyncCfg(bool automaticMode,
const DeletionPolicy handleDel,
const Zstring& custDelDir);
bool inAutomaticMode; //update database if in automatic mode
DeletionPolicy handleDeletion;
Zstring custDelFolder; //formatted(!) directory name
};
std::vector<FolderPairSyncCfg> extractSyncCfg(const MainConfiguration& mainCfg);
//class handling synchronization process
class SyncProcess
{
public:
SyncProcess(bool copyFileSymLinks,
bool traverseDirSymLinks,
xmlAccess::OptionalDialogs& warnings,
bool verifyCopiedFiles,
bool copyLockedFiles,
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 SynchronizeFolderPair;
const bool m_copyFileSymLinks;
const bool m_traverseDirSymLinks;
const bool m_verifyCopiedFiles;
const bool copyLockedFiles_;
//warnings
xmlAccess::OptionalDialogs& m_warnings;
StatusHandler& statusUpdater;
};
}
#endif // SYNCHRONIZATION_H_INCLUDED
|