source: trunk/src/script/bridge/qscriptglobalobject_p.h@ 1028

Last change on this file since 1028 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 6.2 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
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 [email protected].
20** $QT_END_LICENSE$
21**
22****************************************************************************/
23
24#ifndef QSCRIPTGLOBALOBJECT_P_H
25#define QSCRIPTGLOBALOBJECT_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 "JSGlobalObject.h"
41
42QT_BEGIN_NAMESPACE
43
44namespace QScript
45{
46
47class GlobalObject : public JSC::JSGlobalObject
48{
49public:
50 GlobalObject();
51 virtual ~GlobalObject();
52 virtual JSC::UString className() const { return "global"; }
53 virtual void markChildren(JSC::MarkStack&);
54 virtual bool getOwnPropertySlot(JSC::ExecState*,
55 const JSC::Identifier& propertyName,
56 JSC::PropertySlot&);
57 virtual bool getOwnPropertyDescriptor(JSC::ExecState*,
58 const JSC::Identifier& propertyName,
59 JSC::PropertyDescriptor&);
60 virtual void put(JSC::ExecState* exec, const JSC::Identifier& propertyName,
61 JSC::JSValue, JSC::PutPropertySlot&);
62 virtual void putWithAttributes(JSC::ExecState* exec, const JSC::Identifier& propertyName,
63 JSC::JSValue value, unsigned attributes);
64 virtual bool deleteProperty(JSC::ExecState*,
65 const JSC::Identifier& propertyName);
66 virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&,
67 JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties);
68 virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes = 0);
69 virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes = 0);
70 virtual JSC::JSValue lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName);
71 virtual JSC::JSValue lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName);
72
73public:
74 JSC::JSObject *customGlobalObject;
75};
76
77class OriginalGlobalObjectProxy : public JSC::JSObject
78{
79public:
80 explicit OriginalGlobalObjectProxy(WTF::PassRefPtr<JSC::Structure> sid,
81 JSC::JSGlobalObject *object)
82 : JSC::JSObject(sid), originalGlobalObject(object)
83 {}
84 virtual ~OriginalGlobalObjectProxy()
85 {}
86 virtual JSC::UString className() const
87 { return originalGlobalObject->className(); }
88 virtual void markChildren(JSC::MarkStack& markStack)
89 {
90 markStack.append(originalGlobalObject);
91 JSC::JSObject::markChildren(markStack);
92 }
93 virtual bool getOwnPropertySlot(JSC::ExecState* exec,
94 const JSC::Identifier& propertyName,
95 JSC::PropertySlot& slot)
96 { return originalGlobalObject->JSC::JSGlobalObject::getOwnPropertySlot(exec, propertyName, slot); }
97 virtual bool getOwnPropertyDescriptor(JSC::ExecState* exec,
98 const JSC::Identifier& propertyName,
99 JSC::PropertyDescriptor& descriptor)
100 { return originalGlobalObject->JSC::JSGlobalObject::getOwnPropertyDescriptor(exec, propertyName, descriptor); }
101 virtual void put(JSC::ExecState* exec, const JSC::Identifier& propertyName,
102 JSC::JSValue value, JSC::PutPropertySlot& slot)
103 { originalGlobalObject->JSC::JSGlobalObject::put(exec, propertyName, value, slot); }
104 virtual void putWithAttributes(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSValue value, unsigned attributes)
105 { originalGlobalObject->JSC::JSGlobalObject::putWithAttributes(exec, propertyName, value, attributes); }
106 virtual bool deleteProperty(JSC::ExecState* exec,
107 const JSC::Identifier& propertyName)
108 { return originalGlobalObject->JSC::JSGlobalObject::deleteProperty(exec, propertyName); }
109 virtual void getOwnPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties)
110 { originalGlobalObject->JSC::JSGlobalObject::getOwnPropertyNames(exec, propertyNames, mode); }
111 virtual void defineGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes)
112 { originalGlobalObject->JSC::JSGlobalObject::defineGetter(exec, propertyName, getterFunction, attributes); }
113 virtual void defineSetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes)
114 { originalGlobalObject->JSC::JSGlobalObject::defineSetter(exec, propertyName, setterFunction, attributes); }
115 virtual JSC::JSValue lookupGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName)
116 { return originalGlobalObject->JSC::JSGlobalObject::lookupGetter(exec, propertyName); }
117 virtual JSC::JSValue lookupSetter(JSC::ExecState* exec, const JSC::Identifier& propertyName)
118 { return originalGlobalObject->JSC::JSGlobalObject::lookupSetter(exec, propertyName); }
119private:
120 JSC::JSGlobalObject *originalGlobalObject;
121};
122
123} // namespace QScript
124
125QT_END_NAMESPACE
126
127#endif
Note: See TracBrowser for help on using the repository browser.