changeset 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
files cpp/qt_core/QMetaObject_shell.cpp cpp/qt_core/QVariant_shell.cpp generator/dgenerator.cpp qt/core/QList.d qt/core/QTypeInfo.d qt/d2/qt/core/QLine.d qt/d2/qt/core/QModelIndex.d qt/d2/qt/core/QPoint.d qt/d2/qt/core/QRect.d qt/d2/qt/core/QRectF.d qt/d2/qt/core/QSize.d qt/d2/qt/core/QVariant.d
diffstat 12 files changed, 264 insertions(+), 159 deletions(-) [+]
line wrap: on
line diff
--- a/cpp/qt_core/QMetaObject_shell.cpp	Fri Nov 13 20:42:51 2009 +0000
+++ b/cpp/qt_core/QMetaObject_shell.cpp	Sun Nov 22 11:01:19 2009 +0000
@@ -48,6 +48,13 @@
     list.append(45);
 }
 
+extern "C" DLL_PUBLIC void qtd_create_QList_double(void *nativeId)
+{
+    QList<double> & list = (*(QList<double> *)nativeId);
+    list.append(54.44);
+    list.append(45.55);
+}
+
 extern "C" DLL_PUBLIC void qtd_create_QList_QObject(void *nativeId)
 {
     QList<QObject*> & list2 = (*(QList<QObject*> *)nativeId);
--- a/cpp/qt_core/QVariant_shell.cpp	Fri Nov 13 20:42:51 2009 +0000
+++ b/cpp/qt_core/QVariant_shell.cpp	Sun Nov 22 11:01:19 2009 +0000
@@ -22,6 +22,11 @@
     delete (QVariant *)ptr;
 }
 
