public class ObjCRuntime
extends java.lang.Object
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, DynCall may be used to invoke it.
The functions not exposed are:
| Modifier and Type | Class and Description |
|---|---|
static class |
ObjCRuntime.Functions
Contains the function pointers loaded from the objc
SharedLibrary. |
| Modifier and Type | Field and Description |
|---|---|
static char |
_C_ARY_B
Types.
|
static char |
_C_ARY_E
Types.
|
static char |
_C_ATOM
Types.
|
static char |
_C_BFLD
Types.
|
static char |
_C_BOOL
Types.
|
static char |
_C_CHARPTR
Types.
|
static char |
_C_CHR
Types.
|
static char |
_C_CLASS
Types.
|
static char |
_C_CONST
Types.
|
static char |
_C_DBL
Types.
|
static char |
_C_FLT
Types.
|
static char |
_C_ID
Types.
|
static char |
_C_INT
Types.
|
static char |
_C_LNG
Types.
|
static char |
_C_LNG_LNG
Types.
|
static char |
_C_PTR
Types.
|
static char |
_C_SEL
Types.
|
static char |
_C_SHT
Types.
|
static char |
_C_STRUCT_B
Types.
|
static char |
_C_STRUCT_E
Types.
|
static char |
_C_UCHR
Types.
|
static char |
_C_UINT
Types.
|
static char |
_C_ULNG
Types.
|
static char |
_C_ULNG_LNG
Types.
|
static char |
_C_UNDEF
Types.
|
static char |
_C_UNION_B
Types.
|
static char |
_C_UNION_E
Types.
|
static char |
_C_USHT
Types.
|
static char |
_C_VECTOR
Types.
|
static char |
_C_VOID
Types.
|
static long |
nil
Nil value.
|
static byte |
NO
Boolean values.
|
static int |
OBJC_ASSOCIATION_ASSIGN
Policies related to associative references.
|
static int |
OBJC_ASSOCIATION_COPY
Policies related to associative references.
|
static int |
OBJC_ASSOCIATION_COPY_NONATOMIC
Policies related to associative references.
|
static int |
OBJC_ASSOCIATION_RETAIN
Policies related to associative references.
|
static int |
OBJC_ASSOCIATION_RETAIN_NONATOMIC
Policies related to associative references.
|
static byte |
YES
Boolean values.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
class_addIvar(long cls,
java.nio.ByteBuffer name,
long size,
byte alignment,
java.nio.ByteBuffer types)
Adds a new instance variable to a class.
|
static boolean |
class_addIvar(long cls,
java.lang.CharSequence name,
long size,
byte alignment,
java.lang.CharSequence types)
Adds a new instance variable to a class.
|
static boolean |
class_addMethod(long cls,
long name,
long imp,
java.nio.ByteBuffer types)
Adds a new method to a class with a given name and implementation.
|
static boolean |
class_addMethod(long cls,
long name,
long imp,
java.lang.CharSequence types)
Adds a new method to a class with a given name and implementation.
|
static boolean |
class_addProperty(long cls,
java.nio.ByteBuffer name,
ObjCPropertyAttribute.Buffer attributes)
Adds a property to a class.
|
static boolean |
class_addProperty(long cls,
java.lang.CharSequence name,
ObjCPropertyAttribute.Buffer attributes)
Adds a property to a class.
|
static boolean |
class_addProtocol(long cls,
long protocol)
Adds a protocol to a class.
|
static boolean |
class_conformsToProtocol(long cls,
long protocol)
Returns a Boolean value that indicates whether a class conforms to a given protocol.
|
static org.lwjgl.PointerBuffer |
class_copyIvarList(long cls)
Describes the instance variables declared by a class.
|
static org.lwjgl.PointerBuffer |
class_copyMethodList(long cls)
Describes the instance methods implemented by a class.
|
static org.lwjgl.PointerBuffer |
class_copyPropertyList(long cls)
Describes the properties declared by a class.
|
static org.lwjgl.PointerBuffer |
class_copyProtocolList(long cls)
Describes the protocols adopted by a class.
|
static long |
class_createInstance(long cls,
long extraBytes)
Creates an instance of a class, allocating memory for the class in the default malloc memory zone.
|
static long |
class_getClassMethod(long cls,
long name)
Returns a pointer to the data structure describing a given class method for a given class.
|
static long |
class_getClassVariable(long cls,
java.nio.ByteBuffer name)
Returns the Ivar for a specified class variable of a given class.
|
static long |
class_getClassVariable(long cls,
java.lang.CharSequence name)
Returns the Ivar for a specified class variable of a given class.
|
static java.lang.String |
class_getImageName(long cls)
Returns the name of the dynamic library a class originated from.
|
static long |
class_getInstanceMethod(long cls,
long name)
Returns a specified instance method for a given class.
|
static long |
class_getInstanceSize(long cls)
Returns the size of instances of a class.
|
static long |
class_getInstanceVariable(long cls,
java.nio.ByteBuffer name)
Returns the Ivar for a specified instance variable of a given class.
|
static long |
class_getInstanceVariable(long cls,
java.lang.CharSequence name)
Returns the Ivar for a specified instance variable of a given class.
|
static java.lang.String |
class_getIvarLayout(long cls)
Returns a description of the Ivar layout for a given class.
|
static long |
class_getMethodImplementation(long cls,
long name)
Returns the function pointer that would be called if a particular message were sent to an instance of a class.
|
static java.lang.String |
class_getName(long cls)
Returns the name of a class.
|
static long |
class_getProperty(long cls,
java.nio.ByteBuffer name)
Returns a property with a given name of a given class.
|
static long |
class_getProperty(long cls,
java.lang.CharSequence name)
Returns a property with a given name of a given class.
|
static long |
class_getSuperclass(long cls)
Returns the superclass of a class.
|
static int |
class_getVersion(long cls)
Returns the version number of a class definition.
|
static java.lang.String |
class_getWeakIvarLayout(long cls)
Returns a description of the layout of weak Ivars for a given class.
|
static boolean |
class_isMetaClass(long cls)
Returns a Boolean value that indicates whether a class object is a metaclass.
|
static long |
class_replaceMethod(long cls,
long name,
long imp,
java.nio.ByteBuffer types)
Replaces the implementation of a method for a given class.
|
static long |
class_replaceMethod(long cls,
long name,
long imp,
java.lang.CharSequence types)
Replaces the implementation of a method for a given class.
|
static void |
class_replaceProperty(long cls,
java.nio.ByteBuffer name,
ObjCPropertyAttribute.Buffer attributes)
Replaces a property of a class.
|
static void |
class_replaceProperty(long cls,
java.lang.CharSequence name,
ObjCPropertyAttribute.Buffer attributes)
Replaces a property of a class.
|
static boolean |
class_respondsToSelector(long cls,
long name)
Returns a Boolean value that indicates whether instances of a class respond to a particular selector.
|
static void |
class_setIvarLayout(long cls,
java.nio.ByteBuffer layout)
Sets the Ivar layout for a given class.
|
static void |
class_setIvarLayout(long cls,
java.lang.CharSequence layout)
Sets the Ivar layout for a given class.
|
static void |
class_setVersion(long cls,
int version)
Sets the version number of a class definition.
|
static void |
class_setWeakIvarLayout(long cls,
java.nio.ByteBuffer layout)
Sets the layout for weak Ivars for a given class.
|
static void |
class_setWeakIvarLayout(long cls,
java.lang.CharSequence layout)
Sets the layout for weak Ivars for a given class.
|
static org.lwjgl.system.SharedLibrary |
getLibrary()
Returns the objc
SharedLibrary. |
static long |
imp_getBlock(long anImp)
Returns the block associated with an IMP that was created using
imp_implementationWithBlock(long). |
static long |
imp_implementationWithBlock(long block)
Creates a pointer to a function that calls the specified block when the method is called.
|
static boolean |
imp_removeBlock(long anImp)
Disassociates a block from an IMP that was created using
imp_implementationWithBlock(long), and releases the copy of the block that was created. |
static java.lang.String |
ivar_getName(long v)
Returns the name of an instance variable.
|
static long |
ivar_getOffset(long v)
Returns the offset of an instance variable.
|
static java.lang.String |
ivar_getTypeEncoding(long v)
Returns the type string of an instance variable.
|
static java.lang.String |
method_copyArgumentType(long m,
int index)
Returns a string describing a single parameter type of a method.
|
static java.lang.String |
method_copyReturnType(long m)
Returns a string describing a method's return type.
|
static void |
method_exchangeImplementations(long m1,
long m2)
Exchanges the implementations of two methods.
|
static void |
method_getArgumentType(long m,
int index,
java.nio.ByteBuffer dst)
Returns by reference a string describing a single parameter type of a method.
|
static java.lang.String |
method_getArgumentType(long m,
int index,
long dst_len)
Returns by reference a string describing a single parameter type of a method.
|
static long |
method_getImplementation(long m)
Returns the implementation of a method.
|
static long |
method_getName(long m)
Returns the name of a method.
|
static int |
method_getNumberOfArguments(long m)
Returns the number of arguments accepted by a method.
|
static void |
method_getReturnType(long m,
java.nio.ByteBuffer dst)
Returns by reference a string describing a method's return type.
|
static java.lang.String |
method_getReturnType(long m,
long dst_len)
Returns by reference a string describing a method's return type.
|
static java.lang.String |
method_getTypeEncoding(long m)
Returns a string describing a method's parameter and return types.
|
static long |
method_setImplementation(long m,
long imp)
Sets the implementation of a method.
|
static boolean |
nclass_addIvar(long cls,
long name,
long size,
byte alignment,
long types)
Unsafe version of:
class_addIvar(long, java.nio.ByteBuffer, long, byte, java.nio.ByteBuffer) |
static boolean |
nclass_addMethod(long cls,
long name,
long imp,
long types)
Unsafe version of:
class_addMethod(long, long, long, java.nio.ByteBuffer) |
static boolean |
nclass_addProperty(long cls,
long name,
long attributes,
int attributeCount)
|
static long |
nclass_copyIvarList(long cls,
long outCount)
Unsafe version of:
class_copyIvarList(long) |
static long |
nclass_copyMethodList(long cls,
long outCount)
Unsafe version of:
class_copyMethodList(long) |
static long |
nclass_copyPropertyList(long cls,
long outCount)
Unsafe version of:
class_copyPropertyList(long) |
static long |
nclass_copyProtocolList(long cls,
long outCount)
Unsafe version of:
class_copyProtocolList(long) |
static long |
nclass_getClassVariable(long cls,
long name)
Unsafe version of:
class_getClassVariable(long, java.nio.ByteBuffer) |
static long |
nclass_getImageName(long cls)
Unsafe version of:
class_getImageName(long) |
static long |
nclass_getInstanceVariable(long cls,
long name)
Unsafe version of:
class_getInstanceVariable(long, java.nio.ByteBuffer) |
static long |
nclass_getIvarLayout(long cls)
Unsafe version of:
class_getIvarLayout(long) |
static long |
nclass_getName(long cls)
Unsafe version of:
class_getName(long) |
static long |
nclass_getProperty(long cls,
long name)
Unsafe version of:
class_getProperty(long, java.nio.ByteBuffer) |
static long |
nclass_getWeakIvarLayout(long cls)
Unsafe version of:
class_getWeakIvarLayout(long) |
static long |
nclass_replaceMethod(long cls,
long name,
long imp,
long types)
Unsafe version of:
class_replaceMethod(long, long, long, java.nio.ByteBuffer) |
static void |
nclass_replaceProperty(long cls,
long name,
long attributes,
int attributeCount)
|
static void |
nclass_setIvarLayout(long cls,
long layout)
Unsafe version of:
class_setIvarLayout(long, java.nio.ByteBuffer) |
static void |
nclass_setWeakIvarLayout(long cls,
long layout)
Unsafe version of:
class_setWeakIvarLayout(long, java.nio.ByteBuffer) |
static long |
nivar_getName(long v)
Unsafe version of:
ivar_getName(long) |
static long |
nivar_getTypeEncoding(long v)
Unsafe version of:
ivar_getTypeEncoding(long) |
static long |
nmethod_copyArgumentType(long m,
int index)
Unsafe version of:
method_copyArgumentType(long, int) |
static long |
nmethod_copyReturnType(long m)
Unsafe version of:
method_copyReturnType(long) |
static void |
nmethod_getArgumentType(long m,
int index,
long dst,
long dst_len)
Unsafe version of:
method_getArgumentType(long, int, java.nio.ByteBuffer) |
static void |
nmethod_getReturnType(long m,
long dst,
long dst_len)
Unsafe version of:
method_getReturnType(long, java.nio.ByteBuffer) |
static long |
nmethod_getTypeEncoding(long m)
Unsafe version of:
method_getTypeEncoding(long) |
static long |
nobjc_allocateClassPair(long superclass,
long name,
long extraBytes)
Unsafe version of:
objc_allocateClassPair(long, java.nio.ByteBuffer, long) |
static long |
nobjc_allocateProtocol(long name)
Unsafe version of:
objc_allocateProtocol(java.nio.ByteBuffer) |
static long |
nobjc_constructInstance(long cls,
long bytes)
Unsafe version of:
objc_constructInstance(long, java.nio.ByteBuffer) |
static long |
nobjc_copyClassList(long outCount)
Unsafe version of:
objc_copyClassList() |
static long |
nobjc_copyClassNamesForImage(long image,
long outCount)
Unsafe version of:
objc_copyClassNamesForImage(java.nio.ByteBuffer) |
static long |
nobjc_copyImageNames(long outCount)
Unsafe version of:
objc_copyImageNames() |
static long |
nobjc_copyProtocolList(long outCount)
Unsafe version of:
objc_copyProtocolList() |
static long |
nobjc_getClass(long name)
Unsafe version of:
objc_getClass(java.nio.ByteBuffer) |
static int |
nobjc_getClassList(long buffer,
int bufferCount)
Unsafe version of:
objc_getClassList(org.lwjgl.PointerBuffer) |
static long |
nobjc_getMetaClass(long name)
Unsafe version of:
objc_getMetaClass(java.nio.ByteBuffer) |
static long |
nobjc_getProtocol(long name)
Unsafe version of:
objc_getProtocol(java.nio.ByteBuffer) |
static long |
nobjc_getRequiredClass(long name)
Unsafe version of:
objc_getRequiredClass(java.nio.ByteBuffer) |
static long |
nobjc_loadWeak(long location)
Unsafe version of:
objc_loadWeak(org.lwjgl.PointerBuffer) |
static long |
nobjc_lookUpClass(long name)
Unsafe version of:
objc_lookUpClass(java.nio.ByteBuffer) |
static void |
nobjc_setEnumerationMutationHandler(long handler)
|
static long |
nobjc_storeWeak(long location,
long obj)
Unsafe version of:
objc_storeWeak(org.lwjgl.PointerBuffer, long) |
static long |
nobject_getClassName(long obj)
Unsafe version of:
object_getClassName(long) |
static long |
nobject_getInstanceVariable(long obj,
long name,
long outValue)
|
static long |
nobject_setInstanceVariable(long obj,
long name,
long value)
Unsafe version of:
object_setInstanceVariable(long, java.nio.ByteBuffer, java.nio.ByteBuffer) |
static long |
nproperty_copyAttributeList(long property,
long outCount)
Unsafe version of:
property_copyAttributeList(long) |
static long |
nproperty_copyAttributeValue(long property,
long attributeName)
Unsafe version of:
property_copyAttributeValue(long, java.nio.ByteBuffer) |
static long |
nproperty_getAttributes(long property)
Unsafe version of:
property_getAttributes(long) |
static long |
nproperty_getName(long property)
Unsafe version of:
property_getName(long) |
static void |
nprotocol_addMethodDescription(long proto,
long name,
long types,
boolean isRequiredMethod,
boolean isInstanceMethod)
|
static void |
nprotocol_addProperty(long proto,
long name,
long attributes,
int attributeCount,
boolean isRequiredProperty,
boolean isInstanceProperty)
|
static long |
nprotocol_copyMethodDescriptionList(long p,
boolean isRequiredMethod,
boolean isInstanceMethod,
long outCount)
Unsafe version of:
protocol_copyMethodDescriptionList(long, boolean, boolean) |
static long |
nprotocol_copyPropertyList(long proto,
long outCount)
Unsafe version of:
protocol_copyPropertyList(long) |
static long |
nprotocol_copyProtocolList(long proto,
long outCount)
Unsafe version of:
protocol_copyProtocolList(long) |
static void |
nprotocol_getMethodDescription(long p,
long aSel,
boolean isRequiredMethod,
boolean isInstanceMethod,
long __result)
|
static void |
nprotocol_getMethodDescription(long p,
long aSel,
boolean isRequiredMethod,
boolean isInstanceMethod,
long __functionAddress,
long __result)
|
static long |
nprotocol_getName(long p)
Unsafe version of:
protocol_getName(long) |
static long |
nprotocol_getProperty(long proto,
long name,
boolean isRequiredProperty,
boolean isInstanceProperty)
Unsafe version of:
protocol_getProperty(long, java.nio.ByteBuffer, boolean, boolean) |
static long |
nsel_getName(long sel)
Unsafe version of:
sel_getName(long) |
static long |
nsel_getUid(long str)
Unsafe version of:
sel_getUid(java.nio.ByteBuffer) |
static long |
nsel_registerName(long str)
Unsafe version of:
sel_registerName(java.nio.ByteBuffer) |
static long |
objc_allocateClassPair(long superclass,
java.nio.ByteBuffer name,
long extraBytes)
Creates a new class and metaclass.
|
static long |
objc_allocateClassPair(long superclass,
java.lang.CharSequence name,
long extraBytes)
Creates a new class and metaclass.
|
static long |
objc_allocateProtocol(java.nio.ByteBuffer name)
Creates a new protocol instance.
|
static long |
objc_allocateProtocol(java.lang.CharSequence name)
Creates a new protocol instance.
|
static long |
objc_constructInstance(long cls,
java.nio.ByteBuffer bytes)
Creates an instance of a class at the specified location.
|
static org.lwjgl.PointerBuffer |
objc_copyClassList()
Creates and returns a list of pointers to all registered class definitions.
|
static org.lwjgl.PointerBuffer |
objc_copyClassNamesForImage(java.nio.ByteBuffer image)
Returns the names of all the classes within a specified library or framework.
|
static org.lwjgl.PointerBuffer |
objc_copyClassNamesForImage(java.lang.CharSequence image)
Returns the names of all the classes within a specified library or framework.
|
static org.lwjgl.PointerBuffer |
objc_copyImageNames()
Returns the names of all the loaded Objective-C frameworks and dynamic libraries.
|
static org.lwjgl.PointerBuffer |
objc_copyProtocolList()
Returns an array of all the protocols known to the runtime.
|
static long |
objc_destructInstance(long obj)
Destroys an instance of a class without freeing memory and removes any of its associated references.
|
static void |
objc_disposeClassPair(long cls)
Destroys a class and its associated metaclass.
|
static void |
objc_enumerationMutation(long obj)
Inserted by the compiler when a mutation is detected during a foreach iteration.
|
static long |
objc_getAssociatedObject(long object,
long key)
Returns the value associated with a given object for a given key.
|
static long |
objc_getClass(java.nio.ByteBuffer name)
Returns the class definition of a specified class.
|
static long |
objc_getClass(java.lang.CharSequence name)
Returns the class definition of a specified class.
|
static int |
objc_getClassList(org.lwjgl.PointerBuffer buffer)
Obtains the list of registered class definitions.
|
static long |
objc_getMetaClass(java.nio.ByteBuffer name)
Returns the metaclass definition of a specified class.
|
static long |
objc_getMetaClass(java.lang.CharSequence name)
Returns the metaclass definition of a specified class.
|
static long |
objc_getProtocol(java.nio.ByteBuffer name)
Returns a specified protocol.
|
static long |
objc_getProtocol(java.lang.CharSequence name)
Returns a specified protocol.
|
static long |
objc_getRequiredClass(java.nio.ByteBuffer name)
Returns the class definition of a specified class.
|
static long |
objc_getRequiredClass(java.lang.CharSequence name)
Returns the class definition of a specified class.
|
static long |
objc_loadWeak(org.lwjgl.PointerBuffer location)
Loads the object referenced by a weak pointer and returns it.
|
static long |
objc_lookUpClass(java.nio.ByteBuffer name)
Returns the class definition of a specified class.
|
static long |
objc_lookUpClass(java.lang.CharSequence name)
Returns the class definition of a specified class.
|
static void |
objc_registerClassPair(long cls)
Registers a class that was allocated using
objc_allocateClassPair(long, java.nio.ByteBuffer, long). |
static void |
objc_registerProtocol(long proto)
Registers a newly created protocol with the Objective-C runtime.
|
static void |
objc_removeAssociatedObjects(long object)
Removes all associations for a given object.
|
static void |
objc_setAssociatedObject(long object,
long key,
long value,
long policy)
Sets an associated value for a given object using a given key and association policy.
|
static void |
objc_setEnumerationMutationHandler(EnumerationMutationHandlerI handler)
Sets the current mutation handler.
|
static long |
objc_storeWeak(org.lwjgl.PointerBuffer location,
long obj)
Stores a new value in a
__weak variable. |
static long |
object_copy(long obj,
long size)
Returns a copy of a given object.
|
static long |
object_dispose(long obj)
Frees the memory occupied by a given object.
|
static long |
object_getClass(long obj)
Returns the class of an object.
|
static java.lang.String |
object_getClassName(long obj)
Returns the class name of a given object.
|
static long |
object_getIndexedIvars(long obj)
This function returns a pointer to any extra bytes allocated with the instance (as specified by
class_createInstance(long, long) with extraBytes>0). |
static long |
object_getInstanceVariable(long obj,
java.nio.ByteBuffer name,
org.lwjgl.PointerBuffer outValue)
Obtains the value of an instance variable of a class instance.
|
static long |
object_getInstanceVariable(long obj,
java.lang.CharSequence name,
org.lwjgl.PointerBuffer outValue)
Obtains the value of an instance variable of a class instance.
|
static long |
object_getIvar(long obj,
long ivar)
Reads the value of an instance variable in an object.
|
static long |
object_setClass(long obj,
long cls)
Sets the class of an object.
|
static long |
object_setInstanceVariable(long obj,
java.nio.ByteBuffer name,
java.nio.ByteBuffer value)
Changes the value of an instance variable of a class instance.
|
static long |
object_setInstanceVariable(long obj,
java.lang.CharSequence name,
java.nio.ByteBuffer value)
Changes the value of an instance variable of a class instance.
|
static void |
object_setIvar(long obj,
long ivar,
long value)
Sets the value of an instance variable in an object.
|
static ObjCPropertyAttribute.Buffer |
property_copyAttributeList(long property)
Returns an array of property attributes for a given property.
|
static java.lang.String |
property_copyAttributeValue(long property,
java.nio.ByteBuffer attributeName)
Returns the value of a property attribute given the attribute name.
|
static java.lang.String |
property_copyAttributeValue(long property,
java.lang.CharSequence attributeName)
Returns the value of a property attribute given the attribute name.
|
static java.lang.String |
property_getAttributes(long property)
Returns the attribute string of a property.
|
static java.lang.String |
property_getName(long property)
Returns the name of a property.
|
static void |
protocol_addMethodDescription(long proto,
long name,
java.nio.ByteBuffer types,
boolean isRequiredMethod,
boolean isInstanceMethod)
Adds a method to a protocol.
|
static void |
protocol_addMethodDescription(long proto,
long name,
java.lang.CharSequence types,
boolean isRequiredMethod,
boolean isInstanceMethod)
Adds a method to a protocol.
|
static void |
protocol_addProperty(long proto,
java.nio.ByteBuffer name,
ObjCPropertyAttribute.Buffer attributes,
boolean isRequiredProperty,
boolean isInstanceProperty)
Adds a property to a protocol that is under construction.
|
static void |
protocol_addProperty(long proto,
java.lang.CharSequence name,
ObjCPropertyAttribute.Buffer attributes,
boolean isRequiredProperty,
boolean isInstanceProperty)
Adds a property to a protocol that is under construction.
|
static void |
protocol_addProtocol(long proto,
long addition)
Adds a registered protocol to another protocol that is under construction.
|
static boolean |
protocol_conformsToProtocol(long proto,
long other)
Returns a Boolean value that indicates whether one protocol conforms to another protocol.
|
static ObjCMethodDescription.Buffer |
protocol_copyMethodDescriptionList(long p,
boolean isRequiredMethod,
boolean isInstanceMethod)
Returns an array of method descriptions of methods meeting a given specification for a given protocol.
|
static org.lwjgl.PointerBuffer |
protocol_copyPropertyList(long proto)
Returns an array of the properties declared by a protocol.
|
static org.lwjgl.PointerBuffer |
protocol_copyProtocolList(long proto)
eturns an array of the protocols adopted by a protocol.
|
static ObjCMethodDescription |
protocol_getMethodDescription(long p,
long aSel,
boolean isRequiredMethod,
boolean isInstanceMethod,
ObjCMethodDescription __result)
Returns a method description structure for a specified method of a given protocol.
|
static java.lang.String |
protocol_getName(long p)
Returns a the name of a protocol.
|
static long |
protocol_getProperty(long proto,
java.nio.ByteBuffer name,
boolean isRequiredProperty,
boolean isInstanceProperty)
Returns the specified property of a given protocol.
|
static long |
protocol_getProperty(long proto,
java.lang.CharSequence name,
boolean isRequiredProperty,
boolean isInstanceProperty)
Returns the specified property of a given protocol.
|
static boolean |
protocol_isEqual(long proto,
long other)
Returns a Boolean value that indicates whether two protocols are equal.
|
static java.lang.String |
sel_getName(long sel)
Returns the name of the method specified by a given selector.
|
static long |
sel_getUid(java.nio.ByteBuffer str)
Registers a method name with the Objective-C runtime system.
|
static long |
sel_getUid(java.lang.CharSequence str)
Registers a method name with the Objective-C runtime system.
|
static boolean |
sel_isEqual(long lhs,
long rhs)
Returns a Boolean value that indicates whether two selectors are equal.
|
static long |
sel_registerName(java.nio.ByteBuffer str)
Registers a method with the Objective-C runtime system, maps the method name to a selector, and returns the selector value.
|
static long |
sel_registerName(java.lang.CharSequence str)
Registers a method with the Objective-C runtime system, maps the method name to a selector, and returns the selector value.
|
public static final long nil
public static final byte YES
public static final byte NO
public static final char _C_ID
public static final char _C_CLASS
public static final char _C_SEL
public static final char _C_CHR
public static final char _C_UCHR
public static final char _C_SHT
public static final char _C_USHT
public static final char _C_INT
public static final char _C_UINT
public static final char _C_LNG
public static final char _C_ULNG
public static final char _C_LNG_LNG
public static final char _C_ULNG_LNG
public static final char _C_FLT
public static final char _C_DBL
public static final char _C_BFLD
public static final char _C_BOOL
public static final char _C_VOID
public static final char _C_UNDEF
public static final char _C_PTR
public static final char _C_CHARPTR
public static final char _C_ATOM
public static final char _C_ARY_B
public static final char _C_ARY_E
public static final char _C_UNION_B
public static final char _C_UNION_E
public static final char _C_STRUCT_B
public static final char _C_STRUCT_E
public static final char _C_VECTOR
public static final char _C_CONST
public static final int OBJC_ASSOCIATION_ASSIGN
public static final int OBJC_ASSOCIATION_RETAIN_NONATOMIC
public static final int OBJC_ASSOCIATION_COPY_NONATOMIC
public static final int OBJC_ASSOCIATION_RETAIN
public static final int OBJC_ASSOCIATION_COPY
public static org.lwjgl.system.SharedLibrary getLibrary()
SharedLibrary.public static long object_copy(long obj,
long size)
obj - an Objective-C objectsize - the size of the object objpublic static long object_dispose(long obj)
obj - an Objective-C objectnilpublic static long object_getClass(long obj)
obj - an Objective-C objectobj is nilpublic static long object_setClass(long obj,
long cls)
obj - the object to modifycls - a class objectobj is nilpublic static long nobject_getClassName(long obj)
object_getClassName(long)@Nullable public static java.lang.String object_getClassName(long obj)
obj - an Objective-C objectobj is an instancepublic static long object_getIndexedIvars(long obj)
class_createInstance(long, long) with extraBytes>0). This
memory follows the object's ordinary ivars, but may not be adjacent to the last ivar.
The returned pointer is guaranteed to be pointer-size aligned, even if the area following the object's last ivar is less aligned than that. Alignment greater than pointer-size is never guaranteed, even if the area following the object's last ivar is more aligned than that.
In a garbage-collected environment, the memory is scanned conservatively.
obj - an Objective-C objectobj. If obj was not allocated with any extra bytes, then dereferencing the returned pointer
is undefined.public static long object_getIvar(long obj,
long ivar)
public static void object_setIvar(long obj,
long ivar,
long value)
object_setIvar is faster than object_setInstanceVariable(long, java.nio.ByteBuffer, java.nio.ByteBuffer) if the Ivar for the instance variable is already known.
obj - the object containing the instance variable whose value you want to setivar - the Ivar describing the instance variable whose value you want to setvalue - the new value for the instance variablepublic static long nobject_setInstanceVariable(long obj,
long name,
long value)
object_setInstanceVariable(long, java.nio.ByteBuffer, java.nio.ByteBuffer)public static long object_setInstanceVariable(long obj,
java.nio.ByteBuffer name,
java.nio.ByteBuffer value)
obj - a pointer to an instance of a class. Pass the object containing the instance variable whose value you wish to modifyname - a C string. Pass the name of the instance variable whose value you wish to modifyvalue - the new value for the instance variablepublic static long object_setInstanceVariable(long obj,
java.lang.CharSequence name,
java.nio.ByteBuffer value)
obj - a pointer to an instance of a class. Pass the object containing the instance variable whose value you wish to modifyname - a C string. Pass the name of the instance variable whose value you wish to modifyvalue - the new value for the instance variablepublic static long nobject_getInstanceVariable(long obj,
long name,
long outValue)
public static long object_getInstanceVariable(long obj,
java.nio.ByteBuffer name,
org.lwjgl.PointerBuffer outValue)
obj - a pointer to an instance of a class. Pass the object containing the instance variable whose value you wish to obtainname - a C string. Pass the name of the instance variable whose value you wish to obtainoutValue - on return, contains a pointer to the value of the instance variablepublic static long object_getInstanceVariable(long obj,
java.lang.CharSequence name,
org.lwjgl.PointerBuffer outValue)
obj - a pointer to an instance of a class. Pass the object containing the instance variable whose value you wish to obtainname - a C string. Pass the name of the instance variable whose value you wish to obtainoutValue - on return, contains a pointer to the value of the instance variablepublic static long nobjc_getClass(long name)
objc_getClass(java.nio.ByteBuffer)public static long objc_getClass(java.nio.ByteBuffer name)
objc_getClass is different from objc_lookUpClass(java.nio.ByteBuffer) in that if the class is not registered, objc_getClass calls the class handler callback and then
checks a second time to see whether the class is registered. objc_lookUpClass does not call the class handler callback.
name - the name of the class to look upnil if the class is not registered with the Objective-C runtimepublic static long objc_getClass(java.lang.CharSequence name)
objc_getClass is different from objc_lookUpClass(java.nio.ByteBuffer) in that if the class is not registered, objc_getClass calls the class handler callback and then
checks a second time to see whether the class is registered. objc_lookUpClass does not call the class handler callback.
name - the name of the class to look upnil if the class is not registered with the Objective-C runtimepublic static long nobjc_getMetaClass(long name)
objc_getMetaClass(java.nio.ByteBuffer)public static long objc_getMetaClass(java.nio.ByteBuffer name)
If the definition for the named class is not registered, this function calls the class handler callback and then checks a second time to see if the class is registered. However, every class definition must have a valid metaclass definition, and so the metaclass definition is always returned, whether it’s valid or not.
name - the name of the class to look upnil if the class is not registered with the Objective-C runtimepublic static long objc_getMetaClass(java.lang.CharSequence name)
If the definition for the named class is not registered, this function calls the class handler callback and then checks a second time to see if the class is registered. However, every class definition must have a valid metaclass definition, and so the metaclass definition is always returned, whether it’s valid or not.
name - the name of the class to look upnil if the class is not registered with the Objective-C runtimepublic static long nobjc_lookUpClass(long name)
objc_lookUpClass(java.nio.ByteBuffer)public static long objc_lookUpClass(java.nio.ByteBuffer name)
objc_getClass(java.nio.ByteBuffer) is different from this function in that if the class is not registered, objc_getClass calls the class handler callback and then checks
a second time to see whether the class is registered. This function does not call the class handler callback.
name - the name of the class to look upnil if the class is not registered with the Objective-C runtimepublic static long objc_lookUpClass(java.lang.CharSequence name)
objc_getClass(java.nio.ByteBuffer) is different from this function in that if the class is not registered, objc_getClass calls the class handler callback and then checks
a second time to see whether the class is registered. This function does not call the class handler callback.
name - the name of the class to look upnil if the class is not registered with the Objective-C runtimepublic static long nobjc_getRequiredClass(long name)
objc_getRequiredClass(java.nio.ByteBuffer)public static long objc_getRequiredClass(java.nio.ByteBuffer name)
This function is the same as objc_getClass(java.nio.ByteBuffer), but kills the process if the class is not found.
This function is used by ZeroLink, where failing to find a class would be a compile-time link error without ZeroLink.
name - the name of the class to look uppublic static long objc_getRequiredClass(java.lang.CharSequence name)
This function is the same as objc_getClass(java.nio.ByteBuffer), but kills the process if the class is not found.
This function is used by ZeroLink, where failing to find a class would be a compile-time link error without ZeroLink.
name - the name of the class to look uppublic static int nobjc_getClassList(long buffer,
int bufferCount)
objc_getClassList(org.lwjgl.PointerBuffer)bufferCount - 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.public static int objc_getClassList(@Nullable
org.lwjgl.PointerBuffer buffer)
The Objective-C runtime library automatically registers all the classes defined in your source code. You can create class definitions at runtime and
register them with the objc_allocateClassPair(long, java.nio.ByteBuffer, long) and objc_registerClassPair(long) functions.
You cannot assume that class objects you get from this function are classes that inherit from NSObject, so you cannot safely call any methods on such classes without detecting that the method is implemented first.
buffer - 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.public static long nobjc_copyClassList(long outCount)
objc_copyClassList()outCount - an integer pointer used to store the number of classes returned by this function in the list. This parameter may be nil@Nullable public static org.lwjgl.PointerBuffer objc_copyClassList()
nil terminated array of classes. You must free the array with free()public static long nclass_getName(long cls)
class_getName(long)@Nullable public static java.lang.String class_getName(long cls)
cls - a class objectpublic static boolean class_isMetaClass(long cls)
public static long class_getSuperclass(long cls)
cls - a class objectpublic static int class_getVersion(long cls)
You can use the version number of the class definition to provide versioning of the interface that your class represents to other classes. This is especially useful for object serialization (that is, archiving of the object in a flattened form), where it is important to recognize changes to the layout of the instance variables in different class-definition versions.
Classes derived from the Foundation framework NSObject class can obtain the class-definition version number using the getVersion class method, which is implemented using the class_getVersion function.
cls - a pointer to an Class data structure. Pass the class definition for which you wish to obtain the versionpublic static void class_setVersion(long cls,
int version)
You can use the version number of the class definition to provide versioning of the interface that your class represents to other classes. This is especially useful for object serialization (that is, archiving of the object in a flattened form), where it is important to recognize changes to the layout of the instance variables in different class-definition versions.
Classes derived from the Foundation framework NSObject class can set the class-definition version number using the setVersion: class method, which is implemented using the class_setVersion function.
cls - a pointer to an Class data structure. Pass the class definition for which you wish to set the versionversion - the new version number of the class definitionpublic static long class_getInstanceSize(long cls)
cls - a class objectcls, or 0 if cls is Nilpublic static long nclass_getInstanceVariable(long cls,
long name)
class_getInstanceVariable(long, java.nio.ByteBuffer)public static long class_getInstanceVariable(long cls,
java.nio.ByteBuffer name)
cls - the class whose instance variable you wish to obtainname - the name of the instance variable definition to obtainpublic static long class_getInstanceVariable(long cls,
java.lang.CharSequence name)
cls - the class whose instance variable you wish to obtainname - the name of the instance variable definition to obtainpublic static long nclass_getClassVariable(long cls,
long name)
class_getClassVariable(long, java.nio.ByteBuffer)public static long class_getClassVariable(long cls,
java.nio.ByteBuffer name)
cls - the class definition whose class variable you wish to obtainname - the name of the class variable definition to obtainpublic static long class_getClassVariable(long cls,
java.lang.CharSequence name)
cls - the class definition whose class variable you wish to obtainname - the name of the class variable definition to obtainpublic static long nclass_copyIvarList(long cls,
long outCount)
class_copyIvarList(long)outCount - on return, contains the length of the returned array. If outCount is NULL, the length is not returned@Nullable public static org.lwjgl.PointerBuffer class_copyIvarList(long cls)
cls - the class to inspect*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.
public static long class_getInstanceMethod(long cls,
long name)
Note that this function searches superclasses for implementations, whereas class_copyMethodList(long) does not.
cls - the class you want to inspectname - the selector of the method you want to retrievecls, or NULL if the
specified class or its superclasses do not contain an instance method with the specified selector.public static long class_getClassMethod(long cls,
long name)
Note that this function searches superclasses for implementations, whereas class_copyMethodList(long) does not.
cls - a pointer to a class definition. Pass the class that contains the method you want to retrievename - a pointer of type SEL. Pass the selector of the method you want to retrievename 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.public static long class_getMethodImplementation(long cls,
long name)
class_getMethodImplementation may be faster than method_getImplementation(class_getInstanceMethod(cls, name)).
The function pointer returned may be a function internal to the runtime instead of an actual method implementation. For example, if instances of the class do not respond to the selector, the function pointer returned will be part of the runtime's message forwarding machinery.
cls - the class you want to inspectname - a selector[object name] were called with an instance of the class, or NULL if cls is Nilpublic static boolean class_respondsToSelector(long cls,
long name)
You should usually use NSObject's respondsToSelector: or instancesRespondToSelector: methods instead of this function.
public static long nclass_copyMethodList(long cls,
long outCount)
class_copyMethodList(long)outCount - on return, contains the length of the returned array. If outCount is NULL, the length is not returned@Nullable public static org.lwjgl.PointerBuffer class_copyMethodList(long cls)
cls - the class you want to inspect*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.
public static boolean class_conformsToProtocol(long cls,
long protocol)
You should usually use NSObject's conformsToProtocol: method instead of this function.
public static long nclass_copyProtocolList(long cls,
long outCount)
class_copyProtocolList(long)outCount - on return, contains the length of the returned array. If outCount is NULL, the length is not returned@Nullable public static org.lwjgl.PointerBuffer class_copyProtocolList(long cls)
cls - the class you want to inspect*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.
public static long nclass_getProperty(long cls,
long name)
class_getProperty(long, java.nio.ByteBuffer)public static long class_getProperty(long cls,
java.nio.ByteBuffer name)
cls - the class you want to inspectname - a C string. Pass the name of the instance variable whose value you wish to modify.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.public static long class_getProperty(long cls,
java.lang.CharSequence name)
cls - the class you want to inspectname - a C string. Pass the name of the instance variable whose value you wish to modify.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.public static long nclass_copyPropertyList(long cls,
long outCount)
class_copyPropertyList(long)outCount - on return, contains the length of the returned array. If outCount is NULL, the length is not returned@Nullable public static org.lwjgl.PointerBuffer class_copyPropertyList(long cls)
cls - the class you want to inspectobjc_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.
public static long nclass_getIvarLayout(long cls)
class_getIvarLayout(long)@Nullable public static java.lang.String class_getIvarLayout(long cls)
cls - the class to inspectclspublic static long nclass_getWeakIvarLayout(long cls)
class_getWeakIvarLayout(long)@Nullable public static java.lang.String class_getWeakIvarLayout(long cls)
cls - the class to inspectclspublic static boolean nclass_addMethod(long cls,
long name,
long imp,
long types)
class_addMethod(long, long, long, java.nio.ByteBuffer)public static boolean class_addMethod(long cls,
long name,
long imp,
java.nio.ByteBuffer types)
class_addMethod will add an override of a superclass's implementation, but will not replace an existing implementation in this class. To change an
existing implementation, use method_setImplementation(long, long).
An Objective-C method is simply a C function that takes at least two arguments – self and _cmd. For example, given the following
function:
void myMethodIMP(id self, SEL _cmd)
{
// implementation ....
}
you can dynamically add it to a class as a method (called resolveThisMethodDynamically) like this:
class_addMethod([self class], @selector(resolveThisMethodDynamically), (IMP) myMethodIMP, "v@:");cls - the class to which to add a methodname - a selector that specifies the name of the method being addedimp - a function which is the implementation of the new method. The function must take at least two arguments – self and _cmd.types - 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).YES if the method was added successfully, otherwise NO (for example, the class already contains a method implementation with that name)public static boolean class_addMethod(long cls,
long name,
long imp,
java.lang.CharSequence types)
class_addMethod will add an override of a superclass's implementation, but will not replace an existing implementation in this class. To change an
existing implementation, use method_setImplementation(long, long).
An Objective-C method is simply a C function that takes at least two arguments – self and _cmd. For example, given the following
function:
void myMethodIMP(id self, SEL _cmd)
{
// implementation ....
}
you can dynamically add it to a class as a method (called resolveThisMethodDynamically) like this:
class_addMethod([self class], @selector(resolveThisMethodDynamically), (IMP) myMethodIMP, "v@:");cls - the class to which to add a methodname - a selector that specifies the name of the method being addedimp - a function which is the implementation of the new method. The function must take at least two arguments – self and _cmd.types - 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).YES if the method was added successfully, otherwise NO (for example, the class already contains a method implementation with that name)public static long nclass_replaceMethod(long cls,
long name,
long imp,
long types)
class_replaceMethod(long, long, long, java.nio.ByteBuffer)public static long class_replaceMethod(long cls,
long name,
long imp,
java.nio.ByteBuffer types)
This function behaves in two different ways:
cls - the class you want to modifyname - a selector that identifies the method whose implementation you want to replaceimp - the new implementation for the method identified by name for the class identified by clstypes - 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).name for the class identified by clspublic static long class_replaceMethod(long cls,
long name,
long imp,
java.lang.CharSequence types)
This function behaves in two different ways:
cls - the class you want to modifyname - a selector that identifies the method whose implementation you want to replaceimp - the new implementation for the method identified by name for the class identified by clstypes - 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).name for the class identified by clspublic static boolean nclass_addIvar(long cls,
long name,
long size,
byte alignment,
long types)
class_addIvar(long, java.nio.ByteBuffer, long, byte, java.nio.ByteBuffer)public static boolean class_addIvar(long cls,
java.nio.ByteBuffer name,
long size,
byte alignment,
java.nio.ByteBuffer types)
This function may only be called after objc_allocateClassPair(long, java.nio.ByteBuffer, long) and before objc_registerClassPair(long). Adding an instance variable to an existing class
is not supported.
The class must not be a metaclass. Adding an instance variable to a metaclass is not supported.
The instance variable's minimum alignment in bytes is 1<<align. The minimum alignment of an instance variable depends on the ivar's type and
the machine architecture. For variables of any pointer type, pass log2(sizeof(pointer_type)).
public static boolean class_addIvar(long cls,
java.lang.CharSequence name,
long size,
byte alignment,
java.lang.CharSequence types)
This function may only be called after objc_allocateClassPair(long, java.nio.ByteBuffer, long) and before objc_registerClassPair(long). Adding an instance variable to an existing class
is not supported.
The class must not be a metaclass. Adding an instance variable to a metaclass is not supported.
The instance variable's minimum alignment in bytes is 1<<align. The minimum alignment of an instance variable depends on the ivar's type and
the machine architecture. For variables of any pointer type, pass log2(sizeof(pointer_type)).
public static boolean class_addProtocol(long cls,
long protocol)
public static boolean nclass_addProperty(long cls,
long name,
long attributes,
int attributeCount)
class_addProperty(long, java.nio.ByteBuffer, org.lwjgl.system.macosx.ObjCPropertyAttribute.Buffer)attributeCount - the number of attributes in attributespublic static boolean class_addProperty(long cls,
java.nio.ByteBuffer name,
ObjCPropertyAttribute.Buffer attributes)
public static boolean class_addProperty(long cls,
java.lang.CharSequence name,
ObjCPropertyAttribute.Buffer attributes)
public static void nclass_replaceProperty(long cls,
long name,
long attributes,
int attributeCount)
class_replaceProperty(long, java.nio.ByteBuffer, org.lwjgl.system.macosx.ObjCPropertyAttribute.Buffer)attributeCount - the number of attributes in attributespublic static void class_replaceProperty(long cls,
java.nio.ByteBuffer name,
ObjCPropertyAttribute.Buffer attributes)
cls - the class to modifyname - the name of the propertyattributes - an array of property attributespublic static void class_replaceProperty(long cls,
java.lang.CharSequence name,
ObjCPropertyAttribute.Buffer attributes)
cls - the class to modifyname - the name of the propertyattributes - an array of property attributespublic static void nclass_setIvarLayout(long cls,
long layout)
class_setIvarLayout(long, java.nio.ByteBuffer)public static void class_setIvarLayout(long cls,
java.nio.ByteBuffer layout)
cls - the class to modifylayout - the layout of the Ivars for clspublic static void class_setIvarLayout(long cls,
java.lang.CharSequence layout)
cls - the class to modifylayout - the layout of the Ivars for clspublic static void nclass_setWeakIvarLayout(long cls,
long layout)
class_setWeakIvarLayout(long, java.nio.ByteBuffer)public static void class_setWeakIvarLayout(long cls,
java.nio.ByteBuffer layout)
cls - the class to modifylayout - the layout of the weak Ivars for clspublic static void class_setWeakIvarLayout(long cls,
java.lang.CharSequence layout)
cls - the class to modifylayout - the layout of the weak Ivars for clspublic static long class_createInstance(long cls,
long extraBytes)
cls - the class that you want to allocate an instance ofextraBytes - 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.clspublic static long nobjc_constructInstance(long cls,
long bytes)
objc_constructInstance(long, java.nio.ByteBuffer)public static long objc_constructInstance(long cls,
@Nullable
java.nio.ByteBuffer bytes)
cls - the class that you want to allocate an instance ofbytes - 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.cls at bytes, if successful; otherwise nil (for example, if cls or bytes are themselves nil)public static long objc_destructInstance(long obj)
This method does nothing if obj is nil.
The garbage collector does not call this function. As a result, if you edit this function, you should also edit finalize. That said, Core Foundation and other clients do call this function under garbage collection.
obj - the instance to destroypublic static long nobjc_allocateClassPair(long superclass,
long name,
long extraBytes)
objc_allocateClassPair(long, java.nio.ByteBuffer, long)public static long objc_allocateClassPair(long superclass,
java.nio.ByteBuffer name,
long extraBytes)
You can get a pointer to the new metaclass by calling object_getClass(newClass).
To create a new class, start by calling objc_allocateClassPair. Then set the class's attributes with functions like class_addMethod(long, long, long, java.nio.ByteBuffer) and
class_addIvar(long, java.nio.ByteBuffer, long, byte, java.nio.ByteBuffer). When you are done building the class, call objc_registerClassPair(long). The new class is now ready for use.
Instance methods and instance variables should be added to the class itself. Class methods should be added to the metaclass.
superclass - the class to use as the new class's superclass, or Nil to create a new root classname - the string to use as the new class's name. The string will be copied.extraBytes - the number of bytes to allocate for indexed ivars at the end of the class and metaclass objects. This should usually be 0.public static long objc_allocateClassPair(long superclass,
java.lang.CharSequence name,
long extraBytes)
You can get a pointer to the new metaclass by calling object_getClass(newClass).
To create a new class, start by calling objc_allocateClassPair. Then set the class's attributes with functions like class_addMethod(long, long, long, java.nio.ByteBuffer) and
class_addIvar(long, java.nio.ByteBuffer, long, byte, java.nio.ByteBuffer). When you are done building the class, call objc_registerClassPair(long). The new class is now ready for use.
Instance methods and instance variables should be added to the class itself. Class methods should be added to the metaclass.
superclass - the class to use as the new class's superclass, or Nil to create a new root classname - the string to use as the new class's name. The string will be copied.extraBytes - the number of bytes to allocate for indexed ivars at the end of the class and metaclass objects. This should usually be 0.public static void objc_registerClassPair(long cls)
objc_allocateClassPair(long, java.nio.ByteBuffer, long).cls - the class you want to registerpublic static void objc_disposeClassPair(long cls)
Do not call this function if instances of the cls class or any subclass exist.
cls - the class to be destroyed. This class must have been allocated using objc_allocateClassPair(long, java.nio.ByteBuffer, long).public static long method_getName(long m)
To get the method name as a C string, call sel_getName(method_getName(method)).
m - the method to inspectpublic static long method_getImplementation(long m)
m - the method to inspectpublic static long nmethod_getTypeEncoding(long m)
method_getTypeEncoding(long)@Nullable public static java.lang.String method_getTypeEncoding(long m)
m - the method to inspectNULLpublic static int method_getNumberOfArguments(long m)
m - a pointer to a Method data structure. Pass the method in question.public static long nmethod_copyReturnType(long m)
method_copyReturnType(long)@Nullable public static java.lang.String method_copyReturnType(long m)
m - the method to inspectpublic static long nmethod_copyArgumentType(long m,
int index)
method_copyArgumentType(long, int)@Nullable
public static java.lang.String method_copyArgumentType(long m,
int index)
m - the method to inspectindex - the index of the parameter to inspectindex, or NULL if method has no parameter index index. You must free the
string with free().public static void nmethod_getReturnType(long m,
long dst,
long dst_len)
method_getReturnType(long, java.nio.ByteBuffer)dst_len - the maximum number of characters that can be stored in dstpublic static void method_getReturnType(long m,
java.nio.ByteBuffer dst)
The method's return type string is copied to dst. dst is filled as if strncpy(dst, parameter_type, dst_len) were called.
m - the method to inspectdst - the reference string to store the descriptionpublic static java.lang.String method_getReturnType(long m,
long dst_len)
The method's return type string is copied to dst. dst is filled as if strncpy(dst, parameter_type, dst_len) were called.
m - the method to inspectdst_len - the maximum number of characters that can be stored in dstpublic static void nmethod_getArgumentType(long m,
int index,
long dst,
long dst_len)
method_getArgumentType(long, int, java.nio.ByteBuffer)dst_len - the maximum number of characters that can be stored in dstpublic static void method_getArgumentType(long m,
int index,
java.nio.ByteBuffer dst)
The parameter type string is copied to dst. dst is filled as if strncpy(dst, parameter_type, dst_len) were called. If the
method contains no parameter with that index, dst is filled as if strncpy(dst, "", dst_len) were called.
m - the method you want to inquire aboutindex - the index of the parameter you want to inquire aboutdst - the reference string to store the descriptionpublic static java.lang.String method_getArgumentType(long m,
int index,
long dst_len)
The parameter type string is copied to dst. dst is filled as if strncpy(dst, parameter_type, dst_len) were called. If the
method contains no parameter with that index, dst is filled as if strncpy(dst, "", dst_len) were called.
m - the method you want to inquire aboutindex - the index of the parameter you want to inquire aboutdst_len - the maximum number of characters that can be stored in dstpublic static long method_setImplementation(long m,
long imp)
m - the method for which to set an implementationimp - the implemention to set to this methodpublic static void method_exchangeImplementations(long m1,
long m2)
m1 - the method to exchange with second methodm2 - the method to exchange with first methodpublic static long nivar_getName(long v)
ivar_getName(long)@Nullable public static java.lang.String ivar_getName(long v)
v - the instance variablepublic static long nivar_getTypeEncoding(long v)
ivar_getTypeEncoding(long)@Nullable public static java.lang.String ivar_getTypeEncoding(long v)
v - the instance variablepublic static long ivar_getOffset(long v)
For instance variables of type id or other object types, call object_getIvar(long, long) and object_setIvar(long, long, long) instead of using this offset to access
the instance variable data directly.
v - the instance variablevpublic static long nproperty_getName(long property)
property_getName(long)@Nullable public static java.lang.String property_getName(long property)
property - the property you want to inquire aboutpublic static long nproperty_getAttributes(long property)
property_getAttributes(long)@Nullable public static java.lang.String property_getAttributes(long property)
property - a propertypublic static long nproperty_copyAttributeList(long property,
long outCount)
property_copyAttributeList(long)outCount - the number of attributes returned in the array@Nullable public static ObjCPropertyAttribute.Buffer property_copyAttributeList(long property)
property - the property whose attributes you want to copypublic static long nproperty_copyAttributeValue(long property,
long attributeName)
property_copyAttributeValue(long, java.nio.ByteBuffer)@Nullable
public static java.lang.String property_copyAttributeValue(long property,
java.nio.ByteBuffer attributeName)
property - the property whose value you are interested inattributeName - a C string representing the name of the attributeattributeName attribute, if one exists in property; otherwise, nil. You must free the returned value string
with free().@Nullable
public static java.lang.String property_copyAttributeValue(long property,
java.lang.CharSequence attributeName)
property - the property whose value you are interested inattributeName - a C string representing the name of the attributeattributeName attribute, if one exists in property; otherwise, nil. You must free the returned value string
with free().public static long nobjc_getProtocol(long name)
objc_getProtocol(java.nio.ByteBuffer)public static long objc_getProtocol(java.nio.ByteBuffer name)
This function acquires the runtime lock.
name - the name of a protocolname{, or NULL if no protocol named name could be foundpublic static long objc_getProtocol(java.lang.CharSequence name)
This function acquires the runtime lock.
name - the name of a protocolname{, or NULL if no protocol named name could be foundpublic static long nobjc_copyProtocolList(long outCount)
objc_copyProtocolList()outCount - upon return, contains the number of protocols in the returned array@Nullable public static org.lwjgl.PointerBuffer objc_copyProtocolList()
*outCount pointers followed by a NULL terminator. You must free the
list with free().public static boolean protocol_conformsToProtocol(long proto,
long other)
One protocol can incorporate other protocols using the same syntax that classes use to adopt a protocol:
@protocol ProtocolName < protocol list >
All the protocols listed between angle brackets are considered part of the ProtocolName protocol.
public static boolean protocol_isEqual(long proto,
long other)
public static long nprotocol_getName(long p)
protocol_getName(long)@Nullable public static java.lang.String protocol_getName(long p)
p - a protocolp as a C stringpublic static void nprotocol_getMethodDescription(long p,
long aSel,
boolean isRequiredMethod,
boolean isInstanceMethod,
long __functionAddress,
long __result)
public static void nprotocol_getMethodDescription(long p,
long aSel,
boolean isRequiredMethod,
boolean isInstanceMethod,
long __result)
public static ObjCMethodDescription protocol_getMethodDescription(long p, long aSel, boolean isRequiredMethod, boolean isInstanceMethod, ObjCMethodDescription __result)
p - a protocolaSel - a selectorisRequiredMethod - a Boolean value that indicates whether aSel is a required methodisInstanceMethod - a Boolean value that indicates whether aSel is a instance method__result - 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}.
public static long nprotocol_copyMethodDescriptionList(long p,
boolean isRequiredMethod,
boolean isInstanceMethod,
long outCount)
protocol_copyMethodDescriptionList(long, boolean, boolean)outCount - upon return, contains the number of method description structures in the returned array@Nullable public static ObjCMethodDescription.Buffer protocol_copyMethodDescriptionList(long p, boolean isRequiredMethod, boolean isInstanceMethod)
Methods in other protocols adopted by this protocol are not included.
p - a protocolisRequiredMethod - a Boolean value that indicates whether returned methods should be required methods (pass YES to specify required methods)isInstanceMethod - a Boolean value that indicates whether returned methods should be instance methods (pass YES to specify instance methods)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.
public static long nprotocol_getProperty(long proto,
long name,
boolean isRequiredProperty,
boolean isInstanceProperty)
protocol_getProperty(long, java.nio.ByteBuffer, boolean, boolean)public static long protocol_getProperty(long proto,
java.nio.ByteBuffer name,
boolean isRequiredProperty,
boolean isInstanceProperty)
proto - a protocolname - the name of a propertyisRequiredProperty - a Boolean value that indicates whether name is a required propertyisInstanceProperty - a Boolean value that indicates whether name is a instance propertyname, isRequiredProperty, and isInstanceProperty for proto, or NULL if none of
proto's properties meets the specificationpublic static long protocol_getProperty(long proto,
java.lang.CharSequence name,
boolean isRequiredProperty,
boolean isInstanceProperty)
proto - a protocolname - the name of a propertyisRequiredProperty - a Boolean value that indicates whether name is a required propertyisInstanceProperty - a Boolean value that indicates whether name is a instance propertyname, isRequiredProperty, and isInstanceProperty for proto, or NULL if none of
proto's properties meets the specificationpublic static long nprotocol_copyPropertyList(long proto,
long outCount)
protocol_copyPropertyList(long)outCount - upon return, contains the number of elements in the returned array@Nullable public static org.lwjgl.PointerBuffer protocol_copyPropertyList(long proto)
proto - a protocolproto. 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.
public static long nprotocol_copyProtocolList(long proto,
long outCount)
protocol_copyProtocolList(long)outCount - upon return, contains the number of elements in the returned array@Nullable public static org.lwjgl.PointerBuffer protocol_copyProtocolList(long proto)
proto - a protocolproto. 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.
public static long nobjc_allocateProtocol(long name)
objc_allocateProtocol(java.nio.ByteBuffer)public static long objc_allocateProtocol(java.nio.ByteBuffer name)
You must register the returned protocol instance with the objc_registerProtocol(long) function before you can use it.
There is no dispose method associated with this function.
name - the name of the protocol you want to createnil if a protocol with the same name as name already existspublic static long objc_allocateProtocol(java.lang.CharSequence name)
You must register the returned protocol instance with the objc_registerProtocol(long) function before you can use it.
There is no dispose method associated with this function.
name - the name of the protocol you want to createnil if a protocol with the same name as name already existspublic static void objc_registerProtocol(long proto)
When you create a new protocol using the objc_allocateProtocol(java.nio.ByteBuffer), you then register it with the Objective-C runtime by calling this function. After a
protocol is successfully registered, it is immutable and ready to use.
proto - the protocol you want to register with the Objective-C runtimepublic static void nprotocol_addMethodDescription(long proto,
long name,
long types,
boolean isRequiredMethod,
boolean isInstanceMethod)
public static void protocol_addMethodDescription(long proto,
long name,
java.nio.ByteBuffer types,
boolean isRequiredMethod,
boolean isInstanceMethod)
To add a method to a protocol using this function, the protocol must be under construction. That is, you must add any methods to proto before you
register it with the Objective-C runtime (via the objc_registerProtocol(long) function).
proto - the protocol you want to add a method toname - the name of the method you want to addtypes - a C string representing the signature of the method you want to addisRequiredMethod - 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.isInstanceMethod - 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.public static void protocol_addMethodDescription(long proto,
long name,
java.lang.CharSequence types,
boolean isRequiredMethod,
boolean isInstanceMethod)
To add a method to a protocol using this function, the protocol must be under construction. That is, you must add any methods to proto before you
register it with the Objective-C runtime (via the objc_registerProtocol(long) function).
proto - the protocol you want to add a method toname - the name of the method you want to addtypes - a C string representing the signature of the method you want to addisRequiredMethod - 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.isInstanceMethod - 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.public static void protocol_addProtocol(long proto,
long addition)
The protocol you want to add to (proto) must be under construction – allocated but not yet registered with the Objective-C runtime. The
protocol you want to add (addition) must be registered already.
proto - the protocol you want to add the registered protocol toaddition - the registered protocol you want to add to protopublic static void nprotocol_addProperty(long proto,
long name,
long attributes,
int attributeCount,
boolean isRequiredProperty,
boolean isInstanceProperty)
protocol_addProperty(long, java.nio.ByteBuffer, org.lwjgl.system.macosx.ObjCPropertyAttribute.Buffer, boolean, boolean)attributeCount - the number of properties in attributespublic static void protocol_addProperty(long proto,
java.nio.ByteBuffer name,
ObjCPropertyAttribute.Buffer attributes,
boolean isRequiredProperty,
boolean isInstanceProperty)
The protocol you want to add the property to must be under construction – allocated but not yet registered with the Objective-C runtime (via the
objc_registerProtocol(long) function).
proto - the protocol you want to add a property toname - the name of the property you want to add.attributes - an array of property attributesisRequiredProperty - 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.isInstanceProperty - 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.public static void protocol_addProperty(long proto,
java.lang.CharSequence name,
ObjCPropertyAttribute.Buffer attributes,
boolean isRequiredProperty,
boolean isInstanceProperty)
The protocol you want to add the property to must be under construction – allocated but not yet registered with the Objective-C runtime (via the
objc_registerProtocol(long) function).
proto - the protocol you want to add a property toname - the name of the property you want to add.attributes - an array of property attributesisRequiredProperty - 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.isInstanceProperty - 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.public static long nobjc_copyImageNames(long outCount)
objc_copyImageNames()outCount - the number of names in the returned array@Nullable public static org.lwjgl.PointerBuffer objc_copyImageNames()
public static long nclass_getImageName(long cls)
class_getImageName(long)@Nullable public static java.lang.String class_getImageName(long cls)
cls - the class you are inquiring aboutcls class.public static long nobjc_copyClassNamesForImage(long image,
long outCount)
objc_copyClassNamesForImage(java.nio.ByteBuffer)outCount - the number of names in the returned array@Nullable public static org.lwjgl.PointerBuffer objc_copyClassNamesForImage(java.nio.ByteBuffer image)
image - the library or framework you are inquiring about@Nullable public static org.lwjgl.PointerBuffer objc_copyClassNamesForImage(java.lang.CharSequence image)
image - the library or framework you are inquiring aboutpublic static long nsel_getName(long sel)
sel_getName(long)@Nullable public static java.lang.String sel_getName(long sel)
sel - a pointer of type SEL. Pass the selector whose name you wish to determine.public static long nsel_getUid(long str)
sel_getUid(java.nio.ByteBuffer)public static long sel_getUid(java.nio.ByteBuffer str)
The implementation of this method is identical to the implementation of sel_registerName(java.nio.ByteBuffer).
str - a pointer to a C string. Pass the name of the method you wish to registerpublic static long sel_getUid(java.lang.CharSequence str)
The implementation of this method is identical to the implementation of sel_registerName(java.nio.ByteBuffer).
str - a pointer to a C string. Pass the name of the method you wish to registerpublic static long nsel_registerName(long str)
sel_registerName(java.nio.ByteBuffer)public static long sel_registerName(java.nio.ByteBuffer str)
You must register a method name with the Objective-C runtime system to obtain the method’s selector before you can add the method to a class definition. If the method name has already been registered, this function simply returns the selector.
str - a pointer to a C string. Pass the name of the method you wish to registerpublic static long sel_registerName(java.lang.CharSequence str)
You must register a method name with the Objective-C runtime system to obtain the method’s selector before you can add the method to a class definition. If the method name has already been registered, this function simply returns the selector.
str - a pointer to a C string. Pass the name of the method you wish to registerpublic static boolean sel_isEqual(long lhs,
long rhs)
sel_isEqual is equivalent to ==.
public static void objc_enumerationMutation(long obj)
The compiler inserts this function when it detects that an object is mutated during a foreach iteration. The function is called when a mutation occurs,
and the enumeration mutation handler is enacted if it is set up (via the objc_setEnumerationMutationHandler(org.lwjgl.system.macosx.EnumerationMutationHandlerI) function). If the handler is not set up,
a fatal error occurs.
obj - the object being mutatedpublic static void nobjc_setEnumerationMutationHandler(long handler)
public static void objc_setEnumerationMutationHandler(EnumerationMutationHandlerI handler)
handler - a function pointer to the new mutation handlerpublic static long imp_implementationWithBlock(long block)
block - 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. You must dispose of the returned IMP using the function.public static long imp_getBlock(long anImp)
imp_implementationWithBlock(long).anImp - the IMP that calls this blockanImppublic static boolean imp_removeBlock(long anImp)
imp_implementationWithBlock(long), and releases the copy of the block that was created.anImp - an IMP that was created using the imp_implementationWithBlock(long) function.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).public static long nobjc_loadWeak(long location)
objc_loadWeak(org.lwjgl.PointerBuffer)public static long objc_loadWeak(@Nullable
org.lwjgl.PointerBuffer location)
This function loads the object referenced by a weak pointer and returns it after retaining and autoreleasing the object. As a result, the object stays
alive long enough for the caller to use it. This function is typically used anywhere a __weak variable is used in an expression.
public static long nobjc_storeWeak(long location,
long obj)
objc_storeWeak(org.lwjgl.PointerBuffer, long)public static long objc_storeWeak(org.lwjgl.PointerBuffer location,
long obj)
__weak variable.
This function is typically used anywhere a __weak variable is the target of an assignment.
location - the address of the weak pointerobj - the new object you want the weak pointer to now point toobj)public static void objc_setAssociatedObject(long object,
long key,
long value,
long policy)
object - the source object for the associationkey - the key for the associationvalue - the value to associate with the key key for object. Pass nil to clear an existing association.policy - the policy for the association. One of:OBJC_ASSOCIATION_ASSIGN | OBJC_ASSOCIATION_RETAIN_NONATOMIC | OBJC_ASSOCIATION_COPY_NONATOMIC |
OBJC_ASSOCIATION_RETAIN | OBJC_ASSOCIATION_COPY |
public static long objc_getAssociatedObject(long object,
long key)
object - the source object for the associationkey - the key for the associationkey for object.public static void objc_removeAssociatedObjects(long object)
The main purpose of this function is to make it easy to return an object to a "pristine state". You should not use this function for general removal of
associations from objects, since it also removes associations that other clients may have added to the object. Typically you should use
objc_setAssociatedObject(long, long, long, long) with a nil value to clear an association.
object - an object that maintains associated objectsCopyright LWJGL. All Rights Reserved. License terms.