45 object->referenceCount = 1;
74 uintptr_t addr = (uintptr_t) self;
76 return (
int) ((13 * addr) ^ (addr >> 15));
107 if (memcmp(c, clazz,
sizeof(*c)) == 0) {
116#pragma mark - Class lifecycle
143 .instanceSize =
sizeof(
Object),
144 .interfaceOffset = offsetof(
Object, interface),
145 .interfaceSize =
sizeof(ObjectInterface),
Class * _initialize(const ClassDef *def)
Initializes the given Class.
#define alloc(type)
Allocate and initialize and instance of type.
static bool isKindOfClass(const Object *self, const Class *clazz)
static bool isEqual(const Object *self, const Object *other)
static String * description(const Object *self)
static void dealloc(Object *self)
static Object * copy(const Object *self)
static Object * init(Object *self)
static void initialize(Class *clazz)
static int hash(const Object *self)
Object is the root Class of The Objectively Class hierarchy.
void * ident
The identity type, similar to Objective-C id.
#define do_once(once, block)
Executes the given block at most one time.
ClassDefs are passed to _initialize via an archetype to initialize a Class.
size_t instanceSize
The instance size (required).
Class * superclass
The superclass (required). e.g. _Object().
const char * name
The Class name (required).
The runtime representation of a Class.
ClassDef def
The Class definition.
ident interface
The interface of the Class.
Object is the root Class of The Objectively Class hierarchy.
Class * clazz
Every instance of Object begins with a pointer to its Class.
int hash(const Object *self)
bool isEqual(const Object *self, const Object *other)
Tests equality of the other Object.
void dealloc(Object *self)
Frees all resources held by this Object.