/** * File generated by Jenny -- https://github.com/LanderlYoung/Jenny * * DO NOT EDIT THIS FILE. * * For bug report, please refer to github issue tracker https://github.com/LanderlYoung/Jenny/issues. */ /* C++ header file for class io/github/landerlyoung/jennysampleapp/ComputeIntensiveClass */ #pragma once #include namespace ComputeIntensiveClass { // DO NOT modify static constexpr auto FULL_CLASS_NAME = u8"io/github/landerlyoung/jennysampleapp/ComputeIntensiveClass"; static constexpr auto LOG_TAG = u8"ComputeIntensiveClass"; static constexpr auto KEY_WHERE_ARE_YOUT_FROM = u8"where_are_you_from"; static constexpr jint IDEL = -1; static constexpr jint BUSY = 1; /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public int addInNative(int a, int b) * Signature: (II)I */ jint JNICALL addInNative(JNIEnv* env, jobject thiz, jint a, jint b); /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public static void computeSomething(byte[] sth) * Signature: ([B)V */ void JNICALL computeSomething(JNIEnv* env, jclass clazz, jbyteArray sth); /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public static java.lang.String greet() * Signature: ()Ljava/lang/String; */ jstring JNICALL greet(JNIEnv* env, jclass clazz); /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public final void testParamParse(int a, java.lang.String b, long[] c, float[][] d, java.lang.Exception e, java.lang.Class f, java.util.HashMap g) * Signature: (ILjava/lang/String;[J[[FLjava/lang/Exception;Ljava/lang/Class;Ljava/util/HashMap;)V */ void JNICALL testParamParse(JNIEnv* env, jobject thiz, jint a, jstring b, jlongArray c, jobjectArray d, jthrowable e, jclass f, jobject g); /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public static long returnsLong() * Signature: ()J */ jlong JNICALL returnsLong(JNIEnv* env, jclass clazz); /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public static boolean returnsBool() * Signature: ()Z */ jboolean JNICALL returnsBool(JNIEnv* env, jclass clazz); /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public static java.lang.Object returnsObject() * Signature: ()Ljava/lang/Object; */ jobject JNICALL returnsObject(JNIEnv* env, jclass clazz); /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public static void testOverload() * Signature: ()V */ void JNICALL testOverload__(JNIEnv* env, jclass clazz); /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public static void testOverload(int i) * Signature: (I)V */ void JNICALL testOverload__I(JNIEnv* env, jclass clazz, jint i); /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public static java.lang.String httpGet(java.lang.String url) * Signature: (Ljava/lang/String;)Ljava/lang/String; */ jstring JNICALL httpGet(JNIEnv* env, jclass clazz, jstring url); /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public int computeThenCallback(io.github.landerlyoung.jennysampleapp.Callback listener) * Signature: (Lio/github/landerlyoung/jennysampleapp/Callback;)I */ jint JNICALL computeThenCallback(JNIEnv* env, jobject thiz, jobject listener); /* * Class: io.github.landerlyoung.jennysampleapp.ComputeIntensiveClass * Method: public static void runJniHelperTest() * Signature: ()V */ void JNICALL runJniHelperTest(JNIEnv* env, jclass clazz); /** * register Native functions * @returns success or not */ inline bool registerNativeFunctions(JNIEnv* env) { // 1. C++20 has u8"" string as char8_t type, we should cast them. // 2. jni.h has JNINativeMethod::name as char* type not const char*. (while Android does) #define jenny_u8cast(u8) const_cast(reinterpret_cast(u8)) const JNINativeMethod gsNativeMethods[] = { { /* method name */ jenny_u8cast(u8"addInNative"), /* method signature */ jenny_u8cast(u8"(II)I"), /* function pointer */ reinterpret_cast(addInNative) }, { /* method name */ jenny_u8cast(u8"computeSomething"), /* method signature */ jenny_u8cast(u8"([B)V"), /* function pointer */ reinterpret_cast(computeSomething) }, { /* method name */ jenny_u8cast(u8"greet"), /* method signature */ jenny_u8cast(u8"()Ljava/lang/String;"), /* function pointer */ reinterpret_cast(greet) }, { /* method name */ jenny_u8cast(u8"testParamParse"), /* method signature */ jenny_u8cast(u8"(ILjava/lang/String;[J[[FLjava/lang/Exception;Ljava/lang/Class;Ljava/util/HashMap;)V"), /* function pointer */ reinterpret_cast(testParamParse) }, { /* method name */ jenny_u8cast(u8"returnsLong"), /* method signature */ jenny_u8cast(u8"()J"), /* function pointer */ reinterpret_cast(returnsLong) }, { /* method name */ jenny_u8cast(u8"returnsBool"), /* method signature */ jenny_u8cast(u8"()Z"), /* function pointer */ reinterpret_cast(returnsBool) }, { /* method name */ jenny_u8cast(u8"returnsObject"), /* method signature */ jenny_u8cast(u8"()Ljava/lang/Object;"), /* function pointer */ reinterpret_cast(returnsObject) }, { /* method name */ jenny_u8cast(u8"testOverload"), /* method signature */ jenny_u8cast(u8"()V"), /* function pointer */ reinterpret_cast(testOverload__) }, { /* method name */ jenny_u8cast(u8"testOverload"), /* method signature */ jenny_u8cast(u8"(I)V"), /* function pointer */ reinterpret_cast(testOverload__I) }, { /* method name */ jenny_u8cast(u8"httpGet"), /* method signature */ jenny_u8cast(u8"(Ljava/lang/String;)Ljava/lang/String;"), /* function pointer */ reinterpret_cast(httpGet) }, { /* method name */ jenny_u8cast(u8"computeThenCallback"), /* method signature */ jenny_u8cast(u8"(Lio/github/landerlyoung/jennysampleapp/Callback;)I"), /* function pointer */ reinterpret_cast(computeThenCallback) }, { /* method name */ jenny_u8cast(u8"runJniHelperTest"), /* method signature */ jenny_u8cast(u8"()V"), /* function pointer */ reinterpret_cast(runJniHelperTest) } }; const int gsMethodCount = sizeof(gsNativeMethods) / sizeof(JNINativeMethod); bool success = false; jclass clazz = env->FindClass(jenny_u8cast(FULL_CLASS_NAME)); if (clazz != nullptr) { success = !env->RegisterNatives(clazz, gsNativeMethods, gsMethodCount); env->DeleteLocalRef(clazz); } return success; #undef jenny_u8cast } } // endof namespace ComputeIntensiveClass