diff qt/core/QTypeInfo.d @ 295:463563fc9e17 signals

more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
author eldar
date Sun, 22 Nov 2009 11:01:19 +0000
parents bb37b0ed94c9
children 5173835bb372
line wrap: on
line diff
--- a/qt/core/QTypeInfo.d	Fri Nov 13 20:42:51 2009 +0000
+++ b/qt/core/QTypeInfo.d	Sun Nov 22 11:01:19 2009 +0000
@@ -12,28 +12,49 @@
 
 bool qIsDetached(T)(ref T) { return true; }
 
-template QTypeInfo(T)
+template isBasicType(T)
 {
-public:
-    enum {
-        isPointer = isPointer!T,
-        isComplex = !isPointer,
-        isStatic = !isPointer,
-        isLarge = (T.sizeof > (void*).sizeof),
-        isDummy = false
-    }
+    enum isBasicType = isNumeric!T || is(T == bool);
 }
 
 template QTypeInfo(T)
-    if ( isQObjectType!T || isObjectType!T )
 {
-public:
-    enum {
-        isPointer = true,
-        isComplex = false,
-        isStatic = false,
-        isLarge = false,
-        isDummy = false
+    static if(isBasicType!T)
+    {
+        public enum
+        {
+            isPointer = false,
+            isComplex = false,
+            isStatic = false,
+            isLarge = (T.sizeof > (void*).sizeof),
+            isDummy = false
+        }
+    }
+    else static if(__traits(compiles, mixin("T.TypeInfo")))
+    {
+        alias T.QTypeInfo QTypeInfo; // alias member QTypeInfo
+    }
+    else static if ( isQObjectType!T || isObjectType!T )
+    {
+        public enum // are pointers
+        {
+            isPointer = true,
+            isComplex = false,
+            isStatic = false,
+            isLarge = false,
+            isDummy = false
+        }
+    }
+    else // default parameters
+    {
+        public enum
+        {
+            isPointer = isPointer!T,
+            isComplex = !isPointer,
+            isStatic = !isPointer,
+            isLarge = (T.sizeof > (void*).sizeof),
+            isDummy = false
+        }
     }
 }