#ifndef BINDINGS_OBJC_INSTANCE_H_
#define BINDINGS_OBJC_INSTANCE_H_
#include "objc_class.h"
#include "objc_utility.h"
namespace JSC {
namespace Bindings {
class ObjcClass;
class ObjcInstance : public Instance {
public:
static RefPtr<ObjcInstance> create(ObjectStructPtr, RefPtr<RootObject>&&);
virtual ~ObjcInstance();
static void setGlobalException(NSString*, JSGlobalObject* exceptionEnvironment = 0);
virtual Class* getClass() const;
virtual JSValue valueOf(ExecState*) const;
virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const;
virtual JSValue getMethod(ExecState*, PropertyName);
JSValue invokeObjcMethod(ExecState*, ObjcMethod* method);
virtual JSValue invokeMethod(ExecState*, RuntimeMethod* method);
virtual bool supportsInvokeDefaultMethod() const;
virtual JSValue invokeDefaultMethod(ExecState*);
JSValue getValueOfUndefinedField(ExecState*, PropertyName) const;
virtual bool setValueOfUndefinedField(ExecState*, PropertyName, JSValue);
ObjectStructPtr getObject() const { return _instance.get(); }
JSValue stringValue(ExecState*) const;
JSValue numberValue(ExecState*) const;
JSValue booleanValue() const;
protected:
virtual void virtualBegin();
virtual void virtualEnd();
private:
friend class ObjcField;
static void moveGlobalExceptionToExecState(ExecState*);
ObjcInstance(ObjectStructPtr, RefPtr<RootObject>&&);
virtual RuntimeObject* newRuntimeObject(ExecState*);
RetainPtr<ObjectStructPtr> _instance;
mutable ObjcClass *_class;
ObjectStructPtr _pool;
int _beginCount;
};
}
}
#endif // BINDINGS_OBJC_INSTANCE_H_