Top Description Inners Fields Constructors Methods
org.lwjgl.system.macosx

public Class ObjCRuntime

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.*, org.lwjgl.system.*

Native bindings to the Objective-C Runtime.

Due to the nature of the objc_msgSend* functions, they are not directly exposed in this binding. Advanced users with good understanding of the complexity involved with using these functions, may access them via the getLibrary method:


SharedLibrary objc = ObjCRuntime.getLibrary();
long objc_msgSend = objc.getFunctionAddress("objc_msgSend");

// example usage
long NSThread = objc_getClass("NSThread");
long currentThread = invokePPP(NSThread, sel_getUid("currentThread"), objc_msgSend);

The safe way to use objc_msgSend in C code is to cast it to an appropriate function pointer. This is exactly what the JNI class does. If a particular function signature is not available, LibFFI may be used to invoke it.

The functions not exposed are:

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ObjCRuntime.Functions

Contains the function pointers loaded from the objc SharedLibrary.

Field Summary

Modifier and TypeField and Description
public static final char
_C_ARY_B

Types.

public static final char
_C_ARY_E

Types.

public static final char
_C_ATOM

Types.

public static final char
_C_BFLD

Types.

public static final char
_C_BOOL

Types.

public static final char
_C_CHARPTR

Types.

public static final char
_C_CHR

Types.

public static final char
_C_CLASS

Types.

public static final char
_C_CONST

Types.

public static final char
_C_DBL

Types.

public static final char
_C_FLT

Types.

public static final char
_C_ID

Types.

public static final char
_C_INT

Types.

public static final char
_C_LNG

Types.

public static final char
_C_LNG_LNG

Types.

public static final char
_C_PTR

Types.

public static final char
_C_SEL

Types.

public static final char
_C_SHT

Types.

public static final char
public static final char
public static final char
_C_UCHR

Types.

public static final char
_C_UINT

Types.

public static final char
_C_ULNG

Types.

public static final char
public static final char
_C_UNDEF

Types.

public static final char
_C_UNION_B

Types.

public static final char
_C_UNION_E

Types.

public static final char
_C_USHT

Types.

public static final char
_C_VECTOR

Types.

public static final char
_C_VOID

Types.

public static final long
nil

Nil value.

public static final byte
NO

Boolean values.

private static final SharedLibrary
public static final int
OBJC_ASSOCIATION_ASSIGN

Policies related to associative references.

public static final int
OBJC_ASSOCIATION_COPY

Policies related to associative references.

public static final int
OBJC_ASSOCIATION_COPY_NONATOMIC

Policies related to associative references.

public static final int
OBJC_ASSOCIATION_RETAIN

Policies related to associative references.

public static final int
OBJC_ASSOCIATION_RETAIN_NONATOMIC

Policies related to associative references.

public static final byte
YES

Boolean values.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

YES if the instance variable was added successfully, otherwise NO (for example, the class already contains an instance variable with that name)
class_addIvar
(long cls, ByteBuffer name, long size, byte alignment, ByteBuffer types)

Adds a new instance variable to a class.

public static boolean

Returns:

YES if the instance variable was added successfully, otherwise NO (for example, the class already contains an instance variable with that name)
class_addIvar
(long cls, CharSequence name, long size, byte alignment, CharSequence types)

Adds a new instance variable to a class.

public static boolean

Returns:

YES if the method was added successfully, otherwise NO (for example, the class already contains a method implementation with that name)
class_addMethod
(long
the class to which to add a method
cls
,
long
a selector that specifies the name of the method being added
name
,
long
a function which is the implementation of the new method. The function must take at least two arguments – self and _cmd.
imp
,
ByteBuffer
an array of characters that describe the types of the arguments to the method. For possible values, see Objective-C Runtime Programming Guide > Type Encodings in Objective-C Runtime Programming Guide. Since the function must take at least two arguments – self and _cmd, the second and third characters must be “@:” (the first character is the return type).
types
)

Adds a new method to a class with a given name and implementation.

public static boolean

Returns:

YES if the method was added successfully, otherwise NO (for example, the class already contains a method implementation with that name)
class_addMethod
(long
the class to which to add a method
cls
,
long
a selector that specifies the name of the method being added
name
,
long
a function which is the implementation of the new method. The function must take at least two arguments – self and _cmd.
imp
,
CharSequence
an array of characters that describe the types of the arguments to the method. For possible values, see Objective-C Runtime Programming Guide > Type Encodings in Objective-C Runtime Programming Guide. Since the function must take at least two arguments – self and _cmd, the second and third characters must be “@:” (the first character is the return type).
types
)

Adds a new method to a class with a given name and implementation.

public static boolean

Returns:

YES if the property was added successfully; otherwise NO (for example, this function returns NO if the class already has that property)
class_addProperty
(long
the class to modify
cls
,
ByteBuffer
the name of the property
name
,
ObjCPropertyAttribute.Buffer
an array of property attributes
attributes
)

Adds a property to a class.

public static boolean

Returns:

YES if the property was added successfully; otherwise NO (for example, this function returns NO if the class already has that property)
class_addProperty
(long
the class to modify
cls
,
CharSequence
the name of the property
name
,
ObjCPropertyAttribute.Buffer
an array of property attributes
attributes
)

Adds a property to a class.

public static boolean

Returns:

YES if the protocol was added successfully, otherwise NO (for example, the class already conforms to that protocol)
class_addProtocol
(long
the class to modify
cls
,
long
the protocol to add to cls
protocol
)

Adds a protocol to a class.

public static boolean

Returns:

YES if cls conforms to protocol, otherwise NO
class_conformsToProtocol
(long
the class you want to inspect
cls
,
long
a protocol
protocol
)

