2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef RegExpMatchesArray_h
21 #define RegExpMatchesArray_h
27 class RegExpMatchesArray : public JSArray {
29 RegExpMatchesArray(ExecState*);
34 static RegExpMatchesArray* create(ExecState* exec, RegExpConstructorPrivate* ctorPrivate)
36 RegExpMatchesArray* regExp = new (allocateCell<RegExpMatchesArray>(*exec->heap())) RegExpMatchesArray(exec);
37 regExp->finishCreation(exec->globalData(), ctorPrivate);
40 virtual ~RegExpMatchesArray();
42 static JS_EXPORTDATA const ClassInfo s_info;
44 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
46 return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
50 void finishCreation(JSGlobalData&, RegExpConstructorPrivate* data);
53 static bool getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
55 RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
56 if (thisObject->subclassData())
57 thisObject->fillArrayInstance(exec);
58 return JSArray::getOwnPropertySlot(thisObject, exec, propertyName, slot);
61 static bool getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
63 RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
64 if (thisObject->subclassData())
65 thisObject->fillArrayInstance(exec);
66 return JSArray::getOwnPropertySlotByIndex(thisObject, exec, propertyName, slot);
69 static bool getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
71 RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
72 if (thisObject->subclassData())
73 thisObject->fillArrayInstance(exec);
74 return JSArray::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
77 static void put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue v, PutPropertySlot& slot)
79 RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
80 if (thisObject->subclassData())
81 thisObject->fillArrayInstance(exec);
82 JSArray::put(thisObject, exec, propertyName, v, slot);
85 static void putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue v)
87 RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
88 if (thisObject->subclassData())
89 thisObject->fillArrayInstance(exec);
90 JSArray::putByIndex(thisObject, exec, propertyName, v);
93 static bool deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
95 RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
96 if (thisObject->subclassData())
97 thisObject->fillArrayInstance(exec);
98 return JSArray::deleteProperty(thisObject, exec, propertyName);
101 static bool deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned propertyName)
103 RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
104 if (thisObject->subclassData())
105 thisObject->fillArrayInstance(exec);
106 return JSArray::deletePropertyByIndex(thisObject, exec, propertyName);
109 static void getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& arr, EnumerationMode mode = ExcludeDontEnumProperties)
111 RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
112 if (thisObject->subclassData())
113 thisObject->fillArrayInstance(exec);
114 JSArray::getOwnPropertyNames(thisObject, exec, arr, mode);
117 void fillArrayInstance(ExecState*);
122 #endif // RegExpMatchesArray_h