| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Lesser General Public | 5 * modify it under the terms of the GNU Lesser General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 * Lesser General Public License for more details. | 12 * Lesser General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU Lesser General Public | 14 * You should have received a copy of the GNU Lesser General Public |
| 15 * License along with this library; if not, write to the Free Software | 15 * License along with this library; if not, write to the Free Software |
| 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U
SA | 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U
SA |
| 17 * | 17 * |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #ifndef BINDINGS_QT_INSTANCE_H_ | 20 #ifndef BINDINGS_QT_INSTANCE_H_ |
| 21 #define BINDINGS_QT_INSTANCE_H_ | 21 #define BINDINGS_QT_INSTANCE_H_ |
| 22 | 22 |
| 23 #include <QtScript/qscriptengine.h> | |
| 24 #include "runtime.h" | 23 #include "runtime.h" |
| 25 #include "runtime_root.h" | 24 #include "runtime_root.h" |
| 26 #include <qpointer.h> | 25 #include <qpointer.h> |
| 27 #include <qhash.h> | 26 #include <qhash.h> |
| 28 #include <qset.h> | 27 #include <qset.h> |
| 29 | 28 |
| 30 namespace JSC { | 29 namespace JSC { |
| 31 | 30 |
| 32 namespace Bindings { | 31 namespace Bindings { |
| 33 | 32 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 53 virtual JSValuePtr invokeMethod(ExecState*, const MethodList&, const ArgList
&); | 52 virtual JSValuePtr invokeMethod(ExecState*, const MethodList&, const ArgList
&); |
| 54 | 53 |
| 55 virtual void getPropertyNames(ExecState*, PropertyNameArray&); | 54 virtual void getPropertyNames(ExecState*, PropertyNameArray&); |
| 56 | 55 |
| 57 JSValuePtr stringValue(ExecState* exec) const; | 56 JSValuePtr stringValue(ExecState* exec) const; |
| 58 JSValuePtr numberValue(ExecState* exec) const; | 57 JSValuePtr numberValue(ExecState* exec) const; |
| 59 JSValuePtr booleanValue() const; | 58 JSValuePtr booleanValue() const; |
| 60 | 59 |
| 61 QObject* getObject() const { return m_object; } | 60 QObject* getObject() const { return m_object; } |
| 62 | 61 |
| 63 static PassRefPtr<QtInstance> getQtInstance(QObject*, PassRefPtr<RootObject>
, QScriptEngine::ValueOwnership ownership); | 62 static PassRefPtr<QtInstance> getQtInstance(QObject*, PassRefPtr<RootObject>
); |
| 64 | 63 |
| 65 virtual bool getOwnPropertySlot(JSObject*, ExecState*, const Identifier&, Pr
opertySlot&); | 64 virtual bool getOwnPropertySlot(JSObject*, ExecState*, const Identifier&, Pr
opertySlot&); |
| 66 virtual void put(JSObject*, ExecState*, const Identifier&, JSValuePtr, PutPr
opertySlot&); | 65 virtual void put(JSObject*, ExecState*, const Identifier&, JSValuePtr, PutPr
opertySlot&); |
| 67 | 66 |
| 68 static QtInstance* getInstance(JSObject*); | 67 static QtInstance* getInstance(JSObject*); |
| 69 | 68 |
| 70 private: | 69 private: |
| 71 static PassRefPtr<QtInstance> create(QObject *instance, PassRefPtr<RootObjec
t> rootObject, QScriptEngine::ValueOwnership ownership) | 70 static PassRefPtr<QtInstance> create(QObject *instance, PassRefPtr<RootObjec
t> rootObject) |
| 72 { | 71 { |
| 73 return adoptRef(new QtInstance(instance, rootObject, ownership)); | 72 return adoptRef(new QtInstance(instance, rootObject)); |
| 74 } | 73 } |
| 75 | 74 |
| 76 friend class QtClass; | 75 friend class QtClass; |
| 77 friend class QtField; | 76 friend class QtField; |
| 78 QtInstance(QObject*, PassRefPtr<RootObject>, QScriptEngine::ValueOwnership o
wnership); // Factory produced only.. | 77 QtInstance(QObject*, PassRefPtr<RootObject>); // Factory produced only.. |
| 79 mutable QtClass* m_class; | 78 mutable QtClass* m_class; |
| 80 QPointer<QObject> m_object; | 79 QPointer<QObject> m_object; |
| 81 QObject* m_hashkey; | 80 QObject* m_hashkey; |
| 82 mutable QHash<QByteArray, JSObject*> m_methods; | 81 mutable QHash<QByteArray, JSObject*> m_methods; |
| 83 mutable QHash<QString, QtField*> m_fields; | 82 mutable QHash<QString, QtField*> m_fields; |
| 84 mutable QSet<JSValuePtr> m_children; | 83 mutable QSet<JSValuePtr> m_children; |
| 85 mutable QtRuntimeMetaMethod* m_defaultMethod; | 84 mutable QtRuntimeMetaMethod* m_defaultMethod; |
| 86 QScriptEngine::ValueOwnership m_ownership; | |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 } // namespace Bindings | 87 } // namespace Bindings |
| 90 | 88 |
| 91 } // namespace JSC | 89 } // namespace JSC |
| 92 | 90 |
| 93 #endif | 91 #endif |
| OLD | NEW |