Returns a Boolean value that indicates whether a class conforms to a given protocol.

public static PointerBuffer

Returns:

an array of pointers of type Ivar describing the instance variables declared by the class. Any instance variables declared by superclasses are not included. The array contains *outCount pointers followed by a NULL terminator. You must free the array with free().

If the class declares no instance variables, or cls is Nil, NULL is returned and *outCount is 0.

class_copyIvarList
(long
the class to inspect
cls
)

Describes the instance variables declared by a class.

public static PointerBuffer

Returns:

an array of pointers of type Method describing the instance methods implemented by the class—any instance methods implemented by superclasses are not included. The array contains *outCount pointers followed by a NULL terminator. You must free the array with free().

If cls implements no instance methods, or cls is Nil, returns NULL and *outCount is 0.

class_copyMethodList
(long
the class you want to inspect
cls
)

Describes the instance methods implemented by a class.

public static PointerBuffer

Returns:

an array of pointers of type objc_property_t describing the properties declared by the class. Any properties declared by superclasses are not included. The array contains *outCount pointers followed by a NULL terminator. You must free the array with free().

If cls declares no properties, or cls is Nil, returns NULL and *outCount is 0.

class_copyPropertyList
(long
the class you want to inspect
cls
)

Describes the properties declared by a class.

public static PointerBuffer

Returns:

an array of pointers of type Protocol* describing the protocols adopted by the class. Any protocols adopted by superclasses or other protocols are not included. The array contains *outCount pointers followed by a NULL terminator. You must free the array with free().

If cls adopts no protocols, or cls is Nil, returns NULL and *outCount is 0.

class_copyProtocolList
(long
the class you want to inspect
cls
)

Describes the protocols adopted by a class.

public static long

Returns:

an instance of the class cls
class_createInstance
(long
the class that you want to allocate an instance of
cls
,
long
an integer indicating the number of extra bytes to allocate. The additional bytes can be used to store additional instance variables beyond those defined in the class definition.
extraBytes
)

Creates an instance of a class, allocating memory for the class in the default malloc memory zone.

public static long

Returns:

a pointer to the Method data structure that corresponds to the implementation of the selector specified by name for the class specified by cls, or NULL if the specified class or its superclasses do not contain a class method with the specified selector.
class_getClassMethod
(long
a pointer to a class definition. Pass the class that contains the method you want to retrieve
cls
,
long
a pointer of type SEL. Pass the selector of the method you want to retrieve
name
)

Returns a pointer to the data structure describing a given class method for a given class.

public static long

Returns:

a pointer to an Ivar data structure containing information about the class variable specified by name
class_getClassVariable
(long
the class definition whose class variable you wish to obtain
cls
,
ByteBuffer
the name of the class variable definition to obtain
name
)

Returns the Ivar for a specified class variable of a given class.

public static long

Returns:

a pointer to an Ivar data structure containing information about the class variable specified by name
class_getClassVariable
(long
the class definition whose class variable you wish to obtain
cls
,
CharSequence
the name of the class variable definition to obtain
name
)

Returns the Ivar for a specified class variable of a given class.

public static String

Returns:

a C string representing the name of the library containing the cls class.
class_getImageName
(long
the class you are inquiring about
cls
)

Returns the name of the dynamic library a class originated from.

public static long

Returns:

the method that corresponds to the implementation of the selector specified by aSelector for the class specified by cls, or NULL if the specified class or its superclasses do not contain an instance method with the specified selector.
class_getInstanceMethod
(long
the class you want to inspect
cls
,
long
the selector of the method you want to retrieve
name
)

Returns a specified instance method for a given class.

public static long

Returns:

the size in bytes of instances of the class cls, or 0 if cls is Nil
class_getInstanceSize
(long
a class object
cls
)

Returns the size of instances of a class.

public static long

Returns:

a pointer to an Ivar data structure containing information about the instance variable specified by name
class_getInstanceVariable
(long
the class whose instance variable you wish to obtain
cls
,
ByteBuffer
the name of the instance variable definition to obtain
name
)

Returns the Ivar for a specified instance variable of a given class.

public static long

Returns:

a pointer to an Ivar data structure containing information about the instance variable specified by name
class_getInstanceVariable
(long
the class whose instance variable you wish to obtain
cls
,
CharSequence
the name of the instance variable definition to obtain
name
)

Returns the Ivar for a specified instance variable of a given class.

public static String

Returns:

a description of the Ivar layout for cls
class_getIvarLayout
(long
the class to inspect
cls
)

Returns a description of the Ivar layout for a given class.

public static long

Returns:

the function pointer that would be called if [object name] were called with an instance of the class, or NULL if cls is Nil
class_getMethodImplementation
(long
the class you want to inspect
cls
,
long
a selector
name
)

Returns the function pointer that would be called if a particular message were sent to an instance of a class.

public static String

Returns:

the name of the class, or the empty string if cls is Nil
class_getName
(long
a class object
cls
)

Returns the name of a class.

public static long

Returns:

a pointer of type objc_property_t describing the property, or NULL if the class does not declare a property with that name, or NULL if cls is Nil.
class_getProperty
(long
the class you want to inspect
cls
,
ByteBuffer
a C string. Pass the name of the instance variable whose value you wish to modify.
name
)

Returns a property with a given name of a given class.

public static long

Returns:

a pointer of type objc_property_t describing the property, or NULL if the class does not declare a property with that name, or NULL if cls is Nil.
class_getProperty
(long
the class you want to inspect
cls
,
CharSequence
a C string. Pass the name of the instance variable whose value you wish to modify.
name
)