+extern "C" DLL_PUBLIC void qtd_QVariant_call_destructor(QVariant *ptr)
+{
+    ptr->~QVariant();
+}
+
 QVariant_QtDShell::QVariant_QtDShell()
     : QVariant()
 {
@@ -961,3 +966,8 @@
 
 
 
+extern "C" DLL_PUBLIC void* qtd_QVariant_placed_copy(void* variant0, void* place) {
+    const QVariant&  __qt_variant0 = (const QVariant& ) *(QVariant *)variant0;
+    QVariant *result = new (place)QVariant((const QVariant& )__qt_variant0);
+    return (void *) result;
+}
\ No newline at end of file
--- a/generator/dgenerator.cpp	Fri Nov 13 20:42:51 2009 +0000
+++ b/generator/dgenerator.cpp	Sun Nov 22 11:01:19 2009 +0000
@@ -882,7 +882,7 @@
 
     // return value marschalling
     if(return_type) {
-        if (!returnImmediately && !d_function->storeResult()) {
+        if (!returnImmediately) {
             s << INDENT;
             QString modified_type = d_function->typeReplaced(0);
             if (modified_type.isEmpty())
@@ -908,12 +908,7 @@
             s << "new " << return_type->name() << "(ret, QtdObjectFlags.nativeOwnership);" << endl;
 
         if (return_type->isObject()) {
-            if(d_function->storeResult())
-                s << INDENT << QString("__m_%1.__nativeId = ret;").arg(d_function->name()) << endl
-                  << INDENT << QString("return __m_%1;").arg(d_function->name()) << endl;
-            else
-                s << "qtd_" << return_type->name() << "_from_ptr(ret);" << endl;
-            s << endl;
+            s << "qtd_" << return_type->name() << "_from_ptr(ret);" << endl << endl;
         }
 
         if (return_type->isArray()) {
@@ -924,7 +919,7 @@
             writeReferenceCount(s, referenceCount, "__d_return_value");
         }
 
-        if (!returnImmediately && !d_function->storeResult())
+        if (!returnImmediately)
             s << INDENT << "return __d_return_value;" << endl;
     }
     writeInjectedCode(s, d_function, CodeSnip::End);
@@ -988,6 +983,9 @@
     writeFunctionArguments(s, d_function, argument_count, option);
     s << ")";
 
+    if(d_function->isConstant())
+        s << " const";
+
     return result;
 }
 
@@ -2307,31 +2305,6 @@
         }
         */
 
-        // customized store-result instances
-        d_funcs = d_class->functionsInTargetLang();
-        for (int i=0; i<d_funcs.size(); ++i) {
-            AbstractMetaFunction *d_function = d_funcs.at(i);
-            uint included_attributes = 0;
-            uint excluded_attributes = 0;
-            setupForFunction(d_function, &included_attributes, &excluded_attributes);
-            uint attr = d_function->attributes() & (~excluded_attributes) | included_attributes;
-            bool isStatic = (attr & AbstractMetaAttributes::Static);
-
-            if (!isStatic && (attr & AbstractMetaAttributes::Abstract))
-                continue;
-
-            if(d_function->storeResult()) {
-                QString type_name = d_function->type()->name();
-                const ComplexTypeEntry *ctype = static_cast<const ComplexTypeEntry *>(d_function->type()->typeEntry());
-                if(ctype->isAbstract())
-                    type_name = type_name + "_ConcreteWrapper";
-
-                s << INDENT << "    __m_" << d_function->name() << " = new "
-                        << type_name << "(cast(void*)null);" << endl;
-                if (d_function->type()->isQObject())
-                    s << INDENT << "    __m_" << d_function->name() << ".__setFlags(QtdObjectFlags.nativeOwnership, true);" << endl;
-            }
-        }
 
         // pointers to native interface objects for classes that implement interfaces
         // initializing
@@ -2348,29 +2321,6 @@
 
         s << INDENT << "}" << endl << endl;
 
-/******************!!!DUPLICATE OF ABOVE!!!*********************/
-        for (int i=0; i<d_funcs.size(); ++i) {
-            AbstractMetaFunction *d_function = d_funcs.at(i);
-            uint included_attributes = 0;
-            uint excluded_attributes = 0;
-            setupForFunction(d_function, &included_attributes, &excluded_attributes);
-            uint attr = d_function->attributes() & (~excluded_attributes) | included_attributes;
-            bool isStatic = (attr & AbstractMetaAttributes::Static);
-
-            if (!isStatic && (attr & AbstractMetaAttributes::Abstract))
-                continue;
-
-            if(d_function->storeResult()) {
-                QString type_name = d_function->type()->name();
-                const ComplexTypeEntry *ctype = static_cast<const ComplexTypeEntry *>(d_function->type()->typeEntry());
-                if(ctype->isAbstract())
-                    type_name = type_name + "_ConcreteWrapper";
-
-                s << INDENT << type_name << " __m_" << d_function->name() << ";" << endl;
-            }
-        }
-/***************************************************************/
-
         // pointers to native interface objects for classes that implement interfaces
         // initializing
         interfaces = d_class->interfaces();
@@ -2459,54 +2409,8 @@
             s << INDENT << "public this(void* native_id, QtdObjectFlags flags = QtdObjectFlags.nativeOwnership) {" << endl
               << INDENT << "    super(native_id, flags);" << endl << endl;
             
-            /******************!!!DUPLICATE!!!*********************/
-            d_funcs = d_class->functionsInTargetLang();
-            for (int i=0; i<d_funcs.size(); ++i) {
-                AbstractMetaFunction *d_function = d_funcs.at(i);
-                uint included_attributes = 0;
-                uint excluded_attributes = 0;
-                setupForFunction(d_function, &included_attributes, &excluded_attributes);
-                uint attr = d_function->attributes() & (~excluded_attributes) | included_attributes;
-// qtd                bool isStatic = (attr & AbstractMetaAttributes::Static);
-
-                if(d_function->storeResult()) {
-                    QString type_name = d_function->type()->name();
-                    const ComplexTypeEntry *ctype = static_cast<const ComplexTypeEntry *>(d_function->type()->typeEntry());
-                    if(ctype->isAbstract())
-                        type_name = type_name + "_ConcreteWrapper";
-                    s << INDENT << "    __m_" << d_function->name() << " = new "
-                            << type_name << "(cast(void*)null);" << endl;
-                    if (d_function->type()->isQObject())
-                        s << INDENT << "    __m_" << d_function->name() << ".__setFlags(QtdObjectFlags.nativeOwnership, true);" << endl;
-                }
-            }
-
             s << INDENT << "}" << endl << endl;
 
-            for (int i=0; i<d_funcs.size(); ++i) {
-                AbstractMetaFunction *d_function = d_funcs.at(i);
-                uint included_attributes = 0;
-                uint excluded_attributes = 0;
-                setupForFunction(d_function, &included_attributes, &excluded_attributes);
-                uint attr = d_function->attributes() & (~excluded_attributes) | included_attributes;
-// qtd                bool isStatic = (attr & AbstractMetaAttributes::Static);
-
-                if(d_function->storeResult()) {
-                    QString type_name = d_function->type()->name();
-                    const ComplexTypeEntry *ctype = static_cast<const ComplexTypeEntry *>(d_function->type()->typeEntry());
-                    if(ctype->isAbstract())
-                        type_name = type_name + "_ConcreteWrapper";
-
-                    s << INDENT << d_function->type()->name() << " __m_" << d_function->name() << ";" << endl;
-                }
-            }
-            /***************************************************************/
-
-
-
-
-
-
             uint exclude_attributes = AbstractMetaAttributes::Native | AbstractMetaAttributes::Abstract;
             uint include_attributes = 0;
             AbstractMetaFunctionList functions = d_class->queryFunctions(AbstractMetaClass::NormalFunctions | AbstractMetaClass::AbstractFunctions | AbstractMetaClass::NonEmptyFunctions | AbstractMetaClass::NotRemovedFromTargetLang);
@@ -2514,14 +2418,19 @@
                 retrieveModifications(d_function, d_class, &exclude_attributes, &include_attributes);
                 if (notWrappedYet(d_function))
                     continue;
-                /* qtd                s << endl
-                  << INDENT << "@Override" << endl; */
+                s << endl
+                  << INDENT << "override ";
                 writeFunctionAttributes(s, d_function, include_attributes, exclude_attributes,
                                         d_function->isNormal() || d_function->isSignal() ? 0 : SkipReturnType);
 
                 s << d_function->name() << "(";
                 writeFunctionArguments(s, d_function, d_function->arguments().count());
-                s << ") {" << endl;
+                s << ")";
+
+                if(d_function->isConstant())
+                    s << " const";
+
+                s << " {" << endl;
                 {
                     Indentation indent(INDENT);
                     writeJavaCallThroughContents(s, d_function, SuperCall);
@@ -3198,8 +3107,6 @@
             ctype_child->addedTo = cls->name();
         }
 
-        foreach (AbstractMetaFunction *function, cls->functions())
-            function->checkStoreResult();
 /* we don't need this anymore
         // generate QObject conversion functions only those that are required
         AbstractMetaFunctionList d_funcs = cls->functionsInTargetLang();
--- a/qt/core/QList.d	Fri Nov 13 20:42:51 2009 +0000
+++ b/qt/core/QList.d	Sun Nov 22 11:01:19 2009 +0000
@@ -4,7 +4,7 @@
 import qt.QtdObject;
 import qt.qtd.Atomic;
 import qt.qtd.MetaMarshall;
-//import qt.core.QTypeInfo;
+import qt.core.QTypeInfo;
 
 import core.stdc.stdlib : qRealloc = realloc, qFree = free, qMalloc = malloc;
 import core.stdc.string : memcpy, memmove;
@@ -54,6 +54,27 @@
     return nalloc - extra;
 }
 
+void q_new_at(T)(T* ptr, const ref T t)
+{
+    memcpy(ptr, &t, T.sizeof);
+/*    static if (__traits(compiles, ptr.__postblit())) DMD bug #3539
+        ptr.__postblit();*/
+}
+
+T* q_new(T)(const ref T t)
+{
+    T* ptr = cast(T*) qMalloc(T.sizeof);
+    q_new_at!T(ptr, t);
+    return ptr;
+}
+
+void q_delete(T)(T* t)
+{
+    static if (__traits(compiles, t.__dtor()))
+        t.__dtor();
+    qFree(t);
+}
+
 private int grow(int size)
 {
     // dear compiler: don't optimize me out.
@@ -289,8 +310,15 @@
 
 import std.stdio;
 
-struct QList(T)
+alias void Dummy; // DMD bug #3538 
+
+struct QList(T, alias Default = Dummy)
 {
+    static if (is(Default == Dummy))
+        alias QTypeInfo!T TI;
+    else
+        alias Default TI; 
+  
     struct Node
     {
         void *v;
@@ -301,14 +329,11 @@
             {
                 static if (isValueType!T)
                 {
-                    pragma(msg, "value " ~ T.stringof);
                     void* ptr = cast(void*)(isLarge!T() || isStatic!T() ? v : &this);
                     return new T(ptr, QtdObjectFlags.nativeOwnership);
                 }
                 else
                 {
-                    pragma(msg, T.stringof);
-
                     return T.__getObject( *cast(void**)(&this) );
                 }
             }
@@ -317,12 +342,11 @@
         {    
             ref T t()
             {
-                pragma(msg, "native " ~ T.stringof);
-
-                return *cast(T*)(&this);
+                static if(TI.isLarge || TI.isStatic)
+                    return *cast(T*)(v);
+                else
+                    return *cast(T*)(&this);
             }
-    //        { return *cast(T*)(QTypeInfo!T.isLarge || QTypeInfo!T.isStatic
-    //                                       ? v : &this); }    }
         }
     }
     
@@ -441,24 +465,35 @@
     else // native types
         void node_construct(Node *n, const ref T t)
         {
-    /* TODO       static if (QTypeInfo!T.isLarge || QTypeInfo!T.isStatic)
-                n.v = new T(t);
-            else static if (QTypeInfo!T.isComplex)
-                new (n) T(t);
-            else*/
+            static if (TI.isLarge || TI.isStatic) { pragma(msg, "node construct, large " ~ T.stringof);
+                n.v = q_new!T(t); // n.v = new T(t);
+}            else static if (TI.isComplex) {pragma(msg, "node construct, complex " ~ T.stringof);
+                q_new_at(n, t); // new (n) T(t);
+}            else {pragma(msg, "node construct, other " ~ T.stringof);
                 *cast(T*)(n) = cast(T)(t);
+}
         }
     
     void node_copy(Node *from, Node *to, Node *src)
     {
         writeln("QList node_copy");
-/* TODO       if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic)
+        static if (isQObjectType!T || isObjectType!T)
+            {} // ensure to do nothing. copying only a pointer
+        else static if (isValueType!T)
+        {
+            if (TI.isLarge || TI.isStatic) // TODO should be static if
+                while(from != to)
+                    (from++).v = T.__constructNativeCopy((src++).v); // (from++)->v = new T(*reinterpret_cast<T*>((src++)->v));
+            else if (TI.isComplex)
+                while(from != to)
+                    T.__constructPlacedNativeCopy(src++, from++); // new (from++) T(*reinterpret_cast<T*>(src++));
+        }
+        else static if (TI.isLarge || TI.isStatic)
+            while(from != to) 
+                (from++).v = q_new!T(*cast(T*)((src++).v));
+        else static if (TI.isComplex)
             while(from != to)
-                (from++)->v = new T(*reinterpret_cast<T*>((src++)->v));
-        else if (QTypeInfo<T>::isComplex)
-            while(from != to)
-                new (from++) T(*reinterpret_cast<T*>(src++));
-            */
+                q_new_at(from++, *cast(T*)(src++));
     }
 
     void free(QListData.Data* data)
@@ -484,15 +519,16 @@
                     --to, T.__callNativeDestructor(to);
         }
         else
-        { /*
-            if (QTypeInfo!T.isLarge || QTypeInfo!T.isStatic)
-                while (from != to) --to, delete cast(T*)(to->v);
-            else if (QTypeInfo!T.isComplex)
-                while (from != to) --to, cast(T*)(to).~T();
-            */
+        {
+            static if (TI.isLarge || TI.isStatic)
+                while (from != to) --to, q_delete(cast(T*)(to.v));
+            else static if (TI.isComplex)
+                while (from != to) --to, cast(T*)(to).__dtor();
         }
     }
 }
 
 extern(C) void qtd_create_QList(void *nativeId);
