aboutsummaryrefslogtreecommitdiffstats
path: root/lang/qt/src
diff options
context:
space:
mode:
Diffstat (limited to 'lang/qt/src')
-rw-r--r--lang/qt/src/debug.h16
-rw-r--r--lang/qt/src/util.h9
2 files changed, 16 insertions, 9 deletions
diff --git a/lang/qt/src/debug.h b/lang/qt/src/debug.h
index 791726ca..03894768 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
diff --git a/lang/qt/src/util.h b/lang/qt/src/util.h
index 475d477b..626de3df 100644
--- a/lang/qt/src/util.h
+++ b/lang/qt/src/util.h
@@ -38,7 +38,6 @@
#include <gpgme.h>
-#include <sstream>
#include <string>
#include <vector>
@@ -56,12 +55,4 @@ std::vector<std::string> toStrings(const QStringList &l);
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__