src/corelib/kernel/qmetaobject_p.h
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
--- a/src/corelib/kernel/qmetaobject_p.h	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/corelib/kernel/qmetaobject_p.h	Tue Jul 06 15:10:48 2010 +0300
@@ -115,11 +115,17 @@
     int constructorCount, constructorData; //since revision 2
     int flags; //since revision 3
     int signalCount; //since revision 4
+    // revision 5 introduces changes in normalized signatures, no new members
 
     static inline const QMetaObjectPrivate *get(const QMetaObject *metaobject)
     { return reinterpret_cast<const QMetaObjectPrivate*>(metaobject->d.data); }
 
-    static int indexOfSignalRelative(const QMetaObject **baseObject, const char* name);
+    static int indexOfSignalRelative(const QMetaObject **baseObject,
+                                     const char* name,
+                                     bool normalizeStringData);
+    static int indexOfSlot(const QMetaObject *m,
+                           const char *slot,
+                           bool normalizeStringData);
     static int originalClone(const QMetaObject *obj, int local_method_index);
 
 #ifndef QT_NO_QOBJECT
@@ -190,7 +196,7 @@
         if (*(e-1) == '&') { // treat const reference as value
             t += 6;
             --e;
-        } else if (is_ident_char(*(e-1))) { // treat const value as value
+        } else if (is_ident_char(*(e-1)) || *(e-1) == '>') { // treat const value as value
             t += 6;
         }
     }
@@ -247,6 +253,7 @@
         } while (optional[++i].keyword != 0);
     }
 
+    bool star = false;
     while (t != e) {
         char c = *t++;
         if (fixScope && c == ':' && *t == ':' ) {
@@ -257,6 +264,7 @@
                 --i;
             result.resize(i + 1);
         }
+        star = star || c == '*';
         result += c;
         if (c == '<') {
             //template recursion
@@ -277,6 +285,26 @@
                 }
             }
         }
+
+        // cv qualifers can appear after the type as well
+        if (!is_ident_char(c) && t != e && (e - t >= 5 && strncmp("const", t, 5) == 0)
+            && (e - t == 5 || !is_ident_char(t[5]))) {
+            t += 5;
+            while (t != e && is_space(*t))
+                ++t;
+            if (adjustConst && t != e && *t == '&') {
+                // treat const ref as value
+                ++t;
+            } else if (adjustConst && !star) {
+                // treat const as value
+            } else if (!star) {
+                // move const to the front (but not if const comes after a *)
+                result.prepend("const ");
+            } else {
+                // keep const after a *
+                result += "const";
+            }
+        }
     }
 
     return result;