|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtScript module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL-ONLY$ |
|
10 ** GNU Lesser General Public License Usage |
|
11 ** This file may be used under the terms of the GNU Lesser |
|
12 ** General Public License version 2.1 as published by the Free Software |
|
13 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
14 ** packaging of this file. Please review the following information to |
|
15 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
16 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
17 ** |
|
18 ** If you have questions regarding the use of this file, please contact |
|
19 ** Nokia at qt-info@nokia.com. |
|
20 ** $QT_END_LICENSE$ |
|
21 ** |
|
22 ****************************************************************************/ |
|
23 |
|
24 #ifndef QSCRIPTCLASSOBJECT_P_H |
|
25 #define QSCRIPTCLASSOBJECT_P_H |
|
26 |
|
27 // |
|
28 // W A R N I N G |
|
29 // ------------- |
|
30 // |
|
31 // This file is not part of the Qt API. It exists purely as an |
|
32 // implementation detail. This header file may change from version to |
|
33 // version without notice, or even be removed. |
|
34 // |
|
35 // We mean it. |
|
36 // |
|
37 |
|
38 #include <QtCore/qobjectdefs.h> |
|
39 |
|
40 #include "qscriptobject_p.h" |
|
41 |
|
42 QT_BEGIN_NAMESPACE |
|
43 |
|
44 class QScriptClass; |
|
45 |
|
46 namespace QScript |
|
47 { |
|
48 |
|
49 class ClassObjectDelegate : public QScriptObjectDelegate |
|
50 { |
|
51 public: |
|
52 ClassObjectDelegate(QScriptClass *scriptClass); |
|
53 ~ClassObjectDelegate(); |
|
54 |
|
55 inline QScriptClass *scriptClass() const; |
|
56 inline void setScriptClass(QScriptClass *scriptClass); |
|
57 |
|
58 virtual Type type() const; |
|
59 |
|
60 virtual bool getOwnPropertySlot(QScriptObject*, JSC::ExecState*, |
|
61 const JSC::Identifier& propertyName, |
|
62 JSC::PropertySlot&); |
|
63 virtual void put(QScriptObject*, JSC::ExecState* exec, |
|
64 const JSC::Identifier& propertyName, |
|
65 JSC::JSValue, JSC::PutPropertySlot&); |
|
66 virtual bool deleteProperty(QScriptObject*, JSC::ExecState*, |
|
67 const JSC::Identifier& propertyName, |
|
68 bool checkDontDelete = true); |
|
69 virtual bool getPropertyAttributes(const QScriptObject*, JSC::ExecState*, |
|
70 const JSC::Identifier&, |
|
71 unsigned&) const; |
|
72 virtual void getOwnPropertyNames(QScriptObject*, JSC::ExecState*, |
|
73 JSC::PropertyNameArray&, |
|
74 bool includeNonEnumerable = false); |
|
75 |
|
76 virtual JSC::CallType getCallData(QScriptObject*, JSC::CallData&); |
|
77 static JSC::JSValue JSC_HOST_CALL call(JSC::ExecState*, JSC::JSObject*, |
|
78 JSC::JSValue, const JSC::ArgList&); |
|
79 virtual JSC::ConstructType getConstructData(QScriptObject*, JSC::ConstructData&); |
|
80 static JSC::JSObject* construct(JSC::ExecState*, JSC::JSObject*, |
|
81 const JSC::ArgList&); |
|
82 |
|
83 virtual bool hasInstance(QScriptObject*, JSC::ExecState*, |
|
84 JSC::JSValue value, JSC::JSValue proto); |
|
85 |
|
86 private: |
|
87 QScriptClass *m_scriptClass; |
|
88 }; |
|
89 |
|
90 inline QScriptClass *ClassObjectDelegate::scriptClass() const |
|
91 { |
|
92 return m_scriptClass; |
|
93 } |
|
94 |
|
95 inline void ClassObjectDelegate::setScriptClass(QScriptClass *scriptClass) |
|
96 { |
|
97 Q_ASSERT(scriptClass != 0); |
|
98 m_scriptClass = scriptClass; |
|
99 } |
|
100 |
|
101 } // namespace QScript |
|
102 |
|
103 QT_END_NAMESPACE |
|
104 |
|
105 #endif |