Move the definition of Object vtables into qv4object_p.h
authorLars Knoll <lars.knoll@theqtcompany.com>
Thu, 15 Jan 2015 20:02:40 +0000 (21:02 +0100)
committerLars Knoll <lars.knoll@digia.com>
Fri, 23 Jan 2015 07:07:38 +0000 (08:07 +0100)
Change-Id: I8dc15999e268d2d78691bf030b36cd09de1c4057
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/qml/jsruntime/qv4managed_p.h
src/qml/jsruntime/qv4object_p.h

index 5f73ab6..8780243 100644 (file)
@@ -70,25 +70,6 @@ inline void qYouForgotTheQ_MANAGED_Macro(T1, T2) {}
         V4_MANAGED_SIZE_TEST \
         QV4::Heap::DataClass *d() const { return static_cast<QV4::Heap::DataClass *>(m); }
 
-#define V4_OBJECT(superClass) \
-    public: \
-        Q_MANAGED_CHECK \
-        typedef superClass SuperClass; \
-        static const QV4::ObjectVTable static_vtbl; \
-        static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
-        V4_MANAGED_SIZE_TEST \
-        Data *d() const { return static_cast<Data *>(m); }
-
-#define V4_OBJECT2(DataClass, superClass) \
-    public: \
-        Q_MANAGED_CHECK \
-        typedef QV4::Heap::DataClass Data; \
-        typedef superClass SuperClass; \
-        static const QV4::ObjectVTable static_vtbl; \
-        static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
-        V4_MANAGED_SIZE_TEST \
-        QV4::Heap::DataClass *d() const { return static_cast<QV4::Heap::DataClass *>(m); }
-
 #define Q_MANAGED_TYPE(type) \
     public: \
         enum { MyType = Type_##type };
@@ -122,25 +103,6 @@ struct ManagedVTable
     bool (*isEqualTo)(Managed *m, Managed *other);
 };
 
-struct ObjectVTable
-{
-    ManagedVTable managedVTable;
-    ReturnedValue (*call)(Managed *, CallData *data);
-    ReturnedValue (*construct)(Managed *, CallData *data);
-    ReturnedValue (*get)(Managed *, String *name, bool *hasProperty);
-    ReturnedValue (*getIndexed)(Managed *, uint index, bool *hasProperty);
-    void (*put)(Managed *, String *name, const Value &value);
-    void (*putIndexed)(Managed *, uint index, const Value &value);
-    PropertyAttributes (*query)(const Managed *, String *name);
-    PropertyAttributes (*queryIndexed)(const Managed *, uint index);
-    bool (*deleteProperty)(Managed *m, String *name);
-    bool (*deleteIndexedProperty)(Managed *m, uint index);
-    ReturnedValue (*getLookup)(Managed *m, Lookup *l);
-    void (*setLookup)(Managed *m, Lookup *l, const Value &v);
-    uint (*getLength)(const Managed *m);
-    void (*advanceIterator)(Managed *m, ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attributes);
-};
-
 #define DEFINE_MANAGED_VTABLE_INT(classname, parentVTable) \
 {     \
     parentVTable, \
@@ -161,27 +123,6 @@ struct ObjectVTable
 #define DEFINE_MANAGED_VTABLE(classname) \
 const QV4::ManagedVTable classname::static_vtbl = DEFINE_MANAGED_VTABLE_INT(classname, 0)
 
-
-#define DEFINE_OBJECT_VTABLE(classname) \
-const QV4::ObjectVTable classname::static_vtbl =    \
-{     \
-    DEFINE_MANAGED_VTABLE_INT(classname, &classname::SuperClass::static_vtbl == &Object::static_vtbl ? 0 : &classname::SuperClass::static_vtbl.managedVTable), \
-    call,                                       \
-    construct,                                  \
-    get,                                        \
-    getIndexed,                                 \
-    put,                                        \
-    putIndexed,                                 \
-    query,                                      \
-    queryIndexed,                               \
-    deleteProperty,                             \
-    deleteIndexedProperty,                      \
-    getLookup,                                  \
-    setLookup,                                  \
-    getLength,                                  \
-    advanceIterator                            \
-}
-
 struct Q_QML_PRIVATE_EXPORT Managed : Value
 {
     V4_MANAGED(Base, Managed)
index bbc9f4a..1c36f17 100644 (file)
@@ -62,6 +62,66 @@ struct Object : Base {
 
 }
 
+#define V4_OBJECT(superClass) \
+    public: \
+        Q_MANAGED_CHECK \
+        typedef superClass SuperClass; \
+        static const QV4::ObjectVTable static_vtbl; \
+        static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
+        V4_MANAGED_SIZE_TEST \
+        Data *d() const { return static_cast<Data *>(m); }
+
+#define V4_OBJECT2(DataClass, superClass) \
+    public: \
+        Q_MANAGED_CHECK \
+        typedef QV4::Heap::DataClass Data; \
+        typedef superClass SuperClass; \
+        static const QV4::ObjectVTable static_vtbl; \
+        static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
+        V4_MANAGED_SIZE_TEST \
+        QV4::Heap::DataClass *d() const { return static_cast<QV4::Heap::DataClass *>(m); }
+
+struct ObjectVTable
+{
+    ManagedVTable managedVTable;
+    ReturnedValue (*call)(Managed *, CallData *data);
+    ReturnedValue (*construct)(Managed *, CallData *data);
+    ReturnedValue (*get)(Managed *, String *name, bool *hasProperty);
+    ReturnedValue (*getIndexed)(Managed *, uint index, bool *hasProperty);
+    void (*put)(Managed *, String *name, const Value &value);
+    void (*putIndexed)(Managed *, uint index, const Value &value);
+    PropertyAttributes (*query)(const Managed *, String *name);
+    PropertyAttributes (*queryIndexed)(const Managed *, uint index);
+    bool (*deleteProperty)(Managed *m, String *name);
+    bool (*deleteIndexedProperty)(Managed *m, uint index);
+    ReturnedValue (*getLookup)(Managed *m, Lookup *l);
+    void (*setLookup)(Managed *m, Lookup *l, const Value &v);
+    uint (*getLength)(const Managed *m);
+    void (*advanceIterator)(Managed *m, ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attributes);
+};
+
+#define DEFINE_OBJECT_VTABLE(classname) \
+const QV4::ObjectVTable classname::static_vtbl =    \
+{     \
+    DEFINE_MANAGED_VTABLE_INT(classname, &classname::SuperClass::static_vtbl == &Object::static_vtbl ? 0 : &classname::SuperClass::static_vtbl.managedVTable), \
+    call,                                       \
+    construct,                                  \
+    get,                                        \
+    getIndexed,                                 \
+    put,                                        \
+    putIndexed,                                 \
+    query,                                      \
+    queryIndexed,                               \
+    deleteProperty,                             \
+    deleteIndexedProperty,                      \
+    getLookup,                                  \
+    setLookup,                                  \
+    getLength,                                  \
+    advanceIterator                            \
+}
+
+
+
 struct Q_QML_EXPORT Object: Managed {
     V4_OBJECT2(Object, Object)
     Q_MANAGED_TYPE(Object)