diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:30:52 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:30:52 -0800 |
commit | 8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (patch) | |
tree | 11425ea0b299d6fb89c6d3618a22d97d5bf68d0f /WebCore/bridge/qt/qt_instance.h | |
parent | 648161bb0edfc3d43db63caed5cc5213bc6cb78f (diff) | |
download | external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.zip external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.tar.gz external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'WebCore/bridge/qt/qt_instance.h')
-rw-r--r-- | WebCore/bridge/qt/qt_instance.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/WebCore/bridge/qt/qt_instance.h b/WebCore/bridge/qt/qt_instance.h new file mode 100644 index 0000000..d70e362 --- /dev/null +++ b/WebCore/bridge/qt/qt_instance.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef BINDINGS_QT_INSTANCE_H_ +#define BINDINGS_QT_INSTANCE_H_ + +#include "runtime.h" +#include "runtime_root.h" +#include <qpointer.h> +#include <qhash.h> +#include <qset.h> + +namespace JSC { + +namespace Bindings { + +class QtClass; +class QtField; +class QtRuntimeMetaMethod; + +class QtInstance : public Instance { +public: + ~QtInstance(); + + virtual Class* getClass() const; + + virtual void begin(); + virtual void end(); + + virtual JSValue* valueOf(ExecState*) const; + virtual JSValue* defaultValue(ExecState*, PreferredPrimitiveType) const; + + virtual void mark(); // This isn't inherited + + virtual JSValue* invokeMethod(ExecState*, const MethodList&, const ArgList&); + + virtual void getPropertyNames(ExecState*, PropertyNameArray&); + + virtual BindingLanguage getBindingLanguage() const { return QtLanguage; } + + JSValue* stringValue(ExecState* exec) const; + JSValue* numberValue(ExecState* exec) const; + JSValue* booleanValue() const; + + QObject* getObject() const { return m_object; } + + static PassRefPtr<QtInstance> getQtInstance(QObject*, PassRefPtr<RootObject>); + static RuntimeObjectImp* getRuntimeObject(ExecState* exec, PassRefPtr<QtInstance>); + +private: + static PassRefPtr<QtInstance> create(QObject *instance, PassRefPtr<RootObject> rootObject) + { + return adoptRef(new QtInstance(instance, rootObject)); + } + + friend class QtClass; + friend class QtField; + QtInstance(QObject*, PassRefPtr<RootObject>); // Factory produced only.. + mutable QtClass* m_class; + QPointer<QObject> m_object; + QObject* m_hashkey; + mutable QHash<QByteArray, JSObject*> m_methods; + mutable QHash<QString, QtField*> m_fields; + mutable QSet<JSValue*> m_children; + mutable QtRuntimeMetaMethod* m_defaultMethod; +}; + +} // namespace Bindings + +} // namespace JSC + +#endif |