tizen beta release
[framework/web/webkit-efl.git] / Source / JavaScriptCore / runtime / RegExpMatchesArray.h
1 /*
2  *  Copyright (C) 2008 Apple Inc. All Rights Reserved.
3  *
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.
8  *
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.
13  *
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
17  *
18  */
19
20 #ifndef RegExpMatchesArray_h
21 #define RegExpMatchesArray_h
22
23 #include "JSArray.h"
24
25 namespace JSC {
26
27     class RegExpMatchesArray : public JSArray {
28     private:
29         RegExpMatchesArray(ExecState*);
30
31     public:
32         typedef JSArray Base;
33
34         static RegExpMatchesArray* create(ExecState* exec, RegExpConstructorPrivate* ctorPrivate)
35         {
36             RegExpMatchesArray* regExp = new (allocateCell<RegExpMatchesArray>(*exec->heap())) RegExpMatchesArray(exec);
37             regExp->finishCreation(exec->globalData(), ctorPrivate);
38             return regExp;
39         }
40         virtual ~RegExpMatchesArray();
41
42         static JS_EXPORTDATA const ClassInfo s_info;
43         
44         static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
45         {
46             return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
47         }
48         
49     protected:
50         void finishCreation(JSGlobalData&, RegExpConstructorPrivate* data);
51
52     private:
53         static bool getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
54         {
55             RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
56             if (thisObject->subclassData())
57                 thisObject->fillArrayInstance(exec);
58             return JSArray::getOwnPropertySlot(thisObject, exec, propertyName, slot);
59         }
60
61         static bool getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
62         {
63             RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
64             if (thisObject->subclassData())
65                 thisObject->fillArrayInstance(exec);
66             return JSArray::getOwnPropertySlotByIndex(thisObject, exec, propertyName, slot);
67         }
68
69         static bool getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
70         {
71             RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
72             if (thisObject->subclassData())
73                 thisObject->fillArrayInstance(exec);
74             return JSArray::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
75         }
76
77         static void put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue v, PutPropertySlot& slot)
78         {
79             RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
80             if (thisObject->subclassData())
81                 thisObject->fillArrayInstance(exec);
82             JSArray::put(thisObject, exec, propertyName, v, slot);
83         }
84         
85         static void putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue v)
86         {
87             RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
88             if (thisObject->subclassData())
89                 thisObject->fillArrayInstance(exec);
90             JSArray::putByIndex(thisObject, exec, propertyName, v);
91         }
92
93         static bool deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
94         {
95             RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
96             if (thisObject->subclassData())
97                 thisObject->fillArrayInstance(exec);
98             return JSArray::deleteProperty(thisObject, exec, propertyName);
99         }
100
101         static bool deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned propertyName)
102         {
103             RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell);
104             if (thisObject->subclassData())
105                 thisObject->fillArrayInstance(exec);
106             return JSArray::deletePropertyByIndex(thisObject, exec, propertyName);
107         }
108
109         static void getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& arr, EnumerationMode mode = ExcludeDontEnumProperties)
110         {
111             RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
112             if (thisObject->subclassData())
113                 thisObject->fillArrayInstance(exec);
114             JSArray::getOwnPropertyNames(thisObject, exec, arr, mode);
115         }
116
117         void fillArrayInstance(ExecState*);
118 };
119
120 }
121
122 #endif // RegExpMatchesArray_h