WPILibC++ 2023.4.3-108-ge5452e3
|
Java Native Interface (JNI) utility functions. More...
Namespaces | |
namespace | detail |
Classes | |
class | JCallbackManager |
class | JCallbackThread |
Generic callback thread implementation. More... | |
class | JClass |
Finds a class and keeps it as a global reference. More... | |
struct | JClassInit |
class | JException |
Finds an exception class and keep it as a global reference. More... | |
struct | JExceptionInit |
class | JGlobal |
class | JLocal |
Container class for cleaning up Java local references. More... | |
class | JSingletonCallbackManager |
class | JStringRef |
Java string (jstring) reference. More... | |
Functions | |
std::string | GetJavaStackTrace (JNIEnv *env, std::string *func=nullptr, std::string_view excludeFuncPrefix={}) |
Gets a Java stack trace. More... | |
jstring | MakeJString (JNIEnv *env, std::string_view str) |
Convert a UTF8 string into a jstring. More... | |
template<typename T > | |
jintArray | MakeJIntArray (JNIEnv *env, std::span< const T > arr) |
Convert a span to a jintArray. More... | |
template<typename T > | |
jintArray | MakeJIntArray (JNIEnv *env, const SmallVectorImpl< T > &arr) |
Convert a SmallVector to a jintArray. More... | |
template<typename T > | |
jintArray | MakeJIntArray (JNIEnv *env, const std::vector< T > &arr) |
Convert a std::vector to a jintArray. More... | |
jbyteArray | MakeJByteArray (JNIEnv *env, std::span< const uint8_t > str) |
Convert a span into a jbyteArray. More... | |
jbooleanArray | MakeJBooleanArray (JNIEnv *env, std::span< const int > arr) |
Convert an array of integers into a jbooleanArray. More... | |
jbooleanArray | MakeJBooleanArray (JNIEnv *env, std::span< const bool > arr) |
Convert an array of booleans into a jbooleanArray. More... | |
template<class T > requires (sizeof(typename T::value_type) == sizeof(jlong) && std::integral<typename T::value_type>) | |
jlongArray | MakeJLongArray (JNIEnv *env, const T &arr) |
jobjectArray | MakeJStringArray (JNIEnv *env, std::span< const std::string > arr) |
Convert an array of std::string into a jarray of jstring. More... | |
jobjectArray | MakeJStringArray (JNIEnv *env, std::span< std::string_view > arr) |
Convert an array of std::string into a jarray of jstring. More... | |
std::string | GetJavaStackTrace (JNIEnv *env, std::string_view skipPrefix) |
Java Native Interface (JNI) utility functions.
|
inline |
Gets a Java stack trace.
Also provides the last function in the stack trace not starting with excludeFuncPrefix (useful for e.g. finding the first user call to a series of library functions).
env | JRE environment. |
func | Storage for last function in the stack trace not starting with excludeFuncPrefix. |
excludeFuncPrefix | Prefix for functions to ignore in stack trace. |
|
inline |
|
inline |
Convert an array of booleans into a jbooleanArray.
env | JRE environment. |
arr | Array to convert. |
|
inline |
Convert an array of integers into a jbooleanArray.
env | JRE environment. |
arr | Array to convert. |
|
inline |
Convert a span into a jbyteArray.
env | JRE environment. |
str | span to convert. |
|
inline |
Convert a SmallVector to a jintArray.
This is required in addition to ArrayRef because template resolution occurs prior to implicit conversions.
env | JRE environment. |
arr | SmallVector to convert. |
|
inline |
Convert a std::vector to a jintArray.
This is required in addition to ArrayRef because template resolution occurs prior to implicit conversions.
env | JRE environment. |
arr | SmallVector to convert. |
|
inline |
Convert a span to a jintArray.
env | JRE environment. |
arr | Span to convert. |
|
inline |
|
inline |
Convert a UTF8 string into a jstring.
env | JRE environment. |
str | String to convert. |
|
inline |
Convert an array of std::string into a jarray of jstring.
env | JRE environment. |
arr | Array to convert. |
|
inline |
Convert an array of std::string into a jarray of jstring.
env | JRE environment. |
arr | Array to convert. |