Returns a property with a given name of a given class.

public static long

Returns:

the superclass of the class, or Nil if cls is a root class, or Nil if cls is Nil
class_getSuperclass
(long
a class object
cls
)

Returns the superclass of a class.

public static int

Returns:

an integer indicating the version number of the class definition
class_getVersion
(long
a pointer to an Class data structure. Pass the class definition for which you wish to obtain the version
cls
)

Returns the version number of a class definition.

public static String

Returns:

a description of the layout of the weak Ivars for cls
class_getWeakIvarLayout
(long
the class to inspect
cls
)

Returns a description of the layout of weak Ivars for a given class.

public static boolean

Returns:

YES if cls is a metaclass, NO if cls is a non-meta class, NO if cls is Nil
class_isMetaClass
(long
a class object
cls
)

Returns a Boolean value that indicates whether a class object is a metaclass.

public static long

Returns:

the previous implementation of the method identified by name for the class identified by cls
class_replaceMethod
(long
the class you want to modify
cls
,
long
a selector that identifies the method whose implementation you want to replace
name
,
long
the new implementation for the method identified by name for the class identified by cls
imp
,
ByteBuffer
an array of characters that describe the types of the arguments to the method. For possible values, see Objective-C Runtime Programming Guide > Type Encodings in Objective-C Runtime Programming Guide. Since the function must take at least two arguments – self and _cmd, the second and third characters must be “@:” (the first character is the return type).
types
)

Replaces the implementation of a method for a given class.

public static long

Returns:

the previous implementation of the method identified by name for the class identified by cls
class_replaceMethod
(long
the class you want to modify
cls
,
long
a selector that identifies the method whose implementation you want to replace
name
,
long
the new implementation for the method identified by name for the class identified by cls
imp
,
CharSequence
an array of characters that describe the types of the arguments to the method. For possible values, see Objective-C Runtime Programming Guide > Type Encodings in Objective-C Runtime Programming Guide. Since the function must take at least two arguments – self and _cmd, the second and third characters must be “@:” (the first character is the return type).
types
)

Replaces the implementation of a method for a given class.

public static void
class_replaceProperty(long
the class to modify
cls
,
ByteBuffer
the name of the property
name
,
ObjCPropertyAttribute.Buffer
an array of property attributes
attributes
)

Replaces a property of a class.

public static void
class_replaceProperty(long
the class to modify
cls
,
CharSequence
the name of the property
name
,
ObjCPropertyAttribute.Buffer
an array of property attributes
attributes
)

Replaces a property of a class.

public static boolean

Returns:

YES if instances of the class respond to the selector, otherwise NO
class_respondsToSelector
(long
the class you want to inspect
cls
,
long
a selector
name
)

Returns a Boolean value that indicates whether instances of a class respond to a particular selector.

public static void
class_setIvarLayout(long
the class to modify
cls
,
ByteBuffer
the layout of the Ivars for cls
layout
)

Sets the Ivar layout for a given class.

public static void
class_setIvarLayout(long
the class to modify
cls
,
CharSequence
the layout of the Ivars for cls
layout
)

Sets the Ivar layout for a given class.

public static void
class_setVersion(long
a pointer to an Class data structure. Pass the class definition for which you wish to set the version
cls
,
int
the new version number of the class definition
version
)

Sets the version number of a class definition.

public static void
class_setWeakIvarLayout(long
the class to modify
cls
,
ByteBuffer
the layout of the weak Ivars for cls
layout
)

Sets the layout for weak Ivars for a given class.

public static void
class_setWeakIvarLayout(long
the class to modify
cls
,
CharSequence
the layout of the weak Ivars for cls
layout
)

Sets the layout for weak Ivars for a given class.

public static SharedLibrary
getLibrary()

Returns the objc SharedLibrary.

public static long

Returns:

the block called by anImp
imp_getBlock
(long
the IMP that calls this block
anImp
)

Returns the block associated with an IMP that was created using imp_implementationWithBlock.

public static long

Returns:

the IMP that calls block. You must dispose of the returned IMP using the function.
imp_implementationWithBlock
(long
the block that implements this method. The signature of block should be method_return_type ^(id self, self, method_args …). The selector of the method is not available to block. block is copied with Block_copy().
block
)

Creates a pointer to a function that calls the specified block when the method is called.

public static boolean

Returns:

YES if the block was released successfully; otherwise, NO (for example, the function returns NO if the block was not used to create anImp previously).
imp_removeBlock
(long
an IMP that was created using the imp_implementationWithBlock function.
anImp
)

Disassociates a block from an IMP that was created using imp_implementationWithBlock, and releases the copy of the block that was created.

public static String

Returns:

a C string containing the instance variable's name
ivar_getName
(long
the instance variable
v
)

Returns the name of an instance variable.

public static long

Returns:

the offset of v
ivar_getOffset
(long
the instance variable
v
)

Returns the offset of an instance variable.

public static String

Returns:

a C string containing the instance variable's type encoding
ivar_getTypeEncoding
(long
the instance variable
v
)

Returns the type string of an instance variable.

public static String

Returns:

a C string describing the type of the parameter at index index, or NULL if method has no parameter index index. You must free the string with free().
method_copyArgumentType
(long
the method to inspect
m
,
int
the index of the parameter to inspect
index
)

Returns a string describing a single parameter type of a method.

public static String

Returns:

a C string describing the return type. You must free the string with free().
method_copyReturnType
(long
the method to inspect
m
)

Returns a string describing a method's return type.

public static void
method_exchangeImplementations(long
the method to exchange with second method
m1
,
long
the method to exchange with first method
m2
)

Exchanges the implementations of two methods.

