#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "Hash.h"
#include "Pointer.h"
Go to the source code of this file.
◆ _Class
◆ _Pointer()
| Class * _Pointer |
( |
void |
| ) |
|
Definition at line 137 of file Pointer.c.
137 {
140
143 .name = "Pointer",
145 .instanceSize =
sizeof(
Pointer),
146 .interfaceOffset = offsetof(
Pointer, interface),
147 .interfaceSize = sizeof(PointerInterface),
149 });
150 });
151
152 return clazz;
153}
Class * _initialize(const ClassDef *def)
Initializes the given Class.
static void initialize(Class *clazz)
#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.
Pointers provide Object encapsulation for raw C pointers.
◆ dealloc()
| static void dealloc |
( |
Object * |
self | ) |
|
|
static |
- See also
- Object::dealloc(Object *)
Definition at line 38 of file Pointer.c.
38 {
39
41
44 }
45
47}
static void destroy(Class *clazz)
#define super(type, obj, method,...)
static void dealloc(Object *self)
Object is the root Class of The Objectively Class hierarchy.
◆ hash()
| static int hash |
( |
const Object * |
self | ) |
|
|
static |
◆ initialize()
| static void initialize |
( |
Class * |
clazz | ) |
|
|
static |
- See also
- Class::initialize(Class *)
Definition at line 123 of file Pointer.c.
123 {
124
128
131}
static Pointer * initWithBytes(Pointer *self, const uint8_t *bytes, size_t length)
static bool isEqual(const Object *self, const Object *other)
static Pointer * initWithPointer(Pointer *self, ident pointer, Consumer destroy)
static int hash(const Object *self)
ident interface
The interface of the Class.
Pointer * initWithPointer(Pointer *self, ident pointer, Consumer destroy)
Initializes this Pointer.
◆ initWithBytes()
| static Pointer * initWithBytes |
( |
Pointer * |
self, |
|
|
const uint8_t * |
bytes, |
|
|
size_t |
length |
|
) |
| |
|
static |
Definition at line 87 of file Pointer.c.
87 {
88
90 if (self) {
91 if (bytes) {
92 self->
pointer = calloc(1, length);
94
95 memcpy(self->
pointer, bytes, length);
97 }
98 }
99
100 return self;
101}
static Array * init(Array *self)
ident pointer
The backing pointer.
Consumer destroy
An optional destructor that, if set, is called on dealloc.
◆ initWithPointer()
Definition at line 107 of file Pointer.c.
107 {
108
110 if (self) {
113 }
114
115 return self;
116}
◆ isEqual()
| static bool isEqual |
( |
const Object * |
self, |
|
|
const Object * |
other |
|
) |
| |
|
static |
◆ ptr()
Definition at line 157 of file Pointer.c.
157 {
159}
#define alloc(type)
Allocate and initialize and instance of type.