32#define _Class _IndexPath
67 for (
size_t i = 0; i < this->length; i++) {
69 if (i < this->length - 1) {
87 for (
size_t i = 0; i < this->length; i++) {
108 if (this->length == that->
length) {
109 return memcmp(this->indexes, that->
indexes, this->length *
sizeof(
size_t)) == 0;
116#pragma mark - IndexPath
124 assert(position < self->length);
126 return self->
indexes[position];
149 self->
indexes = calloc(
sizeof(
size_t), length);
152 memcpy(self->
indexes, indexes,
sizeof(
size_t) * length);
158#pragma mark - Class lifecycle
189 .interfaceOffset = offsetof(
IndexPath, interface),
190 .interfaceSize =
sizeof(IndexPathInterface),
static Array * init(Array *self)
Class * _initialize(const ClassDef *def)
Initializes the given Class.
#define alloc(type)
Allocate and initialize and instance of type.
#define super(type, obj, method,...)
int HashForInteger(int hash, const long integer)
Accumulates the hash value of integer into hash.
Utilities for calculating hash values.
#define HASH_SEED
The hash seed value.
static IndexPath * initWithIndexes(IndexPath *self, size_t *indexes, size_t length)
static bool isEqual(const Object *self, const Object *other)
static IndexPath * initWithIndex(IndexPath *self, size_t index)
static size_t indexAtPosition(const IndexPath *self, size_t position)
static String * description(const Object *self)
static void dealloc(Object *self)
static Object * copy(const Object *self)
static void initialize(Class *clazz)
static int hash(const Object *self)
Index paths represent the path to an element or node within a tree or graph structure.
static bool isKindOfClass(const Object *self, const Class *clazz)
String * str(const char *fmt,...)
static void appendCharacters(String *self, const char *chars)
static void appendFormat(String *self, const char *fmt,...)
#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.
Index paths represent the path to an element or node within a tree or graph structure.
IndexPath * initWithIndexes(IndexPath *self, size_t *indexes, size_t length)
Initializes this IndexPath with the specified indexes and length.
size_t * indexes
The indexes.
size_t length
The length of indexes.
Object is the root Class of The Objectively Class hierarchy.
Object * copy(const Object *self)
Creates a shallow copy of this Object.
int hash(const Object *self)
void dealloc(Object *self)
Frees all resources held by this Object.