+extern(C) void qtd_create_QList_double(void *nativeId);
+
 extern(C) void qtd_create_QList_QObject(void *nativeId);
\ No newline at end of file
--- 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
+        }
     }
 }
 
--- a/qt/d2/qt/core/QLine.d	Fri Nov 13 20:42:51 2009 +0000
+++ b/qt/d2/qt/core/QLine.d	Sun Nov 22 11:01:19 2009 +0000
@@ -135,7 +135,18 @@
     public final void readFrom(QDataStream arg__1) {
         qtd_QLine_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId);
     }
+    
+    // service stuff
+    public alias void __isNativeValueType;
 
+    struct QTypeInfo
+    {
+        enum bool isComplex = true;
+        enum bool isStatic = false;
+        enum bool isLarge = true;
+        enum bool isPointer = false;
+        enum bool isDummy = false;
+    }
 private:
     QPoint pt1, pt2;
 }
@@ -355,6 +366,18 @@
         return qtd_QLineF_fromPolar_double_double(length, angle);
     }
 
+    // service stuff
+    public alias void __isNativeValueType;
+
+    struct QTypeInfo
+    {
+        enum bool isComplex = true;
+        enum bool isStatic = false;
+        enum bool isLarge = true;
+        enum bool isPointer = false;
+        enum bool isDummy = false;
+    }
+
     private:
         QPointF pt1, pt2;
 }
