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 void initialize(Class *clazz)
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.
Condition * init(Condition *self)
Initializes this Condition.
Object is the root Class of The Objectively Class hierarchy.
Class * clazz
Every instance of Object begins with a pointer to its Class.
Class * _Object(void)
The Object archetype.
Object * copy(const Object *self)
Creates a shallow copy of this Object.
_Bool isKindOfClass(const Object *self, const Class *clazz)
Tests for Class hierarchy membership.
String * description(const Object *self)
_Bool isEqual(const Object *self, const Object *other)
Tests equality of the other Object.
int hash(const Object *self)
void dealloc(Object *self)
Frees all resources held by this Object.