Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
#pragma once
#include <cstddef>
#include <cassert>
#include <memory>
#include <stdexcept>
#include <jni.h>
namespace jni
{
// Not using bool because its size is implementation-defined, and a defined size
// is necessary for array operations.
using ::jboolean;
const jboolean jni_false = 0;
const jboolean jni_true = 1;
using ::jbyte;
using ::jchar;
using ::jshort;
using ::jint;
using ::jlong;
using ::jfloat;
using ::jdouble;
using jsize = std::size_t;
struct jobject
{
jobject() = delete;
~jobject() = delete;
jobject(const jobject&) = delete;
jobject& operator=(const jobject&) = delete;
};
struct jclass : public jobject {};
struct jstring : public jobject {};
struct jthrowable : public jobject {};
template < class T >
struct jarray : public jobject {};
using jobjectArray = jarray< jobject >;
using jbooleanArray = jarray< jboolean >;
using jbyteArray = jarray< jbyte >;
using jcharArray = jarray< jchar >;
using jshortArray = jarray< jshort >;
using jintArray = jarray< jint >;
using jlongArray = jarray< jlong >;
using jfloatArray = jarray< jfloat >;
using jdoubleArray = jarray< jdouble >;
using jfieldID = std::pointer_traits< ::jfieldID >::element_type;
using jmethodID = std::pointer_traits< ::jmethodID >::element_type;
using ::jobjectRefType;
using ::JavaVM;
using ::JNIEnv;
template < class T >
struct JNINativeMethod;
template < class R, class... Args >
struct JNINativeMethod< R (JNIEnv*, jclass*, Args...) >
{
const char* name;
const char* signature;
R (*fnPtr)(JNIEnv*, jclass*, Args...);
};
template < class R, class... Args >
struct JNINativeMethod< R (JNIEnv*, jobject*, Args...) >
{
const char* name;
const char* signature;
R (*fnPtr)(JNIEnv*, jobject*, Args...);
};
enum version : jint
{
jni_version_1_1 = version(JNI_VERSION_1_1),
jni_version_1_2 = version(JNI_VERSION_1_2),
jni_version_1_4 = version(JNI_VERSION_1_4),
jni_version_1_6 = version(JNI_VERSION_1_6),
};
enum error : jint
{
jni_ok = error(JNI_OK),
jni_err = error(JNI_ERR),
jni_edetached = error(JNI_EDETACHED),
jni_eversion = error(JNI_EVERSION),
};
}
jni
Definition advanced_ownership.hpp:6
jni::jdoubleArray
jarray< jdouble > jdoubleArray
Definition types.hpp:53
jni::jobjectArray
jarray< jobject > jobjectArray
Definition types.hpp:45
jni::jfieldID
std::pointer_traits< ::jfieldID >::element_type jfieldID
Definition types.hpp:55
jni::version
version
Definition types.hpp:83
jni::jni_version_1_1
@ jni_version_1_1
Definition types.hpp:84
jni::jni_version_1_4
@ jni_version_1_4
Definition types.hpp:86
jni::jni_version_1_6
@ jni_version_1_6
Definition types.hpp:87
jni::jni_version_1_2
@ jni_version_1_2
Definition types.hpp:85
jni::jlongArray
jarray< jlong > jlongArray
Definition types.hpp:51
jni::jbyteArray
jarray< jbyte > jbyteArray
Definition types.hpp:47
jni::jshortArray
jarray< jshort > jshortArray
Definition types.hpp:49
jni::jmethodID
std::pointer_traits< ::jmethodID >::element_type jmethodID
Definition types.hpp:56
jni::error
error
Definition types.hpp:91
jni::jni_err
@ jni_err
Definition types.hpp:93
jni::jni_ok
@ jni_ok
Definition types.hpp:92
jni::jni_eversion
@ jni_eversion
Definition types.hpp:95
jni::jni_edetached
@ jni_edetached
Definition types.hpp:94
jni::jni_true
const jboolean jni_true
Definition types.hpp:18
jni::jintArray
jarray< jint > jintArray
Definition types.hpp:50
jni::jfloatArray
jarray< jfloat > jfloatArray
Definition types.hpp:52
jni::jcharArray
jarray< jchar > jcharArray
Definition types.hpp:48
jni::jsize
std::size_t jsize
Definition types.hpp:28
jni::jbooleanArray
jarray< jboolean > jbooleanArray
Definition types.hpp:46
jni::jni_false
const jboolean jni_false
Definition types.hpp:17
jni::JNINativeMethod< R(JNIEnv *, jclass *, Args...) >::fnPtr
R(* fnPtr)(JNIEnv *, jclass *, Args...)
Definition types.hpp:71
jni::JNINativeMethod< R(JNIEnv *, jclass *, Args...) >::signature
const char * signature
Definition types.hpp:70
jni::JNINativeMethod< R(JNIEnv *, jclass *, Args...) >::name
const char * name
Definition types.hpp:69
jni::JNINativeMethod< R(JNIEnv *, jobject *, Args...) >::signature
const char * signature
Definition types.hpp:78
jni::JNINativeMethod< R(JNIEnv *, jobject *, Args...) >::name
const char * name
Definition types.hpp:77
jni::JNINativeMethod< R(JNIEnv *, jobject *, Args...) >::fnPtr
R(* fnPtr)(JNIEnv *, jobject *, Args...)
Definition types.hpp:79
jni::JNINativeMethod
Definition types.hpp:64
jni::jarray
Definition types.hpp:43
jni::jclass
Definition types.hpp:38
jni::jobject
Definition types.hpp:31
jni::jobject::jobject
jobject(const jobject &)=delete
jni::jobject::jobject
jobject()=delete
jni::jobject::operator=
jobject & operator=(const jobject &)=delete
jni::jobject::~jobject
~jobject()=delete
jni::jstring
Definition types.hpp:39
jni::jthrowable
Definition types.hpp:40