libquentier 0.8.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
ISyncConflictResolver.h
1/*
2 * Copyright 2021-2024 Dmitry Ivanov
3 *
4 * This file is part of libquentier
5 *
6 * libquentier is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, version 3 of the License.
9 *
10 * libquentier is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <quentier/utility/Linkage.h>
22
23#include <qevercloud/types/Note.h>
24#include <qevercloud/types/Notebook.h>
25#include <qevercloud/types/SavedSearch.h>
26#include <qevercloud/types/Tag.h>
27
28#include <QFuture>
29
30#include <variant>
31
32class QDebug;
33class QTextStream;
34
35namespace quentier::synchronization {
36
41class QUENTIER_EXPORT ISyncConflictResolver
42{
43public:
48 struct QUENTIER_EXPORT ConflictResolution
49 {
54 struct QUENTIER_EXPORT UseTheirs
55 {};
56
61 struct QUENTIER_EXPORT UseMine
62 {};
63
69 struct QUENTIER_EXPORT IgnoreMine
70 {};
71
80 template <class T>
81 struct MoveMine
82 {
83 using value_type = T;
84
89 };
90 };
91
92 using NotebookConflictResolution = std::variant<
96
97 using NoteConflictResolution = std::variant<
101
102 using SavedSearchConflictResolution = std::variant<
106
107 using TagConflictResolution = std::variant<
111
112public:
113 virtual ~ISyncConflictResolver() noexcept;
114
115 [[nodiscard]] virtual QFuture<NotebookConflictResolution>
116 resolveNotebookConflict(
117 qevercloud::Notebook theirs, qevercloud::Notebook mine) = 0;
118
119 [[nodiscard]] virtual QFuture<NoteConflictResolution> resolveNoteConflict(
120 qevercloud::Note theirs, qevercloud::Note mine) = 0;
121
122 [[nodiscard]] virtual QFuture<SavedSearchConflictResolution>
123 resolveSavedSearchConflict(
124 qevercloud::SavedSearch theirs, qevercloud::SavedSearch mine) = 0;
125
126 [[nodiscard]] virtual QFuture<TagConflictResolution> resolveTagConflict(
127 qevercloud::Tag theirs, qevercloud::Tag mine) = 0;
128};
129
130QUENTIER_EXPORT QTextStream & operator<<(
131 QTextStream & strm,
132 const ISyncConflictResolver::NotebookConflictResolution & resolution);
133
134QUENTIER_EXPORT QDebug & operator<<(
135 QDebug & dbg,
136 const ISyncConflictResolver::NotebookConflictResolution & resolution);
137
138QUENTIER_EXPORT QTextStream & operator<<(
139 QTextStream & strm,
140 const ISyncConflictResolver::NoteConflictResolution & resolution);
141
142QUENTIER_EXPORT QDebug & operator<<(
143 QDebug & dbg,
144 const ISyncConflictResolver::NoteConflictResolution & resolution);
145
146QUENTIER_EXPORT QTextStream & operator<<(
147 QTextStream & strm,
148 const ISyncConflictResolver::SavedSearchConflictResolution & resolution);
149
150QUENTIER_EXPORT QDebug & operator<<(
151 QDebug & dbg,
152 const ISyncConflictResolver::SavedSearchConflictResolution & resolution);
153
154QUENTIER_EXPORT QTextStream & operator<<(
155 QTextStream & strm,
156 const ISyncConflictResolver::TagConflictResolution & resolution);
157
158QUENTIER_EXPORT QDebug & operator<<(
159 QDebug & dbg,
160 const ISyncConflictResolver::TagConflictResolution & resolution);
161
162} // namespace quentier::synchronization
The ISyncConflictResolver interface provides methods used to resolve conflicts between local and remo...
Definition ISyncConflictResolver.h:42
The IgnoreMine conflict resolution means "use theirs versionand ignore mine version as it doesn't rea...
Definition ISyncConflictResolver.h:70
The MoveMine conflict resolution means "before using theirsversion change mine version as specified"....
Definition ISyncConflictResolver.h:82
The UseMine conflict resolution means "override theirs versionwith mine version".
Definition ISyncConflictResolver.h:62
The UseTheirs conflict resolution means "override mine versionwith theirs version".
Definition ISyncConflictResolver.h:55
The ConflictResolution struct is a namespace inside which several other structs determining actual co...
Definition ISyncConflictResolver.h:49