]>
git.saurik.com Git - apple/javascriptcore.git/blob - runtime/RegExpObject.h
2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
3 * Copyright (C) 2003, 2007, 2008 Apple Inc. All Rights Reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef RegExpObject_h
22 #define RegExpObject_h
29 class RegExpObject
: public JSObject
{
31 RegExpObject(PassRefPtr
<Structure
>, PassRefPtr
<RegExp
>);
32 virtual ~RegExpObject();
34 void setRegExp(PassRefPtr
<RegExp
> r
) { d
->regExp
= r
; }
35 RegExp
* regExp() const { return d
->regExp
.get(); }
37 void setLastIndex(double lastIndex
) { d
->lastIndex
= lastIndex
; }
38 double lastIndex() const { return d
->lastIndex
; }
40 JSValuePtr
test(ExecState
*, const ArgList
&);
41 JSValuePtr
exec(ExecState
*, const ArgList
&);
43 virtual bool getOwnPropertySlot(ExecState
*, const Identifier
& propertyName
, PropertySlot
&);
44 virtual void put(ExecState
*, const Identifier
& propertyName
, JSValuePtr
, PutPropertySlot
&);
46 virtual const ClassInfo
* classInfo() const { return &info
; }
47 static const ClassInfo info
;
49 static PassRefPtr
<Structure
> createStructure(JSValuePtr prototype
)
51 return Structure::create(prototype
, TypeInfo(ObjectType
));
55 bool match(ExecState
*, const ArgList
&);
57 virtual CallType
getCallData(CallData
&);
59 struct RegExpObjectData
{
60 RegExpObjectData(PassRefPtr
<RegExp
> regExp
, double lastIndex
)
62 , lastIndex(lastIndex
)
66 RefPtr
<RegExp
> regExp
;
70 OwnPtr
<RegExpObjectData
> d
;
73 RegExpObject
* asRegExpObject(JSValuePtr
);
75 inline RegExpObject
* asRegExpObject(JSValuePtr value
)
77 ASSERT(asObject(value
)->inherits(&RegExpObject::info
));
78 return static_cast<RegExpObject
*>(asObject(value
));
83 #endif // RegExpObject_h