Commit e4ee30cb authored by Volker Krause's avatar Volker Krause

Add Jni::typeName, for static field access or ctor calls

parent 6852da2b
......@@ -29,10 +29,17 @@ private Q_SLOTS:
void testSignature()
{
QCOMPARE((const char*)Jni::signature<bool>(), "Z");
QCOMPARE((const char*)Jni::signature<bool()>(), "()Z");
QCOMPARE((const char*)Jni::signature<void(float[])>(), "([F)V");
QCOMPARE((const char*)Jni::signature<void(java::lang::String)>(), "(Ljava/lang/String;)V");
QCOMPARE((const char*)Jni::signature<java::lang::String()>(), "()Ljava/lang/String;");
QCOMPARE((const char*)Jni::signature<android::content::Intent(java::lang::String, bool[])>(), "(Ljava/lang/String;[Z)Landroid/content/Intent;");
QCOMPARE((const char*)Jni::signature<android::database::Cursor(android::net::Uri, java::lang::String[], java::lang::String, java::lang::String[], java::lang::String)>(), "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;");
}
void testTypeName()
{
QCOMPARE((const char*)Jni::typeName<android::provider::OpenableColumns>(), "android/provider/OpenableColumns");
}
void testImplementationDetails()
......
......@@ -18,6 +18,8 @@
#ifndef KANDROIDEXTRAS_JNITYPES_H
#define KANDROIDEXTRAS_JNITYPES_H
namespace KAndroidExtras {
// determine how many elements are in __VA_ARGS__
#define PP_NARG(...) PP_NARG_(__VA_ARGS__, PP_RSEQ_N())
#define PP_NARG_(...) PP_ARG_N(__VA_ARGS__)
......@@ -51,8 +53,19 @@
// type declarations
JNI_TYPE(android, content, ContentResolver)
JNI_TYPE(android, content, Intent)
JNI_TYPE(android, database, Cursor)
JNI_TYPE(android, net, Uri)
JNI_TYPE(android, provider, OpenableColumns)
JNI_TYPE(java, lang, String)
namespace Jni
{
/** Returns the JNI type name of the given template arugment. */
template <typename T> inline const char* typeName() { return T::jniName(); }
}
}
#endif // KANDROIDEXTRAS_JNITYPES_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment