From d911a1536488a5645f257a48b4d9cf221c0ed6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Wed, 4 May 2022 12:37:47 +0200 Subject: cpp: Allow merging the results of two imports * lang/cpp/src/importresult.h, lang/cpp/src/importresult.cpp (class ImportResult): Add member function mergeWith. -- This allows creating a consolidated result of several independent imports. If the import results to merge considered the same keys, then not all counts can be consolidated correctly, but the important numbers like the number of considered keys, the number of imported keys, the number of unchanged keys and the numbers of new user IDs, subkeys, signatures and revocations should be correct. GnuPG-bug-id: 5951 --- lang/cpp/src/importresult.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lang/cpp/src/importresult.h') diff --git a/lang/cpp/src/importresult.h b/lang/cpp/src/importresult.h index bcd956c3..59366984 100644 --- a/lang/cpp/src/importresult.h +++ b/lang/cpp/src/importresult.h @@ -60,6 +60,16 @@ public: swap(this->d, other.d); } + /** + * Merges the result @p other into this result (and all of its copies). + * + * @note The merge algorithm assumes that @p other is the result of an + * import that was performed after the import of this result. + * @note Some numbers cannot be consolidated reliably, e.g. the number of + * keys without user ID. + */ + void mergeWith(const ImportResult &other); + bool isNull() const; int numConsidered() const; -- cgit v1.2.3