public static void
method_getArgumentType(long
the method you want to inquire about
m
,
int
the index of the parameter you want to inquire about
index
,
ByteBuffer
the reference string to store the description
dst
)

Returns by reference a string describing a single parameter type of a method.

public static String
method_getArgumentType(long
the method you want to inquire about
m
,
int
the index of the parameter you want to inquire about
index
,
long
the maximum number of characters that can be stored in dst
dst_len
)

Returns by reference a string describing a single parameter type of a method.

public static long

Returns:

a function pointer of type IMP
method_getImplementation
(long
the method to inspect
m
)

Returns the implementation of a method.

public static long

Returns:

a pointer of type SEL
method_getName
(long
the method to inspect
m
)

Returns the name of a method.

public static int

Returns:

an integer containing the number of arguments accepted by the given method
method_getNumberOfArguments
(long
a pointer to a Method data structure. Pass the method in question.
m
)

Returns the number of arguments accepted by a method.

public static void
method_getReturnType(long
the method to inspect
m
,
ByteBuffer
the reference string to store the description
dst
)

Returns by reference a string describing a method's return type.

public static String
method_getReturnType(long
the method to inspect
m
,
long
the maximum number of characters that can be stored in dst
dst_len
)

Returns by reference a string describing a method's return type.

public static String

Returns:

a C string. The string may be NULL
method_getTypeEncoding
(long
the method to inspect
m
)

Returns a string describing a method's parameter and return types.

public static long

Returns:

the previous implementation of the method
method_setImplementation
(long
the method for which to set an implementation
m
,
long
the implemention to set to this method
imp
)

Sets the implementation of a method.

public static boolean
nclass_addIvar(long cls, long name, long size, byte alignment, long types)

Unsafe version of: class_addIvar

public static boolean
nclass_addMethod(long cls, long name, long imp, long types)

Unsafe version of: class_addMethod

public static boolean
nclass_addProperty(long cls, long name, long attributes, int
the number of attributes in attributes
attributeCount
)

Unsafe version of: class_addProperty

public static long
nclass_copyIvarList(long cls, long
on return, contains the length of the returned array. If outCount is NULL, the length is not returned
outCount
)

Unsafe version of: class_copyIvarList

public static long
nclass_copyMethodList(long cls, long
on return, contains the length of the returned array. If outCount is NULL, the length is not returned
outCount
)

Unsafe version of: class_copyMethodList

public static long
nclass_copyPropertyList(long cls, long
on return, contains the length of the returned array. If outCount is NULL, the length is not returned
outCount
)

Unsafe version of: class_copyPropertyList

public static long
nclass_copyProtocolList(long cls, long
on return, contains the length of the returned array. If outCount is NULL, the length is not returned
outCount
)

Unsafe version of: class_copyProtocolList

public static long
nclass_getClassVariable(long cls, long name)

Unsafe version of: class_getClassVariable

public static long
nclass_getImageName(long cls)

Unsafe version of: class_getImageName

public static long
nclass_getInstanceVariable(long cls, long name)

Unsafe version of: class_getInstanceVariable

public static long
nclass_getIvarLayout(long cls)

Unsafe version of: class_getIvarLayout

public static long
nclass_getName(long cls)

Unsafe version of: class_getName

public static long
nclass_getProperty(long cls, long name)

Unsafe version of: class_getProperty

public static long
public static long
nclass_replaceMethod(long cls, long name, long imp, long types)

Unsafe version of: class_replaceMethod

public static void
nclass_replaceProperty(long cls, long name, long attributes, int
the number of attributes in attributes
attributeCount
)

Unsafe version of: class_replaceProperty

public static void
nclass_setIvarLayout(long cls, long layout)

Unsafe version of: class_setIvarLayout

public static void
nclass_setWeakIvarLayout(long cls, long layout)

Unsafe version of: class_setWeakIvarLayout

public static long
nivar_getName(long v)

Unsafe version of: ivar_getName

public static long
nivar_getTypeEncoding(long v)

Unsafe version of: ivar_getTypeEncoding

public static long
nmethod_copyArgumentType(long m, int index)

Unsafe version of: method_copyArgumentType

public static long
public static void
nmethod_getArgumentType(long m, int index, long dst, long
the maximum number of characters that can be stored in dst
dst_len
)

Unsafe version of: method_getArgumentType

public static void
nmethod_getReturnType(long m, long dst, long
the maximum number of characters that can be stored in dst
dst_len
)

Unsafe version of: method_getReturnType

public static long
public static long
nobjc_allocateClassPair(long superclass, long name, long extraBytes)

Unsafe version of: objc_allocateClassPair

public static long
nobjc_allocateProtocol(long name)

Unsafe version of: objc_allocateProtocol

public static long
nobjc_constructInstance(long cls, long bytes)

Unsafe version of: objc_constructInstance

public static long
nobjc_copyClassList(long
an integer pointer used to store the number of classes returned by this function in the list. This parameter may be nil
outCount
)

Unsafe version of: objc_copyClassList

public static long
nobjc_copyClassNamesForImage(long image, long
the number of names in the returned array
outCount
)

Unsafe version of: objc_copyClassNamesForImage

public static long
nobjc_copyImageNames(long
the number of names in the returned array
outCount
)

Unsafe version of: objc_copyImageNames

public static long
nobjc_copyProtocolList(long
upon return, contains the number of protocols in the returned array
outCount
)

Unsafe version of: objc_copyProtocolList

public static long
nobjc_getClass(long name)

Unsafe version of: objc_getClass

