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     public:
29         RegExpMatchesArray(ExecState*, RegExpConstructorPrivate*);
30         virtual ~RegExpMatchesArray();
31 
32     private:
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)33         virtual bool getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
34         {
35             if (lazyCreationData())
36                 fillArrayInstance(exec);
37             return JSArray::getOwnPropertySlot(exec, propertyName, slot);
38         }
39 
getOwnPropertySlot(ExecState * exec,unsigned propertyName,PropertySlot & slot)40         virtual bool getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
41         {
42             if (lazyCreationData())
43                 fillArrayInstance(exec);
44             return JSArray::getOwnPropertySlot(exec, propertyName, slot);
45         }
46 
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)47         virtual bool getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
48         {
49             if (lazyCreationData())
50                 fillArrayInstance(exec);
51             return JSArray::getOwnPropertyDescriptor(exec, propertyName, descriptor);
52         }
53 
put(ExecState * exec,const Identifier & propertyName,JSValue v,PutPropertySlot & slot)54         virtual void put(ExecState* exec, const Identifier& propertyName, JSValue v, PutPropertySlot& slot)
55         {
56             if (lazyCreationData())
57                 fillArrayInstance(exec);
58             JSArray::put(exec, propertyName, v, slot);
59         }
60 
put(ExecState * exec,unsigned propertyName,JSValue v)61         virtual void put(ExecState* exec, unsigned propertyName, JSValue v)
62         {
63             if (lazyCreationData())
64                 fillArrayInstance(exec);
65             JSArray::put(exec, propertyName, v);
66         }
67 
deleteProperty(ExecState * exec,const Identifier & propertyName)68         virtual bool deleteProperty(ExecState* exec, const Identifier& propertyName)
69         {
70             if (lazyCreationData())
71                 fillArrayInstance(exec);
72             return JSArray::deleteProperty(exec, propertyName);
73         }
74 
deleteProperty(ExecState * exec,unsigned propertyName)75         virtual bool deleteProperty(ExecState* exec, unsigned propertyName)
76         {
77             if (lazyCreationData())
78                 fillArrayInstance(exec);
79             return JSArray::deleteProperty(exec, propertyName);
80         }
81 
82         virtual void getOwnPropertyNames(ExecState* exec, PropertyNameArray& arr, EnumerationMode mode = ExcludeDontEnumProperties)
83         {
84             if (lazyCreationData())
85                 fillArrayInstance(exec);
86             JSArray::getOwnPropertyNames(exec, arr, mode);
87         }
88 
89         void fillArrayInstance(ExecState*);
90 };
91 
92 }
93 
94 #endif // RegExpMatchesArray_h
95