[telepathy-qt4/master] Move workaround for missing QVariant::operator== from types.h to .cpp

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Nov 12 10:53:17 PST 2009


Because a public header can't #include config.h,
HAVE_QDBUSVARIANT_OPERATOR_EQUAL was never defined in types.h even if
the user's Qt version has QVariant::operator==, so we produced a duplicate
definition in any such Qt version.

To avoid causing this conflict, limit the scope of our workaround to
types.cpp, which means tp-qt4 itself can compile, without polluting our
public headers. Some tp-qt4 users might have to apply the same workaround
themselves.

Reviewed-by: Andre Moreira Magalhaes <andre.magalhaes at collabora.co.uk>
---
 TelepathyQt4/types.cpp |   13 +++++++++++++
 TelepathyQt4/types.h   |   12 ------------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/TelepathyQt4/types.cpp b/TelepathyQt4/types.cpp
index 618af9b..09990f9 100644
--- a/TelepathyQt4/types.cpp
+++ b/TelepathyQt4/types.cpp
@@ -19,6 +19,19 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "config.h"
 #include <TelepathyQt4/Types>
 
+#ifndef HAVE_QDBUSVARIANT_OPERATOR_EQUAL
+
+/* FIXME This is a workaround that should be removed when Qt has support for
+ *       this. There is already a merge request
+ *       (http://qt.gitorious.org/qt/qt/merge_requests/1657) in place and the
+ *       fix should be in next Qt versions.
+ */
+inline bool operator==(const QDBusVariant &v1, const QDBusVariant &v2)
+{ return v1.variant() == v2.variant(); }
+
+#endif
+
 #include "TelepathyQt4/_gen/types-body.hpp"
diff --git a/TelepathyQt4/types.h b/TelepathyQt4/types.h
index 6162ada..094ece3 100644
--- a/TelepathyQt4/types.h
+++ b/TelepathyQt4/types.h
@@ -92,16 +92,4 @@ public:
 
 } // Tp
 
-#ifndef HAVE_QDBUSVARIANT_OPERATOR_EQUAL
-
-/* FIXME This is a workaround that should be removed when Qt has support for
- *       this. There is already a merge request
- *       (http://qt.gitorious.org/qt/qt/merge_requests/1657) in place and the
- *       fix should be in next Qt versions.
- */
-inline bool operator==(const QDBusVariant &v1, const QDBusVariant &v2)
-{ return v1.variant() == v2.variant(); }
-
-#endif
-
 #endif
-- 
1.5.6.5



More information about the telepathy-commits mailing list