31#define _Class _Pointer
56 uintptr_t addr = (uintptr_t) this->pointer;
58 return (
int) ((13 * addr) ^ (addr >> 15));
75 return this->pointer == that->
pointer;
92 self->
pointer = calloc(1, length);
95 memcpy(self->
pointer, bytes, length);
118#pragma mark - Class lifecycle
145 .instanceSize =
sizeof(
Pointer),
146 .interfaceOffset = offsetof(
Pointer, interface),
147 .interfaceSize =
sizeof(PointerInterface),
static Array * init(Array *self)
static void destroy(Class *clazz)
Class * _initialize(const ClassDef *def)
Initializes the given Class.
#define alloc(type)
Allocate and initialize and instance of type.
#define super(type, obj, method,...)
Utilities for calculating hash values.
static bool isKindOfClass(const Object *self, const Class *clazz)
static Pointer * initWithBytes(Pointer *self, const uint8_t *bytes, size_t length)
static bool isEqual(const Object *self, const Object *other)
static void dealloc(Object *self)
Pointer * ptr(ident pointer, Consumer destroy)
static Pointer * initWithPointer(Pointer *self, ident pointer, Consumer destroy)
static void initialize(Class *clazz)
static int hash(const Object *self)
Pointers provide Object encapsulation for raw C pointers.
void * ident
The identity type, similar to Objective-C id.
void(* Consumer)(ident data)
The Consumer function type.
#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.
The runtime representation of a Class.
ident interface
The interface of the Class.
Object is the root Class of The Objectively Class hierarchy.
void dealloc(Object *self)
Frees all resources held by this Object.
Pointers provide Object encapsulation for raw C pointers.
Pointer * initWithPointer(Pointer *self, ident pointer, Consumer destroy)
Initializes this Pointer.
ident pointer
The backing pointer.
Consumer destroy
An optional destructor that, if set, is called on dealloc.