public class CCodegenUtilities
extends java.lang.Object
Constructor and Description |
---|
CCodegenUtilities() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getIncludeBlock(java.lang.String file,
java.lang.String constant)
Return a code block to include a file.
|
static java.lang.String |
jniDeleteLocalRef(java.lang.String reference,
boolean targetCpp)
Return a code block to delete a jni local reference.
|
static java.lang.String |
jniFindClass(java.lang.String className,
boolean targetCpp)
Return a code block to find a jni class.
|
static java.lang.String |
jniGetArrayElements(java.lang.String type,
java.lang.String arrayName,
boolean targetCpp)
Return a code block to get the elements of a jni array.
|
static java.lang.String |
jniGetMethodID(java.lang.String jniClass,
java.lang.String name,
java.lang.String signature,
boolean targetCpp)
Return a code block to get the jni id of a Java method.
|
static java.lang.String |
jniGetObjectArrayElement(java.lang.String arrayName,
java.lang.String index,
boolean targetCpp)
Return a code block to get an element from a jni array.
|
static java.lang.String |
jniNewArray(java.lang.String type,
java.lang.String size,
boolean targetCpp)
Return a code block to create a new jni array.
|
static java.lang.String |
jniNewObject(java.lang.String objectType,
java.lang.String methodID,
java.lang.String[] arguments,
boolean targetCpp)
Return a code block to create a new Java object using jni.
|
static java.lang.String |
jniNewObjectArray(java.lang.String size,
java.lang.String objectType,
boolean targetCpp)
Return a code block to create a new jni object array.
|
static java.lang.String |
jniReleaseArrayElements(java.lang.String type,
java.lang.String arrayName,
java.lang.String elementsPointer,
boolean targetCpp)
Return a code block to release elements from a jni array.
|
static java.lang.String |
jniSetArrayRegion(java.lang.String type,
java.lang.String arrayName,
java.lang.String index,
java.lang.String length,
java.lang.String valuePointer,
boolean targetCpp)
Return a code block to set elements in a jniarray.
|
static java.lang.String |
jniSetObjectArrayElement(java.lang.String arrayName,
java.lang.String index,
java.lang.String value,
boolean targetCpp)
Return a code block to set an element in a jni object array.
|
public static java.lang.String getIncludeBlock(java.lang.String file, java.lang.String constant)
file
- The name of the file.constant
- The name of the constant to check to see if the file
has already been included.public static java.lang.String jniDeleteLocalRef(java.lang.String reference, boolean targetCpp)
reference
- The reference to delete.targetCpp
- Boolean indicating whether the target language is C or C++.public static java.lang.String jniFindClass(java.lang.String className, boolean targetCpp)
className
- The name of the class to find.targetCpp
- Boolean indicating whether the target language is C or C++.public static java.lang.String jniGetArrayElements(java.lang.String type, java.lang.String arrayName, boolean targetCpp)
type
- The type, with a capital first letter, of the array elements.arrayName
- The name of the jni array.targetCpp
- Boolean indicating whether the target language is C or C++.public static java.lang.String jniGetMethodID(java.lang.String jniClass, java.lang.String name, java.lang.String signature, boolean targetCpp)
jniClass
- The Java class whose method to find.name
- The name of the method to find.signature
- The signature of the method to find.targetCpp
- Boolean indicating whether the target language is C or C++.cid = (*env)->GetMethodID(env, stringClass, "<init>", "([C)V");
public static java.lang.String jniGetObjectArrayElement(java.lang.String arrayName, java.lang.String index, boolean targetCpp)
arrayName
- The name of the jni array.index
- The index in the jni array to find the element.targetCpp
- Boolean indicating whether the target language is C or C++.public static java.lang.String jniNewArray(java.lang.String type, java.lang.String size, boolean targetCpp)
type
- The type of the array.size
- The number of elements of the array.targetCpp
- Boolean indicating whether the target language is C or C++.public static java.lang.String jniNewObject(java.lang.String objectType, java.lang.String methodID, java.lang.String[] arguments, boolean targetCpp)
objectType
- The type of the object.methodID
- The jni id of the object's constructor.arguments
- A list of arguments to the constructor.targetCpp
- Boolean indicating whether the target language is C or C++.public static java.lang.String jniNewObjectArray(java.lang.String size, java.lang.String objectType, boolean targetCpp)
size
- The number of elements of the array.objectType
- The type of object in the array.targetCpp
- Boolean indicating whether the target language is C or C++.public static java.lang.String jniReleaseArrayElements(java.lang.String type, java.lang.String arrayName, java.lang.String elementsPointer, boolean targetCpp)
type
- The type of object in the array.arrayName
- The name of the array.elementsPointer
- The pointer to the element to remove.targetCpp
- Boolean indicating whether the target language is C or C++.public static java.lang.String jniSetArrayRegion(java.lang.String type, java.lang.String arrayName, java.lang.String index, java.lang.String length, java.lang.String valuePointer, boolean targetCpp)
type
- The type of the array.arrayName
- The name of the array.index
- The index of the first element to set.length
- The number of elements to set.valuePointer
- The value to set the elements.targetCpp
- Boolean indicating whether the target language is C or C++.public static java.lang.String jniSetObjectArrayElement(java.lang.String arrayName, java.lang.String index, java.lang.String value, boolean targetCpp)
arrayName
- The name of the object array.index
- The index of the element to set.value
- The value to set the element.targetCpp
- Boolean indicating whether the target language is C or C++.