]>
git.saurik.com Git - apple/javascriptcore.git/blob - runtime/RegExpConstructor.h
f8c43663c9736e816da228131f22d77da252e2aa
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 RegExpConstructor_h
22 #define RegExpConstructor_h
24 #include "InternalFunction.h"
25 #include <wtf/OwnPtr.h>
30 class RegExpPrototype
;
31 struct RegExpConstructorPrivate
;
33 class RegExpConstructor
: public InternalFunction
{
35 RegExpConstructor(ExecState
*, PassRefPtr
<Structure
>, RegExpPrototype
*);
37 static PassRefPtr
<Structure
> createStructure(JSValuePtr prototype
)
39 return Structure::create(prototype
, TypeInfo(ObjectType
, ImplementsHasInstance
));
42 virtual void put(ExecState
*, const Identifier
& propertyName
, JSValuePtr
, PutPropertySlot
&);
43 virtual bool getOwnPropertySlot(ExecState
*, const Identifier
& propertyName
, PropertySlot
&);
45 static const ClassInfo info
;
47 void performMatch(RegExp
*, const UString
&, int startOffset
, int& position
, int& length
, int** ovector
= 0);
48 JSObject
* arrayOfMatches(ExecState
*) const;
50 void setInput(const UString
&);
51 const UString
& input() const;
53 void setMultiline(bool);
54 bool multiline() const;
56 JSValuePtr
getBackref(ExecState
*, unsigned) const;
57 JSValuePtr
getLastParen(ExecState
*) const;
58 JSValuePtr
getLeftContext(ExecState
*) const;
59 JSValuePtr
getRightContext(ExecState
*) const;
62 virtual ConstructType
getConstructData(ConstructData
&);
63 virtual CallType
getCallData(CallData
&);
65 virtual const ClassInfo
* classInfo() const { return &info
; }
67 OwnPtr
<RegExpConstructorPrivate
> d
;
70 RegExpConstructor
* asRegExpConstructor(JSValuePtr
);
72 JSObject
* constructRegExp(ExecState
*, const ArgList
&);
74 inline RegExpConstructor
* asRegExpConstructor(JSValuePtr value
)
76 ASSERT(asObject(value
)->inherits(&RegExpConstructor::info
));
77 return static_cast<RegExpConstructor
*>(asObject(value
));
82 #endif // RegExpConstructor_h