Qt 4.8
qscriptstaticscopeobject_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 QSCRIPTSTATICSCOPEOBJECT_P_H
25 #define QSCRIPTSTATICSCOPEOBJECT_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 "JSVariableObject.h"
41 
43 
44 class QScriptStaticScopeObject : public JSC::JSVariableObject {
45 public:
46  struct PropertyInfo {
47  PropertyInfo(const JSC::Identifier& i, JSC::JSValue v, unsigned a)
48  : identifier(i), value(v), attributes(a)
49  { }
51 
52  JSC::Identifier identifier;
53  JSC::JSValue value;
54  unsigned attributes;
55  };
56 
57  QScriptStaticScopeObject(WTF::NonNullPassRefPtr<JSC::Structure> structure,
58  int propertyCount, const PropertyInfo*);
59  QScriptStaticScopeObject(WTF::NonNullPassRefPtr<JSC::Structure> structure);
60  virtual ~QScriptStaticScopeObject();
61 
62  virtual bool isDynamicScope() const { return false; }
63 
64  virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
65  virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
66 
67  virtual void putWithAttributes(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes);
68  virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue value, JSC::PutPropertySlot&);
69 
70  virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier& propertyName);
71 
72  virtual void markChildren(JSC::MarkStack&);
73 
74  virtual const JSC::ClassInfo* classInfo() const { return &info; }
75  static const JSC::ClassInfo info;
76 
77  static WTF::PassRefPtr<JSC::Structure> createStructure(JSC::JSValue proto) {
78  return JSC::Structure::create(proto, JSC::TypeInfo(JSC::ObjectType, StructureFlags));
79  }
80 
81 protected:
82  static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::NeedsThisConversion | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames | JSC::JSVariableObject::StructureFlags;
83 
84  struct Data : public JSVariableObjectData {
85  Data(bool canGrow_)
86  : JSVariableObjectData(&symbolTable, /*registers=*/0),
87  canGrow(canGrow_), registerArraySize(0)
88  { }
89  bool canGrow;
91  JSC::SymbolTable symbolTable;
92  };
93 
94  Data* d_ptr() const { return static_cast<Data*>(JSVariableObject::d); }
95 
96 private:
97  void addSymbolTableProperty(const JSC::Identifier&, JSC::JSValue, unsigned attributes);
98  int growRegisterArray(int);
99 };
100 
102 
103 #endif
double d
Definition: qnumeric_p.h:62
virtual void markChildren(JSC::MarkStack &)
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
long ASN1_INTEGER_get ASN1_INTEGER * a
QScriptStaticScopeObject(WTF::NonNullPassRefPtr< JSC::Structure > structure, int propertyCount, const PropertyInfo *)
Creates a static scope object with a fixed set of undeletable properties.
static WTF::PassRefPtr< JSC::Structure > createStructure(JSC::JSValue proto)
virtual bool getOwnPropertyDescriptor(JSC::ExecState *, const JSC::Identifier &propertyName, JSC::PropertyDescriptor &)
void addSymbolTableProperty(const JSC::Identifier &, JSC::JSValue, unsigned attributes)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
static const unsigned StructureFlags
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 const JSC::ClassInfo * classInfo() const
int growRegisterArray(int)
Grows the register array by count elements, and returns the offset of the newly added elements (note ...
virtual void put(JSC::ExecState *, const JSC::Identifier &propertyName, JSC::JSValue value, JSC::PutPropertySlot &)
virtual bool deleteProperty(JSC::ExecState *, const JSC::Identifier &propertyName)
Represents a static scope object.
PropertyInfo(const JSC::Identifier &i, JSC::JSValue v, unsigned a)
static const JSC::ClassInfo info