#ifndef RegExpObject_h
#define RegExpObject_h
#include "JSObject.h"
#include "RegExp.h"
namespace JSC {
class RegExpObject : public JSObject {
public:
RegExpObject(PassRefPtr<Structure>, PassRefPtr<RegExp>);
virtual ~RegExpObject();
void setRegExp(PassRefPtr<RegExp> r) { d->regExp = r; }
RegExp* regExp() const { return d->regExp.get(); }
void setLastIndex(double lastIndex) { d->lastIndex = lastIndex; }
double lastIndex() const { return d->lastIndex; }
JSValuePtr test(ExecState*, const ArgList&);
JSValuePtr exec(ExecState*, const ArgList&);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual void put(ExecState*, const Identifier& propertyName, JSValuePtr, PutPropertySlot&);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
static PassRefPtr<Structure> createStructure(JSValuePtr prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType));
}
private:
bool match(ExecState*, const ArgList&);
virtual CallType getCallData(CallData&);
struct RegExpObjectData {
RegExpObjectData(PassRefPtr<RegExp> regExp, double lastIndex)
: regExp(regExp)
, lastIndex(lastIndex)
{
}
RefPtr<RegExp> regExp;
double lastIndex;
};
OwnPtr<RegExpObjectData> d;
};
RegExpObject* asRegExpObject(JSValuePtr);
inline RegExpObject* asRegExpObject(JSValuePtr value)
{
ASSERT(asObject(value)->inherits(&RegExpObject::info));
return static_cast<RegExpObject*>(asObject(value));
}
}
#endif // RegExpObject_h