public static int
nobjc_getClassList(long buffer, int
the number of pointers for which you have allocated space in buffer. On return, this function fills in only this number of elements. If this number is less than the number of registered classes, this function returns an arbitrary subset of the registered classes.
bufferCount
)

Unsafe version of: objc_getClassList

public static long
nobjc_getMetaClass(long name)

Unsafe version of: objc_getMetaClass

public static long
nobjc_getProtocol(long name)

Unsafe version of: objc_getProtocol

public static long
nobjc_getRequiredClass(long name)

Unsafe version of: objc_getRequiredClass

public static long
nobjc_loadWeak(long location)

Unsafe version of: objc_loadWeak

public static long
nobjc_lookUpClass(long name)

Unsafe version of: objc_lookUpClass

public static void
public static long
nobjc_storeWeak(long location, long obj)

Unsafe version of: objc_storeWeak

public static long
nobject_getClassName(long obj)

Unsafe version of: object_getClassName

public static long
nobject_getInstanceVariable(long obj, long name, long outValue)

Unsafe version of: object_getInstanceVariable

public static long
nobject_setInstanceVariable(long obj, long name, long value)

Unsafe version of: object_setInstanceVariable

public static long
nproperty_copyAttributeList(long property, long
the number of attributes returned in the array
outCount
)

Unsafe version of: property_copyAttributeList

public static long
nproperty_copyAttributeValue(long property, long attributeName)

Unsafe version of: property_copyAttributeValue

public static long
nproperty_getAttributes(long property)

Unsafe version of: property_getAttributes

public static long
nproperty_getName(long property)

Unsafe version of: property_getName

public static void
nprotocol_addMethodDescription(long proto, long name, long types, boolean isRequiredMethod, boolean isInstanceMethod)

Unsafe version of: protocol_addMethodDescription

public static void
nprotocol_addProperty(long proto, long name, long attributes, int
the number of properties in attributes
attributeCount
,
boolean isRequiredProperty, boolean isInstanceProperty)

Unsafe version of: protocol_addProperty

public static long
nprotocol_copyMethodDescriptionList(long p, boolean isRequiredMethod, boolean isInstanceMethod, long
upon return, contains the number of method description structures in the returned array
outCount
)

Unsafe version of: protocol_copyMethodDescriptionList

public static long
nprotocol_copyPropertyList(long proto, long
upon return, contains the number of elements in the returned array
outCount
)

Unsafe version of: protocol_copyPropertyList

public static long
nprotocol_copyProtocolList(long proto, long
upon return, contains the number of elements in the returned array
outCount
)

Unsafe version of: protocol_copyProtocolList

public static native void
nprotocol_getMethodDescription(long p, long aSel, boolean isRequiredMethod, boolean isInstanceMethod, long __functionAddress, long __result)

Unsafe version of: protocol_getMethodDescription

public static void
nprotocol_getMethodDescription(long p, long aSel, boolean isRequiredMethod, boolean isInstanceMethod, long __result)

Unsafe version of: protocol_getMethodDescription

public static long
nprotocol_getName(long p)

Unsafe version of: protocol_getName

public static long
nprotocol_getProperty(long proto, long name, boolean isRequiredProperty, boolean isInstanceProperty)

Unsafe version of: protocol_getProperty

public static long
nsel_getName(long sel)

Unsafe version of: sel_getName

public static long
nsel_getUid(long str)

Unsafe version of: sel_getUid

public static long
nsel_registerName(long str)

Unsafe version of: sel_registerName

public static long

Returns:

the new class, or Nil if the class could not be created (for example, the desired name is already in use)
objc_allocateClassPair
(long
the class to use as the new class's superclass, or Nil to create a new root class
superclass
,
ByteBuffer
the string to use as the new class's name. The string will be copied.
name
,
long
the number of bytes to allocate for indexed ivars at the end of the class and metaclass objects. This should usually be 0.
extraBytes
)

Creates a new class and metaclass.

public static long

Returns:

the new class, or Nil if the class could not be created (for example, the desired name is already in use)
objc_allocateClassPair
(long
the class to use as the new class's superclass, or Nil to create a new root class
superclass
,
CharSequence
the string to use as the new class's name. The string will be copied.
name
,
long
the number of bytes to allocate for indexed ivars at the end of the class and metaclass objects. This should usually be 0.
extraBytes
)

Creates a new class and metaclass.

public static long

Returns:

a new protocol instance or nil if a protocol with the same name as name already exists
objc_allocateProtocol
(ByteBuffer
the name of the protocol you want to create
name
)

Creates a new protocol instance.

public static long

Returns:

a new protocol instance or nil if a protocol with the same name as name already exists
objc_allocateProtocol
(CharSequence
the name of the protocol you want to create
name
)

Creates a new protocol instance.

public static long

Returns:

an instance of the class cls at bytes, if successful; otherwise nil (for example, if cls or bytes are themselves nil)
objc_constructInstance
(long
the class that you want to allocate an instance of
cls
,
ByteBuffer
the location at which to allocate an instance of the cls class. bytes must point to at least class_getInstanceSize(cls) bytes of well-aligned, zero-filled memory.
bytes
)

Creates an instance of a class at the specified location.

public static PointerBuffer

Returns:

a nil terminated array of classes. You must free the array with free()
objc_copyClassList
()

Creates and returns a list of pointers to all registered class definitions.

public static PointerBuffer

Returns:

an array of C strings representing all of the class names within the specified library or framework
objc_copyClassNamesForImage
(ByteBuffer
the library or framework you are inquiring about
image
)

Returns the names of all the classes within a specified library or framework.

public static PointerBuffer

Returns:

an array of C strings representing all of the class names within the specified library or framework
objc_copyClassNamesForImage
(CharSequence
the library or framework you are inquiring about
image
)

