objc

runtime.h
Go to the documentation of this file.
1 
10 #pragma once
11 #include <stdbool.h>
12 #include <stddef.h>
13 #include <stdint.h>
14 
18 typedef struct objc_object *id;
19 
23 typedef const struct objc_selector *SEL;
24 
28 typedef struct objc_class *Class;
29 
33 typedef id (*IMP)(id, SEL, ...);
34 
38 typedef struct objc_method *Method;
39 
43 typedef struct objc_protocol objc_protocol_t;
44 
48 #define nil ((id)0)
49 
53 #define Nil ((Class)0)
54 
55 // Booleans
56 
60 typedef bool BOOL;
61 
65 #define YES true
66 
70 #define NO false
71 
80 #if __has_attribute(objc_root_class)
81 #define OBJC_ROOT_CLASS __attribute__((objc_root_class))
82 #else
83 #define OBJC_ROOT_CLASS
84 #endif
85 
94 #if __has_attribute(unused)
95 #define OBJC_UNUSED __attribute__((unused))
96 #else
97 #define OBJC_UNUSED
98 #endif
99 
109 #define OBJC_REQUIRES_NIL_TERMINATION
110 
117 Class objc_lookupClass(const char *name);
118 
126 const char *class_getName(Class cls);
127 
135 const char *object_getClassName(id obj);
136 
143 Class object_getClass(id object);
144 
151 void object_setClass(id object, Class cls);
152 
161 BOOL object_respondsToSelector(id object, SEL sel);
162 
170 
178 
187 BOOL object_isKindOfClass(id object, Class cls);
188 
196 size_t class_getInstanceSize(Class cls);
197 
206 
215 BOOL class_respondsToSelector(Class cls, SEL sel);
216 
223 const char *sel_getName(SEL sel);
224 
232 const char *proto_getName(objc_protocol_t *protocol);
233 
242  objc_protocol_t *otherProtocol);
243 
252 BOOL class_conformsTo(Class cls, objc_protocol_t *otherProtocol);
size_t class_getInstanceSize(Class cls)
Returns the size of an instance of a class.
BOOL class_metaclassRespondsToSelector(Class cls, SEL sel)
Checks if a class object responds to a selector.
BOOL proto_conformsTo(objc_protocol_t *protocol, objc_protocol_t *otherProtocol)
Checks if a protocol conforms to another protocol.
Class object_getSuperclass(id obj)
Returns the superclass of an object.
id(* IMP)(id, SEL,...)
A pointer to a method implementation.
Definition: runtime.h:33
const char * object_getClassName(id obj)
Returns the name of an object&#39;s class.
BOOL object_isKindOfClass(id object, Class cls)
Checks if an instance class matches, or subclass of another class.
void object_setClass(id object, Class cls)
Sets the class of an object.
BOOL object_respondsToSelector(id object, SEL sel)
Checks if an instance&#39;s class responds to a selector.
struct objc_protocol objc_protocol_t
An instance of a protocol.
Definition: runtime.h:43
Class class_getSuperclass(Class cls)
Returns the superclass of a class.
Class object_getClass(id object)
Returns the class of an object.
BOOL class_respondsToSelector(Class cls, SEL sel)
Checks if an instance of a class responds to a selector.
Class objc_lookupClass(const char *name)
Looks up a class by name.
const char * proto_getName(objc_protocol_t *protocol)
Returns the name of a protocol.
const char * sel_getName(SEL sel)
Returns the name of a selector.
bool BOOL
A Boolean value.
Definition: runtime.h:60
struct objc_method * Method
A pointer to a method.
Definition: runtime.h:38
BOOL class_conformsTo(Class cls, objc_protocol_t *otherProtocol)
Checks if a class conforms to a protocol.
struct objc_class * Class
A pointer to a class definition.
Definition: runtime.h:28
const struct objc_selector * SEL
A pointer to a method selector.
Definition: runtime.h:23
const char * class_getName(Class cls)
Returns the name of a class.
struct objc_object * id
A pointer to an instance of a class.
Definition: runtime.h:18