#include <assert.h>
#include "Error.h"
#include "Hash.h"
#include "MutableString.h"
Go to the source code of this file.
◆ _Class
◆ _Error()
Definition at line 166 of file Error.c.
166 {
169
172 .name = "Error",
174 .instanceSize =
sizeof(
Error),
175 .interfaceOffset = offsetof(
Error, interface),
176 .interfaceSize = sizeof(ErrorInterface),
178 });
179 });
180
181 return clazz;
182}
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.
Encapsulation for error conditions.
Class * _Object(void)
The Object archetype.
◆ copy()
- See also
- Object::copy(const Object *)
Definition at line 37 of file Error.c.
37 {
38
41
43}
#define alloc(type)
Allocate and initialize and instance of type.
Error * initWithDomain(Error *self, String *domain, int code, String *message)
Initializes an Error with the given details.
Object is the root Class of The Objectively Class hierarchy.
◆ dealloc()
static void dealloc |
( |
Object * |
self | ) |
|
|
static |
- See also
- Object::dealloc(Object *)
Definition at line 48 of file Error.c.
48 {
49
51
54
56}
ident release(ident obj)
Atomically decrement the given Object's reference count. If the resulting reference count is 0,...
#define super(type, obj, method,...)
void dealloc(Object *self)
Frees all resources held by this Object.
◆ description()
- See also
- Object::description(const Object *)
Definition at line 61 of file Error.c.
61 {
62
64
66
67 $(desc,
appendFormat,
"%ls: %d", this->domain->chars, this->code);
68
69 if (this->message) {
71 }
72
74}
Condition * init(Condition *self)
Initializes this Condition.
void appendFormat(MutableString *self, const char *fmt,...)
Appends the specified formatted string.
◆ hash()
static int hash |
( |
const Object * |
self | ) |
|
|
static |
- See also
- Object::hash(const Object *)
Definition at line 79 of file Error.c.
79 {
80
82
84
88
90}
int HashForInteger(int hash, const long integer)
Accumulates the hash value of integer into hash.
int HashForObject(int hash, const ident obj)
Accumulates the hash value of object into hash.
#define HASH_SEED
The hash seed value.
int hash(const Object *self)
◆ initialize()
static void initialize |
( |
Class * |
clazz | ) |
|
|
static |
- See also
- Class::initialize(Class *)
Definition at line 151 of file Error.c.
151 {
152
158
160}
ident interface
The interface of the Class.
Object * copy(const Object *self)
Creates a shallow copy of this Object.
String * description(const Object *self)
_Bool isEqual(const Object *self, const Object *other)
Tests equality of the other Object.
◆ initWithDomain()
Definition at line 128 of file Error.c.
128 {
129
130 assert(domain);
131
133 if (self) {
134
137
138 if (message) {
140 }
141 }
142
143 return self;
144}
ident retain(ident obj)
Atomically increment the given Object's reference count.
String * message
The error message.
String * domain
The error domain.
◆ isEqual()
static _Bool isEqual |
( |
const Object * |
self, |
|
|
const Object * |
other |
|
) |
| |
|
static |
- See also
- Object::isEqual(const Object *, const Object *)
Definition at line 95 of file Error.c.
95 {
96
98 return true;
99 }
100
102
105
106 if (this->code == that->
code) {
107
109
110 if (this->message) {
112 }
113
115 }
116 }
117 }
118
119 return false;
120}
Class * clazz
Every instance of Object begins with a pointer to its Class.