--- a/qt/d2/qt/core/QModelIndex.d	Fri Nov 13 20:42:51 2009 +0000
+++ b/qt/d2/qt/core/QModelIndex.d	Sun Nov 22 11:01:19 2009 +0000
@@ -5,7 +5,7 @@
 
 // automatic imports-------------
 //private import qt.core.QVariant;
-//private import qt.core.QAbstractItemModel;
+private import qt.core.QAbstractItemModel;
 public import qt.core.Qt;
 
 
@@ -51,7 +51,7 @@
     public final bool isValid() const {
         return __qtd_QModelIndex_isValid(cast(void*)&this);
     }
-/*
+    
     public final QAbstractItemModel model() {
 //        void* __qt_return_value = __qtd_QModelIndex_model(&this);
         void* __qt_return_value = m;
@@ -60,7 +60,7 @@
         void* d_obj = qtd_get_d_qobject(__qt_return_value);
         return cast(QAbstractItemModel) d_obj;
     }
-*/
+
     private final bool operator_less(QModelIndex other) {
         return __qtd_QModelIndex_operator_less_QModelIndex(&this, other);
     }
@@ -80,6 +80,17 @@
     public final QModelIndex sibling(int row, int column) {
         return __qtd_QModelIndex_sibling_int_int(&this, row, column);
     }
