summaryrefslogtreecommitdiff
path: root/process_callback.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:19:14 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:19:14 +0200
commit01eb8253196672c969a39587e90b49321a182428 (patch)
tree4a3b71d7913de519744466c9227fda6461c4f0b5 /process_callback.h
parent5.0 (diff)
downloadFreeFileSync-01eb8253196672c969a39587e90b49321a182428.tar.gz
FreeFileSync-01eb8253196672c969a39587e90b49321a182428.tar.bz2
FreeFileSync-01eb8253196672c969a39587e90b49321a182428.zip
5.1
Diffstat (limited to 'process_callback.h')
-rw-r--r--process_callback.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/process_callback.h b/process_callback.h
new file mode 100644
index 00000000..77b2987f
--- /dev/null
+++ b/process_callback.h
@@ -0,0 +1,67 @@
+// **************************************************************************
+// * 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) ZenJu (zhnmju123 AT gmx DOT de) - All Rights Reserved *
+// **************************************************************************
+
+#ifndef PROC_HEADER_48257827842345454545
+#define PROC_HEADER_48257827842345454545
+
+#include <string>
+#include <zen/int64.h>
+
+//interface for comparison and synchronization process status updates (used by GUI or Batch mode)
+
+
+//report status during comparison and synchronization
+struct ProcessCallback
+{
+ virtual ~ProcessCallback() {}
+
+ //identifiers of different phases
+ enum Process
+ {
+ PROCESS_NONE = 10,
+ PROCESS_SCANNING,
+ PROCESS_COMPARING_CONTENT,
+ PROCESS_SYNCHRONIZING
+ };
+
+ //these methods have to be implemented in the derived classes to handle error and status information
+ virtual void initNewProcess(int objectsTotal, zen::Int64 dataTotal, Process processID) = 0; //informs about the total amount of data that will be processed from now on
+
+ //note: this one must NOT throw in order to properly allow undoing setting of statistics!
+ //it is in general paired with a call to requestUiRefresh() to compensate!
+ virtual void updateProcessedData(int objectsDelta, zen::Int64 dataDelta) = 0; //throw()!!
+ virtual void updateTotalData (int objectsDelta, zen::Int64 dataDelta) = 0; //
+ /*the estimated total may change *during* sync:
+ 1. move file -> fallback to copy + delete
+ 2. file copy, actual size changed after comparison
+ 3. auto-resolution for failed create operations due to missing source
+ 4. directory deletion: may contain more items than scanned by FFS: excluded by filter
+ 5. delete directory to recycler or move to user-defined dir on same volume: no matter how many sub-elements exist, this is only 1 object to process!
+ 6. user-defined deletion directory on different volume: full file copy required (instead of move) */
+
+ //opportunity to abort must be implemented in a frequently executed method like requestUiRefresh()
+ virtual void requestUiRefresh() = 0; //throw ?
+ virtual void forceUiRefresh () = 0; //throw ? - call before starting long running task which doesn't update regularly
+
+ //called periodically after data was processed: expected(!) to request GUI update
+ virtual void reportStatus(const std::wstring& text) = 0; //UI info only, should not be logged!
+
+ //called periodically after data was processed: expected(!) to request GUI update
+ virtual void reportInfo(const std::wstring& text) = 0;
+
+ virtual void reportWarning(const std::wstring& warningMessage, bool& warningActive) = 0;
+
+ //error handling:
+ enum Response
+ {
+ IGNORE_ERROR = 10,
+ RETRY
+ };
+ virtual Response reportError (const std::wstring& errorMessage) = 0; //recoverable error situation
+ virtual void reportFatalError(const std::wstring& errorMessage) = 0; //non-recoverable error situation
+};
+
+#endif //PROC_HEADER_48257827842345454545 \ No newline at end of file
bgstack15