#ifndef _BINDINGS_OBJC_RUNTIME_H_
#define _BINDINGS_OBJC_RUNTIME_H_
#include <CoreFoundation/CoreFoundation.h>
#include <runtime.h>
#include <ustring.h>
#include <objc_header.h>
namespace KJS
{
class Value;
namespace Bindings
{
class ObjcField : public Field
{
public:
ObjcField(Ivar ivar);
~ObjcField() {};
ObjcField(const ObjcField &other) : Field() {
_ivar = other._ivar;
};
ObjcField &operator=(const ObjcField &other) {
if (this == &other)
return *this;
_ivar = other._ivar;
return *this;
};
virtual KJS::Value valueFromInstance(KJS::ExecState *exec, const Instance *instance) const;
virtual void setValueToInstance(KJS::ExecState *exec, const Instance *instance, const KJS::Value &aValue) const;
virtual const char *name() const;
virtual RuntimeType type() const;
private:
Ivar _ivar;
};
class ObjcMethod : public Method
{
public:
ObjcMethod() : Method(), _objcClass(0), _selector(0) {};
ObjcMethod(struct objc_class *aClass, const char *_selector);
~ObjcMethod () {
};
ObjcMethod(const ObjcMethod &other) : Method() {
_objcClass = other._objcClass;
_selector = other._selector;
};
ObjcMethod &operator=(const ObjcMethod &other) {
if (this == &other)
return *this;
_objcClass = other._objcClass;
_selector = other._selector;
return *this;
}
virtual const char *name() const;
virtual long numParameters() const;
NSMethodSignature *getMethodSignature() const;
private:
struct objc_class *_objcClass;
const char *_selector;
};
class ObjcArray : public Array
{
public:
ObjcArray (ObjectStructPtr a);
ObjcArray (const ObjcArray &other);
ObjcArray &operator=(const ObjcArray &other);
virtual void setValueAt(KJS::ExecState *exec, unsigned int index, const KJS::Value &aValue) const;
virtual KJS::Value valueAt(KJS::ExecState *exec, unsigned int index) const;
virtual unsigned int getLength() const;
virtual ~ObjcArray();
ObjectStructPtr getObjcArray() const { return _array; }
static KJS::Value convertObjcArrayToArray (KJS::ExecState *exec, ObjectStructPtr anObject);
private:
ObjectStructPtr _array;
};
}
}
#endif