#ifndef StringObject_h
#define StringObject_h
#include "JSWrapperObject.h"
#include "JSString.h"
namespace JSC {
class StringObject : public JSWrapperObject {
public:
typedef JSWrapperObject Base;
static StringObject* create(ExecState* exec, Structure* structure)
{
return new (allocateCell<StringObject>(*exec->heap())) StringObject(exec, structure);
}
static StringObject* create(ExecState* exec, Structure* structure, const UString& str)
{
return new (allocateCell<StringObject>(*exec->heap())) StringObject(exec, structure, str);
}
static StringObject* create(ExecState*, JSGlobalObject*, JSString*);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void put(ExecState* exec, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
static const JS_EXPORTDATA ClassInfo s_info;
JSString* internalValue() const { return asString(JSWrapperObject::internalValue());}
static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
StringObject(ExecState*, Structure*);
StringObject(ExecState*, Structure*, const UString&);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSWrapperObject::StructureFlags;
StringObject(JSGlobalData&, Structure*, JSString*);
};
StringObject* asStringObject(JSValue);
inline StringObject* asStringObject(JSValue value)
{
ASSERT(asObject(value)->inherits(&StringObject::s_info));
return static_cast<StringObject*>(asObject(value));
}
}
#endif // StringObject_h