42 if (this->destructor) {
43 this->destructor(this->value);
56 uintptr_t addr = (uintptr_t) this->value;
58 return (
int) ((13 * addr) ^ (addr >> 15));
75 return this->value == that->
value;
92 self->
value = calloc(1, length);
95 memcpy(self->
value, bytes, length);
117#pragma mark - Class lifecycle
144 .instanceSize =
sizeof(
Value),
145 .interfaceOffset = offsetof(
Value, interface),
146 .interfaceSize =
sizeof(ValueInterface),
Class * _initialize(const ClassDef *def)
Initializes the given Class.
#define super(type, obj, method,...)
Utilities for calculating hash values.
void * ident
The identity type, similar to Objective-C id.
static void initialize(Class *clazz)
Values provide Object encapsulation for C types.
#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.
Condition * init(Condition *self)
Initializes this Condition.
Data * initWithBytes(Data *self, const uint8_t *bytes, size_t length)
Initializes this Data by copying length of bytes.
Number * initWithValue(Number *self, double value)
Initializes this Number with the specified value.
Object is the root Class of The Objectively Class hierarchy.
Class * _Object(void)
The Object archetype.
_Bool isKindOfClass(const Object *self, const Class *clazz)
Tests for Class hierarchy membership.
_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.
Values provide Object encapsulation for C types.
ValueDestructor destructor
An optional destructor that, if set, is called on dealloc.
Class * _Value(void)
The Value archetype.
ident value
The backing value.