+    
+    public alias void __isNativeValueType;
+
+    struct QTypeInfo
+    {
+        enum bool isComplex = true;
+        enum bool isStatic = false;
+        enum bool isLarge = true;
+        enum bool isPointer = false;
+        enum bool isDummy = false;
+    }
 
 private:
     int r;
@@ -114,8 +125,4 @@
 private extern(C) QModelIndex  __qtd_QModelIndex_sibling_int_int(void* __this_nativeId,
  int row0,
  int column1);
-// Just the private functions for abstract functions implemeneted in superclasses
-
-
-
-// Virtual Dispatch functions
+ 
\ No newline at end of file
--- a/qt/d2/qt/core/QPoint.d	Fri Nov 13 20:42:51 2009 +0000
+++ b/qt/d2/qt/core/QPoint.d	Sun Nov 22 11:01:19 2009 +0000
@@ -92,6 +92,19 @@
     public final void readFrom(QDataStream arg__1) {
         qtd_QPoint_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId);
     }
+    
+    // service stuff
+    public alias void __isNativeValueType;
+
+    struct QTypeInfo
+    {
+        enum bool isComplex = true;
+        enum bool isStatic = false;
+        enum bool isLarge = true;
+        enum bool isPointer = false;
+        enum bool isDummy = false;
+    }
+
 
 private:
     // ### Qt 5;  remove the ifdef and just have the same order on all platforms.
@@ -208,6 +221,18 @@
         qtd_QPointF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId);
     }
 
