[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [PATCH] add dummy operator== and dummy qHash for win32 target
From:       Christian Ehrlicher <Ch.Ehrlicher () gmx ! de>
Date:       2005-11-06 9:33:35
Message-ID: 436DCDEF.4040201 () gmx ! de
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi,

Here is an idea how to work around the problem that msvc needs a full
instatiated template when exporting a class. It adds an dummy operator==
(K_DUMMY_COMPARISON_OPERATOR) and a dummy qHash function
(K_DUMMY_QHASH_OPERATOR). I've masked it with
K_FULL_TEMPLATE_EXPORT_INSTANTIATION so gcc will not create any code for
the dummy functions.
Also this patch changes qtButtonStateToMod() (win32-only function) to
work with Qt4.

christian

["kdecore.patch" (text/x-diff)]

Index: kdemacros.h.in
===================================================================
--- kdemacros.h.in	(revision 478091)
+++ kdemacros.h.in	(working copy)
@@ -263,4 +263,20 @@
     RESERVE_VIRTUAL_9
 /** @} */
 
+#ifdef K_FULL_TEMPLATE_EXPORT_INSTANTIATION
+# define K_DUMMY_COMPARISON_OPERATOR(C) \
+    bool operator==(const C&) const { \
+        qWarning(#C"::operator==(const "#C"&) was called"); \
+        return false; \
+    }
+# define K_DUMMY_QHASH_FUNCTION(C) \
+    inline uint qHash(const C) { \
+        qWarning("inline uint qHash(const "#C") was called"); \
+        return 0; \
+    }
+#else
+# define K_DUMMY_COMPARISON_OPERATOR(C)
+# define K_DUMMY_QHASH_FUNCTION(C)
+#endif
+
 #endif /* _KDE_MACROS_H_ */
Index: kkeyserver_x11.cpp
===================================================================
--- kkeyserver_x11.cpp	(revision 478091)
+++ kkeyserver_x11.cpp	(working copy)
@@ -690,7 +690,7 @@
 	return modToModQt( modX, modQt );
 }
 
-KDECORE_EXPORT int qtButtonStateToMod( Qt::KeyboardModifier s )
+KDECORE_EXPORT int qtButtonStateToMod( Qt::KeyboardModifiers s )
 {
 	int modQt = 0;
 	if (s & Qt::ShiftModifier) modQt |= KKey::SHIFT;
Index: kkeyserver_x11.h
===================================================================
--- kkeyserver_x11.h	(revision 478091)
+++ kkeyserver_x11.h	(working copy)
@@ -419,7 +419,7 @@
 	 * Converts the Qt-compatible button state to KKey modifier.
          * Windows only.
 	 */
-	KDECORE_EXPORT int qtButtonStateToMod( Qt::KeyboardModifier s );
+	KDECORE_EXPORT int qtButtonStateToMod( Qt::KeyboardModifiers s );
 #endif
 
 	/**
Index: network/kresolver.h
===================================================================
--- network/kresolver.h	(revision 478091)
+++ network/kresolver.h	(working copy)
@@ -172,10 +172,14 @@
    */
   KResolverEntry& operator=(const KResolverEntry& other);
 
+  K_DUMMY_COMPARISON_OPERATOR(KResolverEntry)
+
 private:
   QSharedDataPointer<KResolverEntryPrivate> d;
 };
 
+K_DUMMY_QHASH_FUNCTION(KResolverEntry)
+
 class KResolverResultsPrivate;
 /**
  * @class KResolverResults kresolver.h kresolver.h

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic