ObjFW
|
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Classes | |
struct | objc_super |
A struct representing a call to super. More... | |
Macros | |
#define | Nil (Class _Null_unspecified)0 |
A value representing no class. | |
#define | nil (id _Null_unspecified)0 |
A value representing no object. | |
#define | YES true |
An Objective-C boolean representing true. | |
#define | NO false |
An Objective-C boolean representing false. | |
Typedefs | |
typedef const struct objc_selector * | SEL |
A selector. | |
typedef const struct objc_method * | Method |
A method. | |
typedef const struct objc_protocol * | Protocol |
A protocol. | |
typedef const struct objc_ivar * | Ivar |
An instance variable. | |
typedef const struct objc_property * | objc_property_t |
A property. | |
typedef bool | BOOL |
An Objective-C boolean. Either YES or NO. | |
typedef id(* | IMP) (id object, SEL selector,...) |
A method implementation. | |
typedef void(* | objc_uncaught_exception_handler) (id exception) |
A handler for uncaught exceptions. | |
typedef void(* | objc_enumeration_mutation_handler) (id object) |
A handler for mutation during enumeration. | |
Enumerations | |
enum | objc_associationPolicy { OBJC_ASSOCIATION_ASSIGN = 0 , OBJC_ASSOCIATION_RETAIN_NONATOMIC = 1 , OBJC_ASSOCIATION_RETAIN = OBJC_ASSOCIATION_RETAIN_NONATOMIC | 0x300 , OBJC_ASSOCIATION_COPY_NONATOMIC = 3 , OBJC_ASSOCIATION_COPY = OBJC_ASSOCIATION_COPY_NONATOMIC | 0x300 } |
A policy for object association, see objc_setAssociatedObject. More... | |
Functions | |
SEL | sel_registerName (const char *name) |
Registers a selector with the specified name with the runtime. | |
const char * | sel_getName (SEL selector) |
Returns the name of the specified selector. | |
bool | sel_isEqual (SEL selector1, SEL selector2) |
Checks two selectors for equality. | |
Class | objc_allocateClassPair (Class superclass, const char *name, size_t extraBytes) |
Allocates a new class and its metaclass. | |
void | objc_registerClassPair (Class class_) |
Registers an already allocated class pair. | |
unsigned int | objc_getClassList (Class *buffer, unsigned int count) |
Gets the list of all classes known to the runtime. | |
Class * | objc_copyClassList (unsigned int *length) |
Copies the list of all classes known to the runtime. | |
bool | class_isMetaClass (Class class_) |
Returns whether the specified class is a metaclass. | |
const char * | class_getName (Class class_) |
Returns the name of the specified class. | |
Class | class_getSuperclass (Class class_) |
Returns the superclass of the specified class. | |
unsigned long | class_getInstanceSize (Class class_) |
Returns the instance size of the specified class. | |
bool | class_respondsToSelector (Class class_, SEL selector) |
Returns whether the specified class responds to the specified selector. | |
bool | class_conformsToProtocol (Class class_, Protocol *protocol) |
Returns whether the specified class conforms to the specified protocol. | |
IMP | class_getMethodImplementation (Class class_, SEL selector) |
Returns the class's method implementation for the specified selector. | |
IMP | class_getMethodImplementation_stret (Class class_, SEL selector) |
Returns the class's method implementation for the specified selector. | |
Method | class_getInstanceMethod (Class class_, SEL selector) |
Returns the class's instance method for the specified selector. | |
bool | class_addMethod (Class class_, SEL selector, IMP implementation, const char *typeEncoding) |
Adds the specified method to the class. | |
IMP | class_replaceMethod (Class class_, SEL selector, IMP implementation, const char *typeEncoding) |
Replaces or adds the specified method of the class. | |
Class | object_getClass (id object) |
Returns the object's class. | |
Class | object_setClass (id object, Class class_) |
Sets the object's class. | |
const char * | object_getClassName (id object) |
Returns the object's class name. | |
const char * | protocol_getName (Protocol *protocol) |
Returns the name of the specified protocol. | |
bool | protocol_isEqual (Protocol *protocol1, Protocol *protocol2) |
Returns whether two protocols are equal. | |
bool | protocol_conformsToProtocol (Protocol *protocol1, Protocol *protocol2) |
Returns whether the first protocol conforms to the second protocol. | |
Method * | class_copyMethodList (Class class_, unsigned int *outCount) |
Copies the method list of the specified class. | |
SEL | method_getName (Method method) |
Returns the name of the specified method. | |
const char * | method_getTypeEncoding (Method method) |
Returns the type encoding of the specified method. | |
Ivar * | class_copyIvarList (Class class_, unsigned int *outCount) |
Copies the instance variable list of the specified class. | |
const char * | ivar_getName (Ivar ivar) |
Returns the name of the specified instance variable. | |
const char * | ivar_getTypeEncoding (Ivar ivar) |
Returns the type encoding of the specified instance variable. | |
ptrdiff_t | ivar_getOffset (Ivar ivar) |
Returns the offset of the specified instance variable. | |
objc_property_t * | class_copyPropertyList (Class class_, unsigned int *outCount) |
Copies the property list of the specified class. | |
const char * | property_getName (objc_property_t property) |
Returns the name of the specified property. | |
char * | property_copyAttributeValue (objc_property_t property, const char *name) |
Copies the specified attribute value. | |
void | objc_deinit (void) |
Deinitializes the Objective-C runtime. | |
objc_uncaught_exception_handler | objc_setUncaughtExceptionHandler (objc_uncaught_exception_handler handler) |
Sets the handler for uncaught exceptions. | |
void | objc_setForwardHandler (IMP forward, IMP stretForward) |
Sets the forwarding handler for unimplemented methods. | |
void | objc_setEnumerationMutationHandler (objc_enumeration_mutation_handler handler) |
Sets the handler for mutations during enumeration. | |
id | objc_constructInstance (Class class_, void *bytes) |
Constructs an instance of the specified class in the specified array of bytes. | |
void * | objc_destructInstance (id object) |
Destructs the specified object. | |
void *_Null_unspecified | objc_autoreleasePoolPush (void) |
Creates a new autorelease pool and puts it on top of the stack of autorelease pools. | |
void | objc_autoreleasePoolPop (void *_Null_unspecified pool) |
Drains the specified autorelease pool and all pools on top of it and removes it from the stack of autorelease pools. | |
id | _objc_rootAutorelease (id object) |
Adds the specified object to the topmost autorelease pool. | |
void | objc_setTaggedPointerSecret (uintptr_t secret) |
Sets the tagged pointer secret. | |
int | objc_registerTaggedPointerClass (Class class_) |
Registers a class for tagged pointers. | |
bool | object_isTaggedPointer (id object) |
Returns whether the specified object is a tagged pointer. | |
uintptr_t | object_getTaggedPointerValue (id object) |
Returns the value of the specified tagged pointer. | |
id | objc_createTaggedPointer (int class_, uintptr_t value) |
Creates a new tagged pointer. | |
void | objc_setAssociatedObject (id object, const void *key, id value, objc_associationPolicy policy) |
Sets an associated object on the specified object for the specified key. | |
id | objc_getAssociatedObject (id object, const void *key) |
Returns the associated object on the specified object for the specified key. | |
void | objc_removeAssociatedObjects (id object) |
Removes all associated objects for the specified object. | |
#define NO false |
An Objective-C boolean representing false.
#define YES true |
An Objective-C boolean representing true.
typedef bool BOOL |
typedef id(* IMP) (id object, SEL selector,...) |
A method implementation.
object | The messaged object |
selector | The selector sent |
typedef const struct objc_method* Method |
A method.
A method consists of a selector with a type encoding and an implementation.
typedef void(* objc_enumeration_mutation_handler) (id object) |
A handler for mutation during enumeration.
object | The object that was mutated during enumeration |
typedef void(* objc_uncaught_exception_handler) (id exception) |
A handler for uncaught exceptions.
exception | The exception which was not caught. |
typedef const struct objc_selector* SEL |
A selector.
A selector is the name of a method including the colons and an optional type encoding.
A policy for object association, see objc_setAssociatedObject.
|
extern |
Adds the specified object to the topmost autorelease pool.
This is only to be used to implement the autorelease
method in a root class.
object | The object to add to the topmost autorelease pool |
|
extern |
Adds the specified method to the class.
class_ | The class to which to add the method |
selector | The selector for the method to add |
implementation | The implementation of the method to add |
typeEncoding | The type encoding of the method to add |
|
extern |
Returns whether the specified class conforms to the specified protocol.
class_ | The class which should be examined |
protocol | The protocol for which conformance should be checked |
|
extern |
Copies the instance variable list of the specified class.
class_ | The class whose instance variable list should be copied |
outCount | An optional pointer to an unsigned int that should be set to the number of instance variables returned |
NULL
. You need to call free()
on it when done.
|
extern |
Copies the method list of the specified class.
class_ | The class whose method list should be copied |
outCount | An optional pointer to an unsigned int that should be set to the number of methods returned |
NULL
. You need to call free()
on it when done.
|
extern |
Copies the property list of the specified class.
class_ | The class whose property list should be copied |
outCount | An optional pointer to an unsigned int that should be set to the number of properties returned |
NULL
. You need to call free()
on it when done. Returns the class's instance method for the specified selector.
class_ | The class whose instance method should be returned |
selector | The selector of the instance method to return |
|
extern |
Returns the instance size of the specified class.
class_ | The class whose instance size should be returned |
Returns the class's method implementation for the specified selector.
class_ | The class whose method implementation should be returned |
selector | The selector for the method whose implementation should be returned |
Returns the class's method implementation for the specified selector.
class_ | The class whose method implementation should be returned |
selector | The selector for the method whose implementation should be returned |
|
extern |
Returns the name of the specified class.
class_ | The class whose name should be returned |
|
extern |
Returns the superclass of the specified class.
class_ | The class whose superclass should be returned |
|
extern |
Returns whether the specified class is a metaclass.
class_ | The class which should be examined |
|
extern |
Replaces or adds the specified method of the class.
class_ | The class to which to replace the method |
selector | The selector for the method to replace |
implementation | The implementation of the method to replace |
typeEncoding | The type encoding of the method to replace. Only used if the method does not exist yet. |
|
extern |
Returns whether the specified class responds to the specified selector.
class_ | The class which should be examined |
selector | The selector which should be checked |
|
extern |
Returns the name of the specified instance variable.
ivar | The instance variable whose name should be returned |
|
extern |
Returns the offset of the specified instance variable.
ivar | The instance variable whose offset should be returned |
|
extern |
Returns the type encoding of the specified instance variable.
ivar | The instance variable whose type encoding should be returned |
Returns the name of the specified method.
method | The method whose name should be returned |
|
extern |
Returns the type encoding of the specified method.
method | The method whose type encoding should be returned |
|
extern |
Allocates a new class and its metaclass.
superclass | The superclass for the new class |
name | The name for the new class |
extraBytes | Extra bytes to add to the instance size |
|
extern |
Drains the specified autorelease pool and all pools on top of it and removes it from the stack of autorelease pools.
pool | The pool which should be drained together with all pools on top of it |
|
extern |
Creates a new autorelease pool and puts it on top of the stack of autorelease pools.
|
extern |
Constructs an instance of the specified class in the specified array of bytes.
class_ | The class of which to construct an instance |
bytes | An array of bytes of at least the length of the instance size. Must be properly aligned for the class. |
|
extern |
Copies the list of all classes known to the runtime.
This is like objc_getClassList, but allocates a buffer large enough for all classes.
length | An optional pointer to an unsigned int that will be set to the number of classes returned |
Nil
. You need to call free()
on it when done.
|
extern |
Creates a new tagged pointer.
class_ | The tag ID for the tagged pointer class to use |
value | The value the tagged pointer should have |
nil
if it could not be created
|
extern |
Deinitializes the Objective-C runtime.
This frees all data structures used by the runtime, after which Objective-C can no longer be used inside the current process. This is only useful for debugging and tests.
|
extern |
Destructs the specified object.
object | The object to destruct |
|
extern |
Returns the associated object on the specified object for the specified key.
object | The object on which to get the associated object |
key | The key of the association |
|
extern |
Gets the list of all classes known to the runtime.
buffer | An array of Class to write to. If the buffer does not have enough space, the result is truncated. |
count | The number of classes for which there is space in buffer |
|
extern |
Registers an already allocated class pair.
class_ | The class pair to register |
|
extern |
Registers a class for tagged pointers.
class_ | The class to register for tagged pointers |
|
extern |
Removes all associated objects for the specified object.
object | The object on which to remove all associated objects |
|
extern |
Sets an associated object on the specified object for the specified key.
object | The object on which to set an associated object |
key | A unique pointer to use as the key for the association |
value | The object to associate with the specified object |
policy | The association policy, see objc_associationPolicy |
|
extern |
Sets the handler for mutations during enumeration.
handler | The handler for mutations during enumeration |
Sets the forwarding handler for unimplemented methods.
forward | The forwarding handler for regular methods |
stretForward | The forwarding handler for methods using the struct return ABI |
|
extern |
Sets the tagged pointer secret.
secret | A secret, random value that will be used to XOR all tagged pointers with |
|
extern |
Sets the handler for uncaught exceptions.
handler | The new handler for uncaught exceptions |
|
extern |
Returns the object's class.
object | The object whose class should be returned |
|
extern |
Returns the object's class name.
object | The object whose class name should be returned |
|
extern |
Returns the value of the specified tagged pointer.
object | The object whose tagged pointer value should be returned |
|
extern |
Returns whether the specified object is a tagged pointer.
object | The object to inspect |
|
extern |
Sets the object's class.
This can be used to swizzle an object's class.
object | The object whose class should be set |
class_ | The new class for the object |
|
extern |
Copies the specified attribute value.
property | The property whose attribute value should be copied |
name | The name of the attribute value to copy |
free()
on it when done.
|
extern |
Returns the name of the specified property.
property | The property whose name should be returned |
|
extern |
Returns whether the first protocol conforms to the second protocol.
protocol1 | The first protocol |
protocol2 | The second protocol |
|
extern |
Returns the name of the specified protocol.
protocol | The protocol whose name should be returned |
|
extern |
Returns whether two protocols are equal.
protocol1 | The first protocol |
protocol2 | The second protocol |
|
extern |
Returns the name of the specified selector.
selector | The selector whose name should be returned |
Checks two selectors for equality.
Selectors are considered equal if they have the same name - any type encoding is ignored.
selector1 | The first selector |
selector2 | The second selector |
|
extern |
Registers a selector with the specified name with the runtime.
name | The name for the selector to register |