+    // service stuff
+    public alias void __isNativeValueType;
+
+    struct QTypeInfo
+    {
+        enum bool isComplex = true;
+        enum bool isStatic = false;
+        enum bool isLarge = true;
+        enum bool isPointer = false;
+        enum bool isDummy = false;
+    }
+
 private:
     qreal xp;
     qreal yp;
--- a/qt/d2/qt/core/QRect.d	Fri Nov 13 20:42:51 2009 +0000
+++ b/qt/d2/qt/core/QRect.d	Sun Nov 22 11:01:19 2009 +0000
@@ -337,6 +337,19 @@
         return qtd_QRect_normalized(&this);
     }
 
+    // service stuff
+    public alias void __isNativeValueType;
+
+    struct QTypeInfo
+    {
+        enum bool isComplex = true;
+        enum bool isStatic = false;
+        enum bool isLarge = true;
+        enum bool isPointer = false;
+        enum bool isDummy = false;
+    }
+
+
 private:
     version(OSX)
     {
--- a/qt/d2/qt/core/QRectF.d	Fri Nov 13 20:42:51 2009 +0000
+++ b/qt/d2/qt/core/QRectF.d	Sun Nov 22 11:01:19 2009 +0000
@@ -301,7 +301,18 @@
     {
         return qtd_QRectF_toAlignedRect(cast(void*)&this);
     }
+    
+    // service stuff
+    public alias void __isNativeValueType;
 
+    struct QTypeInfo
+    {
+        enum bool isComplex = true;
+        enum bool isStatic = false;
+        enum bool isLarge = true;
+        enum bool isPointer = false;
+        enum bool isDummy = false;
+    }
 private:
     qreal xp;
     qreal yp;
--- a/qt/d2/qt/core/QSize.d	Fri Nov 13 20:42:51 2009 +0000
+++ b/qt/d2/qt/core/QSize.d	Sun Nov 22 11:01:19 2009 +0000
@@ -113,7 +113,18 @@
     	assert(!qFuzzyCompare(c + 1, 1.));
     	return QSize(qRound(this.wd/c), qRound(this.ht/c));
 	}
+    
+    // service stuff
+    public alias void __isNativeValueType;
 
+    struct QTypeInfo
+    {
+        enum bool isComplex = true;
+        enum bool isStatic = false;
+        enum bool isLarge = true;
+        enum bool isPointer = false;
+        enum bool isDummy = false;
+    }
 private:
     int wd;
     int ht;
@@ -238,7 +249,18 @@
 	    assert(!qFuzzyCompare(c + 1, 1.));
 	    return QSizeF(this.wd/c, this.ht/c);
 	}
+    
+    // service stuff
+    public alias void __isNativeValueType;
 
+    struct QTypeInfo
+    {
+        enum bool isComplex = true;
+        enum bool isStatic = false;
+        enum bool isLarge = true;
+        enum bool isPointer = false;
+        enum bool isDummy = false;
+    }
 private:
     qreal wd;
     qreal ht;
--- a/qt/d2/qt/core/QVariant.d	Fri Nov 13 20:42:51 2009 +0000
+++ b/qt/d2/qt/core/QVariant.d	Sun Nov 22 11:01:19 2009 +0000
@@ -612,11 +612,34 @@
     protected override void __deleteNative() {
         qtd_QVariant_destructor(__nativeId);
     }
+    
+    public alias void __isValueType;
 
+    public alias void __isQtType_QVariant;
+    
+    struct QTypeInfo
+    {
+        enum bool isComplex = true;
+        enum bool isStatic = false;
+        enum bool isLarge = true;
+        enum bool isPointer = false;
+        enum bool isDummy = false;
+    }
+    
+    static void* __constructNativeCopy(const void* orig) {
+        return qtd_QVariant_QVariant_QVariant(cast(void*)orig);
+    }
+
+    static void* __constructPlacedNativeCopy(const void* orig, void* place) {
+        return qtd_QVariant_placed_copy(orig, place);
+    }
 // Injected code in class
 }
 extern (C) void qtd_QVariant_destructor(void *ptr);
 
+private extern(C) void* qtd_QVariant_placed_copy(const void* orig, void* place);
+
+extern (C) void qtd_QVariant_call_destructor(void *ptr);
 
 // C wrappers
 private extern(C) void* qtd_QVariant_QVariant();