summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qjnienvironment.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-11-13 12:12:23 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-11-13 22:35:27 +0100
commit536fd29bdfce74f1d331ff963ac5fa36ac875ee1 (patch)
treeb04b9e6e3257763a646f00d5def34272df24ab17 /src/corelib/kernel/qjnienvironment.cpp
parentc706011dc04b7198b92e356baa2f608e2561505c (diff)
JNI: Add convenience overloads for registerNativeMethods
Add a template overload for the QJniEnvironment member function so that a declared type can be used. And add a static registerNativeMethods class member function to declared types. As a drive-by, document the initializer_list overloads. The "template <typename Class>" convenience wrappers are currently all undocumented, as we first need to document the QtJniTypes type system and declaration macros. Change-Id: I8ff9edc4e493694e6d2c26d4bc7b06bd8e05bf0c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'src/corelib/kernel/qjnienvironment.cpp')
-rw-r--r--src/corelib/kernel/qjnienvironment.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/kernel/qjnienvironment.cpp b/src/corelib/kernel/qjnienvironment.cpp
index 5afa1a6484..1e2826e76b 100644
--- a/src/corelib/kernel/qjnienvironment.cpp
+++ b/src/corelib/kernel/qjnienvironment.cpp
@@ -351,6 +351,15 @@ bool QJniEnvironment::registerNativeMethods(const char *className, const JNINati
return registerNativeMethods(clazz, methods, size);
}
+
+/*!
+ \fn bool QJniEnvironment::registerNativeMethods(const char *className, std::initializer_list<JNINativeMethod> methods)
+ \overload
+
+ Registers the native functions methods in \a methods for the Java class \a className.
+ Returns \c true if the registration is successful, otherwise \c false.
+*/
+
#if QT_DEPRECATED_SINCE(6, 2)
/*!
\overload
@@ -406,6 +415,14 @@ bool QJniEnvironment::registerNativeMethods(jclass clazz, const JNINativeMethod
}
/*!
+ \fn bool QJniEnvironment::registerNativeMethods(jclass clazz, std::initializer_list<JNINativeMethod> methods)
+ \overload
+
+ Registers the native functions methods in \a methods for the Java class \a clazz.
+ Returns \c true if the registration is successful, otherwise \c false.
+*/
+
+/*!
\enum QJniEnvironment::OutputMode
\value Silent The exceptions are cleaned silently