lime
Lime is a C++ library implementing Open Whisper System Signal protocol
Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <cassert>
5#include <memory>
6#include <stdexcept>
7
8#include <jni.h>
9
10namespace jni
11 {
12 // Not using bool because its size is implementation-defined, and a defined size
13 // is necessary for array operations.
14
15 using ::jboolean;
16
18 const jboolean jni_true = 1;
19
20 using ::jbyte;
21 using ::jchar;
22 using ::jshort;
23 using ::jint;
24 using ::jlong;
25 using ::jfloat;
26 using ::jdouble;
27
28 using jsize = std::size_t;
29
30 struct jobject
31 {
32 jobject() = delete;
33 ~jobject() = delete;
34 jobject(const jobject&) = delete;
35 jobject& operator=(const jobject&) = delete;
36 };
37
38 struct jclass : public jobject {};
39 struct jstring : public jobject {};
40 struct jthrowable : public jobject {};
41
42 template < class T >
43 struct jarray : public jobject {};
44
54
55 using jfieldID = std::pointer_traits< ::jfieldID >::element_type;
56 using jmethodID = std::pointer_traits< ::jmethodID >::element_type;
57
58 using ::jobjectRefType;
59
60 using ::JavaVM;
61 using ::JNIEnv;
62
63 template < class T >
65
66 template < class R, class... Args >
67 struct JNINativeMethod< R (JNIEnv*, jclass*, Args...) >
68 {
69 const char* name;
70 const char* signature;
71 R (*fnPtr)(JNIEnv*, jclass*, Args...);
72 };
73
74 template < class R, class... Args >
75 struct JNINativeMethod< R (JNIEnv*, jobject*, Args...) >
76 {
77 const char* name;
78 const char* signature;
79 R (*fnPtr)(JNIEnv*, jobject*, Args...);
80 };
81
89
97 }
Definition advanced_ownership.hpp:6
version
Definition types.hpp:83
@ jni_version_1_1
Definition types.hpp:84
@ jni_version_1_4
Definition types.hpp:86
@ jni_version_1_6
Definition types.hpp:87
@ jni_version_1_2
Definition types.hpp:85
jarray< E > & NewArray(JNIEnv &env, jsize length)
Definition functions.hpp:472
std::pointer_traits< ::jmethodID >::element_type jmethodID
Definition types.hpp:56
error
Definition types.hpp:91
@ jni_err
Definition types.hpp:93
@ jni_ok
Definition types.hpp:92
@ jni_eversion
Definition types.hpp:95
@ jni_edetached
Definition types.hpp:94
std::size_t jsize
Definition types.hpp:28
const jboolean jni_true
Definition types.hpp:18
std::pointer_traits< ::jfieldID >::element_type jfieldID
Definition types.hpp:55
const jboolean jni_false
Definition types.hpp:17
const char * signature
Definition types.hpp:70
const char * name
Definition types.hpp:69
const char * signature
Definition types.hpp:78
Definition types.hpp:64
Definition types.hpp:43
Definition types.hpp:38
Definition types.hpp:31
jobject(const jobject &)=delete
jobject()=delete
jobject & operator=(const jobject &)=delete
~jobject()=delete
Definition types.hpp:39
Definition types.hpp:40