summaryrefslogtreecommitdiff
path: root/bin/bbackupquery/BoxBackupCompareParams.h
blob: d8c50fc362478a25c8943c2a5a4e53385f9e8c78 (plain)
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
101
102
// --------------------------------------------------------------------------
//
// File
//		Name:    BoxBackupCompareParams.h
//		Purpose: Parameters and notifiers for a compare operation
//		Created: 2008/12/30
//
// --------------------------------------------------------------------------

#ifndef BOXBACKUPCOMPAREPARAMS__H
#define BOXBACKUPCOMPAREPARAMS__H

#include <string>

#include "BoxTime.h"
#include "ExcludeList.h"
#include "BackupClientMakeExcludeList.h"

// --------------------------------------------------------------------------
//
// Class
//		Name:    BoxBackupCompareParams
//		Purpose: Parameters and notifiers for a compare operation
//		Created: 2003/10/10
//
// --------------------------------------------------------------------------
class BoxBackupCompareParams
{
private:
	std::auto_ptr<const ExcludeList> mapExcludeFiles, mapExcludeDirs;
	bool mQuickCompare;
	bool mIgnoreExcludes;
	bool mIgnoreAttributes;
	box_time_t mLatestFileUploadTime;
	
public:
	BoxBackupCompareParams(bool QuickCompare, bool IgnoreExcludes,
		bool IgnoreAttributes, box_time_t LatestFileUploadTime)
	: mQuickCompare(QuickCompare),
	  mIgnoreExcludes(IgnoreExcludes),
	  mIgnoreAttributes(IgnoreAttributes),
	  mLatestFileUploadTime(LatestFileUploadTime)
	{ }
	
	virtual ~BoxBackupCompareParams() { }
	
	bool QuickCompare() { return mQuickCompare; }
	bool IgnoreExcludes() { return mIgnoreExcludes; }
	bool IgnoreAttributes() { return mIgnoreAttributes; }
	box_time_t LatestFileUploadTime() { return mLatestFileUploadTime; }
		
	void LoadExcludeLists(const Configuration& rLoc)
	{
		mapExcludeFiles.reset(BackupClientMakeExcludeList_Files(rLoc));
		mapExcludeDirs.reset(BackupClientMakeExcludeList_Dirs(rLoc));
	}
	bool IsExcludedFile(const std::string& rLocalPath)
	{
		if (!mapExcludeFiles.get()) return false;
		return mapExcludeFiles->IsExcluded(rLocalPath);
	}
	bool IsExcludedDir(const std::string& rLocalPath)
	{
		if (!mapExcludeDirs.get()) return false;
		return mapExcludeDirs->IsExcluded(rLocalPath);
	}

	virtual void NotifyLocalDirMissing(const std::string& rLocalPath,
		const std::string& rRemotePath) = 0;
	virtual void NotifyLocalDirAccessFailed(const std::string& rLocalPath,
		const std::string& rRemotePath) = 0;
	virtual void NotifyStoreDirMissingAttributes(const std::string& rLocalPath,
		const std::string& rRemotePath) = 0;
	virtual void NotifyRemoteFileMissing(const std::string& rLocalPath,
		const std::string& rRemotePath,
		bool modifiedAfterLastSync) = 0;
	virtual void NotifyLocalFileMissing(const std::string& rLocalPath,
		const std::string& rRemotePath) = 0;
	virtual void NotifyExcludedFileNotDeleted(const std::string& rLocalPath,
		const std::string& rRemotePath) = 0;
	virtual void NotifyDownloadFailed(const std::string& rLocalPath,
		const std::string& rRemotePath, int64_t NumBytes,
		BoxException& rException) = 0;
	virtual void NotifyDownloadFailed(const std::string& rLocalPath,
		const std::string& rRemotePath, int64_t NumBytes,
		std::exception& rException) = 0;
	virtual void NotifyDownloadFailed(const std::string& rLocalPath,
		const std::string& rRemotePath, int64_t NumBytes) = 0;
	virtual void NotifyExcludedFile(const std::string& rLocalPath,
		const std::string& rRemotePath) = 0;
	virtual void NotifyExcludedDir(const std::string& rLocalPath,
		const std::string& rRemotePath) = 0;
	virtual void NotifyDirCompared(const std::string& rLocalPath,
		const std::string& rRemotePath,	bool HasDifferentAttributes,
		bool modifiedAfterLastSync) = 0;
	virtual void NotifyFileCompared(const std::string& rLocalPath,
		const std::string& rRemotePath, int64_t NumBytes,
		bool HasDifferentAttributes, bool HasDifferentContents,
		bool modifiedAfterLastSync, bool newAttributesApplied) = 0;
};

#endif // BOXBACKUPCOMPAREPARAMS__H