summaryrefslogtreecommitdiff
path: root/lang/qt/src/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'lang/qt/src/debug.h')
-rw-r--r--lang/qt/src/debug.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/lang/qt/src/debug.h b/lang/qt/src/debug.h
index 791726c..0389476 100644
--- a/lang/qt/src/debug.h
+++ b/lang/qt/src/debug.h
@@ -36,6 +36,8 @@
#include "qgpgme_export.h"
+#include <sstream>
+
namespace GpgME
{
class Error;
@@ -45,4 +47,18 @@ class QDebug;
QGPGME_EXPORT QDebug operator<<(QDebug debug, const GpgME::Error &err);
+namespace QGpgME
+{
+/**
+ * Helper to log GpgME objects which provide the output stream operator.
+ */
+template<class GpgMEClass>
+std::string toLogString(const GpgMEClass &object)
+{
+ std::stringstream stream;
+ stream << object;
+ return stream.str();
+}
+}
+
#endif // QGPGME_DEBUG_H