qt: Add debug helper for Result classes with output stream operator

* lang/qt/src/util.h (toLogString): New.
--

GnuPG-bug-id: 5951
This commit is contained in:
Ingo Klöcker 2022-05-02 15:06:56 +02:00
parent 0c304beeaa
commit 99fd565889

View File

@ -36,6 +36,7 @@
#include <gpgme.h> #include <gpgme.h>
#include <sstream>
#include <string> #include <string>
#include <vector> #include <vector>
@ -55,4 +56,12 @@ std::vector<std::string> toStrings(const QStringList &l);
QStringList toFingerprints(const std::vector<GpgME::Key> &keys); QStringList toFingerprints(const std::vector<GpgME::Key> &keys);
template<class Result>
std::string toLogString(const Result &result)
{
std::stringstream stream;
stream << result;
return stream.str();
}
#endif // __QGPGME_UTIL_H__ #endif // __QGPGME_UTIL_H__