Qt 4.8
qscriptglobalobject_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtScript module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL-ONLY$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser
11 ** General Public License version 2.1 as published by the Free Software
12 ** Foundation and appearing in the file LICENSE.LGPL included in the
13 ** packaging of this file. Please review the following information to
14 ** ensure the GNU Lesser General Public License version 2.1 requirements
15 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** If you have questions regarding the use of this file, please contact
18 ** us via http://www.qt-project.org/.
19 **
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 
43 
44 namespace QScript
45 {
46 
47 class GlobalObject : public JSC::JSGlobalObject
48 {
49 public:
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 
73 public:
74  JSC::JSObject *customGlobalObject;
75 };
76 
77 class OriginalGlobalObjectProxy : public JSC::JSObject
78 {
79 public:
80  explicit OriginalGlobalObjectProxy(WTF::PassRefPtr<JSC::Structure> sid,
81  JSC::JSGlobalObject *object)
82  : JSC::JSObject(sid), originalGlobalObject(object)
83  {}
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); }
119 private:
120  JSC::JSGlobalObject *originalGlobalObject;
121 };
122 
123 } // namespace QScript
124 
126 
127 #endif
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
virtual bool getOwnPropertySlot(JSC::ExecState *, const JSC::Identifier &propertyName, JSC::PropertySlot &)
virtual void putWithAttributes(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes)
virtual void defineSetter(JSC::ExecState *, const JSC::Identifier &propertyName, JSC::JSObject *setterFunction, unsigned attributes=0)
virtual void defineGetter(JSC::ExecState *, const JSC::Identifier &propertyName, JSC::JSObject *getterFunction, unsigned attributes=0)
virtual JSC::JSValue lookupSetter(JSC::ExecState *exec, const JSC::Identifier &propertyName)
virtual void getOwnPropertyNames(JSC::ExecState *exec, JSC::PropertyNameArray &propertyNames, JSC::EnumerationMode mode=JSC::ExcludeDontEnumProperties)
virtual bool getOwnPropertySlot(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::PropertySlot &slot)
virtual bool getOwnPropertyDescriptor(JSC::ExecState *, const JSC::Identifier &propertyName, JSC::PropertyDescriptor &)
virtual void put(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue, JSC::PutPropertySlot &)
virtual bool getOwnPropertyDescriptor(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::PropertyDescriptor &descriptor)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual JSC::JSValue lookupGetter(JSC::ExecState *, const JSC::Identifier &propertyName)
virtual JSC::UString className() const
virtual void defineSetter(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSObject *setterFunction, unsigned attributes)
virtual JSC::JSValue lookupSetter(JSC::ExecState *, const JSC::Identifier &propertyName)
virtual void put(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, JSC::PutPropertySlot &slot)
virtual void putWithAttributes(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes)
OriginalGlobalObjectProxy(WTF::PassRefPtr< JSC::Structure > sid, JSC::JSGlobalObject *object)
virtual bool deleteProperty(JSC::ExecState *exec, const JSC::Identifier &propertyName)
JSC::JSObject * customGlobalObject
virtual void defineGetter(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSObject *getterFunction, unsigned attributes)
virtual JSC::UString className() const
virtual void markChildren(JSC::MarkStack &)
virtual JSC::JSValue lookupGetter(JSC::ExecState *exec, const JSC::Identifier &propertyName)
virtual void markChildren(JSC::MarkStack &markStack)
virtual void getOwnPropertyNames(JSC::ExecState *, JSC::PropertyNameArray &, JSC::EnumerationMode mode=JSC::ExcludeDontEnumProperties)
virtual bool deleteProperty(JSC::ExecState *, const JSC::Identifier &propertyName)