Returns the names of all the classes within a specified library or framework.

public static PointerBuffer

Returns:

an array of C strings representing the names of all the loaded Objective-C frameworks and dynamic libraries
objc_copyImageNames
()

Returns the names of all the loaded Objective-C frameworks and dynamic libraries.

public static PointerBuffer

Returns:

a C array of all the protocols known to the runtime. The array contains *outCount pointers followed by a NULL terminator. You must free the list with free().
objc_copyProtocolList
()

Returns an array of all the protocols known to the runtime.

public static long
objc_destructInstance(long
the instance to destroy
obj
)

Destroys an instance of a class without freeing memory and removes any of its associated references.

public static void
objc_disposeClassPair(long
the class to be destroyed. This class must have been allocated using objc_allocateClassPair.
cls
)

Destroys a class and its associated metaclass.

public static void
objc_enumerationMutation(long
the object being mutated
obj
)

Inserted by the compiler when a mutation is detected during a foreach iteration.

public static long

Returns:

the value associated with the key key for object.
objc_getAssociatedObject
(long
the source object for the association
object
,
long
the key for the association
key
)

Returns the value associated with a given object for a given key.

public static long

Returns:

the Class object for the named class, or nil if the class is not registered with the Objective-C runtime
objc_getClass
(ByteBuffer
the name of the class to look up
name
)

Returns the class definition of a specified class.

public static long

Returns:

the Class object for the named class, or nil if the class is not registered with the Objective-C runtime
objc_getClass
(CharSequence
the name of the class to look up
name
)

Returns the class definition of a specified class.

public static int

Returns:

an integer value indicating the total number of registered classes
objc_getClassList
(PointerBuffer
an array of Class values. On output, each Class value points to one class definition, up to either bufferCount or the total number of registered classes, whichever is less. You can pass NULL to obtain the total number of registered class definitions without actually retrieving any class definitions.
buffer
)

Obtains the list of registered class definitions.

public static long

Returns:

the Class object for the metaclass of the named class, or nil if the class is not registered with the Objective-C runtime
objc_getMetaClass
(ByteBuffer
the name of the class to look up
name
)

Returns the metaclass definition of a specified class.

public static long

Returns:

the Class object for the metaclass of the named class, or nil if the class is not registered with the Objective-C runtime
objc_getMetaClass
(CharSequence
the name of the class to look up
name
)

Returns the metaclass definition of a specified class.

public static long

Returns:

