From 8b9c72390597c324d43dbff1fc7e0e7285336ed2 Mon Sep 17 00:00:00 2001 From: qmathe Date: Sun, 27 Dec 2009 22:00:44 +0000 Subject: [PATCH] Added object_setClass --- objc/runtime.h | 1 + runtime.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/objc/runtime.h b/objc/runtime.h index bd9be4e..f6d3c67 100644 --- a/objc/runtime.h +++ b/objc/runtime.h @@ -225,6 +225,7 @@ void *object_getIndexedIvars(id obj); id object_dispose(id obj); Class object_getClass(id obj); +Class object_setClass(id obj, Class cls); const char *object_getClassName(id obj); diff --git a/runtime.c b/runtime.c index 3c9c612..bbea307 100644 --- a/runtime.c +++ b/runtime.c @@ -765,6 +765,17 @@ Class object_getClass(id obj) return Nil; } +Class object_setClass(id obj, Class cls) +{ + if (nil != obj) + { + Class oldClass = obj->isa; + obj->isa = cls; + return oldClass; + } + return Nil; +} + const char *object_getClassName(id obj) { return class_getName(object_getClass(obj));