the protocol named name{, or NULL if no protocol named name could be found
objc_getProtocol
(ByteBuffer
the name of a protocol
name
)

Returns a specified protocol.

public static long

Returns:

the protocol named name{, or NULL if no protocol named name could be found
objc_getProtocol
(CharSequence
the name of a protocol
name
)

Returns a specified protocol.

public static long

Returns:

the Class object for the named class
objc_getRequiredClass
(ByteBuffer
the name of the class to look up
name
)

Returns the class definition of a specified class.

public static long

Returns:

the Class object for the named class
objc_getRequiredClass
(CharSequence
the name of the class to look up
name
)

Returns the class definition of a specified class.

public static long

Returns:

the object pointed to by location, or nil if location is nil
objc_loadWeak
(PointerBuffer
the address of the weak pointer
location
)

Loads the object referenced by a weak pointer and returns it.

public static long

Returns:

the Class object for the named class, or nil if the class is not registered with the Objective-C runtime
objc_lookUpClass
(ByteBuffer
the name of the class to look up
name
)

Returns the class definition of a specified class.

public static long

Returns:

the Class object for the named class, or nil if the class is not registered with the Objective-C runtime
objc_lookUpClass
(CharSequence
the name of the class to look up
name
)

Returns the class definition of a specified class.

public static void
objc_registerClassPair(long
the class you want to register
cls
)

Registers a class that was allocated using objc_allocateClassPair.

public static void
objc_registerProtocol(long
the protocol you want to register with the Objective-C runtime
proto
)

Registers a newly created protocol with the Objective-C runtime.

public static void
objc_removeAssociatedObjects(long
an object that maintains associated objects
object
)

Removes all associations for a given object.

public static void
objc_setAssociatedObject(long
the source object for the association
object
,
long
the key for the association
key
,
long
the value to associate with the key key for object. Pass nil to clear an existing association.
value
,
long policy)

Sets an associated value for a given object using a given key and association policy.

public static void
objc_setEnumerationMutationHandler(EnumerationMutationHandlerI
a function pointer to the new mutation handler
handler
)

Sets the current mutation handler.

public static long

Returns:

the value stored in location (that is, obj)
objc_storeWeak
(PointerBuffer
the address of the weak pointer
location
,
long
the new object you want the weak pointer to now point to
obj
)

Stores a new value in a __weak variable.

public static long

Returns:

a copy of obj
object_copy
(long
an Objective-C object
obj
,
long
the size of the object obj
size
)

Returns a copy of a given object.

public static long

Returns:

nil
object_dispose
(long
an Objective-C object
obj
)

Frees the memory occupied by a given object.

public static long

Returns:

the class object of which object is an instance, or Nil if obj is nil
object_getClass
(long
an Objective-C object
obj
)

Returns the class of an object.

public static String

Returns:

the name of the class of which obj is an instance
object_getClassName
(long
an Objective-C object
obj
)

Returns the class name of a given object.

public static long

Returns:

a pointer to any extra bytes allocated with obj. If obj was not allocated with any extra bytes, then dereferencing the returned pointer is undefined.
object_getIndexedIvars
(long
an Objective-C object
obj
)

This function returns a pointer to any extra bytes allocated with the instance (as specified by class_createInstance with extraBytes>0).

public static long

Returns:

a pointer to the Ivar data structure that defines the type and name of the instance variable specified by name
object_getInstanceVariable
(long
a pointer to an instance of a class. Pass the object containing the instance variable whose value you wish to obtain
obj
,
ByteBuffer
a C string. Pass the name of the instance variable whose value you wish to obtain
name
,
PointerBuffer
on return, contains a pointer to the value of the instance variable
outValue
)

Obtains the value of an instance variable of a class instance.

public static long

Returns:

a pointer to the Ivar data structure that defines the type and name of the instance variable specified by name
object_getInstanceVariable
(long
a pointer to an instance of a class. Pass the object containing the instance variable whose value you wish to obtain
obj
,
CharSequence
a C string. Pass the name of the instance variable whose value you wish to obtain
name
,
PointerBuffer
on return, contains a pointer to the value of the instance variable
outValue
)

Obtains the value of an instance variable of a class instance.

public static long

Returns:

the value of the instance variable specified by ivar, or nil if obj is nil
object_getIvar
(long
the object containing the instance variable whose value you want to read
obj
,
long
the Ivar describing the instance variable whose value you want to read
ivar
)

Reads the value of an instance variable in an object.

public static long

Returns:

the previous value of object's class, or Nil if obj is nil
object_setClass
(long
the object to modify
obj
,
long
a class object
cls
)

Sets the class of an object.

public static long

Returns:

a pointer to the Ivar data structure that defines the type and name of the instance variable specified by name
object_setInstanceVariable
(long
a pointer to an instance of a class. Pass the object containing the instance variable whose value you wish to modify
obj
,
ByteBuffer
a C string. Pass the name of the instance variable whose value you wish to modify
name
,
ByteBuffer
the new value for the instance variable
value
)

Changes the value of an instance variable of a class instance.

public static long

Returns:

a pointer to the Ivar data structure that defines the type and name of the instance variable specified by name
object_setInstanceVariable
(long
a pointer to an instance of a class. Pass the object containing the instance variable whose value you wish to modify
obj
,
CharSequence
a C string. Pass the name of the instance variable whose value you wish to modify
name
,
ByteBuffer
the new value for the instance variable
value
)

Changes the value of an instance variable of a class instance.

public static void
object_setIvar(long
the object containing the instance variable whose value you want to set
obj
,
long
the Ivar describing the instance variable whose value you want to set
ivar
,
long
the new value for the instance variable
value
)

Sets the value of an instance variable in an object.

public static ObjCPropertyAttribute.Buffer

Returns:

an array of property attributes. You must free the array with free().
property_copyAttributeList
(long
the property whose attributes you want to copy
property
)

Returns an array of property attributes for a given property.

public static String

Returns:

The value string of the attributeName attribute, if one exists in property; otherwise, nil. You must free the returned value string with free().
property_copyAttributeValue
(long
the property whose value you are interested in
property
,
ByteBuffer
a C string representing the name of the attribute
attributeName
)

Returns the value of a property attribute given the attribute name.

public static String

Returns:

The value string of the attributeName attribute, if one exists in property; otherwise, nil. You must free the returned value string with free().
property_copyAttributeValue
(long
the property whose value you are interested in
property
,
CharSequence
a C string representing the name of the attribute
attributeName
)

Returns the value of a property attribute given the attribute name.

public static String

Returns:

a C string containing the property's attributes
property_getAttributes
(long
a property
property
)

Returns the attribute string of a property.

public static String

Returns:

a C string containing the property's name
property_getName
(long
the property you want to inquire about
property
)

Returns the name of a property.

public static void
protocol_addMethodDescription(long
the protocol you want to add a method to
proto
,
long
the name of the method you want to add
name
,
ByteBuffer
a C string representing the signature of the method you want to add
types
,
boolean
a Boolean indicating whether the method is a required method of the proto protocol. If YES, the method is a required method; if NO, the method is an optional method.
isRequiredMethod
,
boolean
a Boolean indicating whether the method is an instance method. If YES, the method is an instance method; if NO, the method is a class method.
isInstanceMethod
)

Adds a method to a protocol.

public static void
protocol_addMethodDescription(long
the protocol you want to add a method to
proto
,
long
the name of the method you want to add
name
,
CharSequence
a C string representing the signature of the method you want to add
types
,
boolean
a Boolean indicating whether the method is a required method of the proto protocol. If YES, the method is a required method; if NO, the method is an optional method.
isRequiredMethod
,
boolean
a Boolean indicating whether the method is an instance method. If YES, the method is an instance method; if NO, the method is a class method.
isInstanceMethod
)

Adds a method to a protocol.

public static void
protocol_addProperty(long
the protocol you want to add a property to
proto
,
ByteBuffer
the name of the property you want to add.
name
,
ObjCPropertyAttribute.Buffer
an array of property attributes
attributes
,
boolean
a Boolean indicating whether the property's accessor methods are required methods of the proto protocol. If YES, the property's accessor methods are required methods; if NO, the property's accessor methods are optional methods.
isRequiredProperty
,
boolean
a Boolean indicating whether the property's accessor methods are instance methods. If YES, the property's accessor methods are instance methods. YES is the only value allowed for a property. As a result, if you set this value to NO, the property will not be added to the protocol.
isInstanceProperty
)

Adds a property to a protocol that is under construction.

public static void
protocol_addProperty(long
the protocol you want to add a property to
proto
,
CharSequence
the name of the property you want to add.
name
,
ObjCPropertyAttribute.Buffer
an array of property attributes
attributes
,
boolean
a Boolean indicating whether the property's accessor methods are required methods of the proto protocol. If YES, the property's accessor methods are required methods; if NO, the property's accessor methods are optional methods.
isRequiredProperty
,
boolean
a Boolean indicating whether the property's accessor methods are instance methods. If YES, the property's accessor methods are instance methods. YES is the only value allowed for a property. As a result, if you set this value to NO, the property will not be added to the protocol.
isInstanceProperty
)

Adds a property to a protocol that is under construction.

public static void
protocol_addProtocol(long
the protocol you want to add the registered protocol to
proto
,
long
the registered protocol you want to add to proto
addition
)

Adds a registered protocol to another protocol that is under construction.

public static boolean

Returns:

YES if proto conforms to other, otherwise NO
protocol_conformsToProtocol
(long
a protocol
proto
,
long
a protocol
other
)

Returns a Boolean value that indicates whether one protocol conforms to another protocol.

public static ObjCMethodDescription.Buffer

Returns:

a C array of objc_method_description structures containing the names and types of p's methods specified by isRequiredMethod and isInstanceMethod. The array contains *outCount pointers followed by a NULL terminator. You must free the list with free().

If the protocol declares no methods that meet the specification, NULL is returned and *outCount is 0.

protocol_copyMethodDescriptionList
(long
a protocol
p
,
boolean
a Boolean value that indicates whether returned methods should be required methods (pass YES to specify required methods)
isRequiredMethod
,
boolean
a Boolean value that indicates whether returned methods should be instance methods (pass YES to specify instance methods)
isInstanceMethod
)

Returns an array of method descriptions of methods meeting a given specification for a given protocol.

public static PointerBuffer

Returns:

a C array of pointers of type objc_property_t describing the properties declared by proto. Any properties declared by other protocols adopted by this protocol are not included. The array contains *outCount pointers followed by a NULL terminator. You must free the array with free().

If the protocol declares no properties, NULL is returned and *outCount is 0.

protocol_copyPropertyList
(long
a protocol
proto
)

Returns an array of the properties declared by a protocol.

public static PointerBuffer

Returns:

a C array of protocols adopted by proto. The array contains *outCount pointers followed by a NULL terminator. You must free the array with free().

If the protocol declares no properties, NULL is returned and *outCount is 0.

protocol_copyProtocolList
(long
a protocol
proto
)

eturns an array of the protocols adopted by a protocol.

public static ObjCMethodDescription
protocol_getMethodDescription(long
a protocol
p
,
long
a selector
aSel
,
boolean
a Boolean value that indicates whether aSel is a required method
isRequiredMethod
,
boolean
a Boolean value that indicates whether aSel is a instance method
isInstanceMethod
,
ObjCMethodDescription
an objc_method_description structure that describes the method specified by aSel, isRequiredMethod, and isInstanceMethod for the protocol p.

If the protocol does not contain the specified method, returns an objc_method_description structure with the value {NULL, NULL}.

__result
)

Returns a method description structure for a specified method of a given protocol.

public static String

Returns:

the name of the protocol p as a C string
protocol_getName
(long
a protocol
p
)

Returns a the name of a protocol.

public static long

Returns:

the property specified by name, isRequiredProperty, and isInstanceProperty for proto, or NULL if none of proto's properties meets the specification
protocol_getProperty
(long
a protocol
proto
,
ByteBuffer
the name of a property
name
,
boolean
a Boolean value that indicates whether name is a required property
isRequiredProperty
,
boolean
a Boolean value that indicates whether name is a instance property
isInstanceProperty
)

Returns the specified property of a given protocol.

public static long

Returns:

the property specified by name, isRequiredProperty, and isInstanceProperty for proto, or NULL if none of proto's properties meets the specification
protocol_getProperty
(long
a protocol
proto
,
CharSequence
the name of a property
name
,
boolean
a Boolean value that indicates whether name is a required property
isRequiredProperty
,
boolean
a Boolean value that indicates whether name is a instance property
isInstanceProperty
)

Returns the specified property of a given protocol.

public static boolean

Returns:

YES if proto is the same as other, otherwise NO
protocol_isEqual
(long
a protocol
proto
,
long
a protocol
other
)

Returns a Boolean value that indicates whether two protocols are equal.

public static String

Returns:

a C string indicating the name of the selector
sel_getName
(long
a pointer of type SEL. Pass the selector whose name you wish to determine.
sel
)

Returns the name of the method specified by a given selector.

public static long

Returns:

a pointer of type SEL specifying the selector for the named method
sel_getUid
(ByteBuffer
a pointer to a C string. Pass the name of the method you wish to register
str
)

Registers a method name with the Objective-C runtime system.

public static long

Returns:

a pointer of type SEL specifying the selector for the named method
sel_getUid
(CharSequence
a pointer to a C string. Pass the name of the method you wish to register
str
)

Registers a method name with the Objective-C runtime system.

public static boolean

Returns:

YES if rhs and rhs are equal, otherwise NO
sel_isEqual
(long
the selector to compare with rhs
lhs
,
long
the selector to compare with lhs
rhs
)

Returns a Boolean value that indicates whether two selectors are equal.

public static long

Returns:

a pointer of type SEL specifying the selector for the named method
sel_registerName
(ByteBuffer
a pointer to a C string. Pass the name of the method you wish to register
str
)

Registers a method with the Objective-C runtime system, maps the method name to a selector, and returns the selector value.

public static long

Returns:

a pointer of type SEL specifying the selector for the named method
sel_registerName
(CharSequence
a pointer to a C string. Pass the name of the method you wish to register
str
)

Registers a method with the Objective-C runtime system, maps the method name to a selector, and returns the selector value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait