FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java4cpp/src/main/resources/cpp_new_native.cpp at java4cpp-1.4 · wshackle/java4cpp · GitHub
wshackle
/
java4cpp
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
9
Code
Issues
1
Pull requests
1
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
java4cpp
/
src
/
main
/
resources
/
cpp_new_native.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (40 loc) · 1.84 KB
Breadcrumbs
java4cpp
/
src
/
main
/
resources
/
cpp_new_native.cpp
Copy path
File metadata and controls
40 lines (40 loc) · 1.84 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//
%%%% Lines beginning with "//%%%%" are template comments and removed from final output.
//
%%%% "%NAMESPACE%" will be replaced with namespace
//
%%%% "%HEADER%" will be replaced with header
//
%%%% "%HEADER_DEFINE%" will be replaced with defined value used to prevent multiple inclusion
//
%%%% "%CLASS_NAME%" will be replaced with className (not including package)
//
%%%% "%JNI_SIGNATURE% will be replaced with the JNI signature for the constructor.
//
%%%% "%CONSTRUCTOR_ARGS% will be replaced with the actual Constructors arguments
JNIEnv *env =getEnv();
static
jclass cls = get%
CLASS_NAME
%Class();
if
(GetDebugJ4Cpp()) {
DebugPrintJObject
(__FILE__,__LINE__,
"
Native Constructor for %CLASS_NAME% cls=
"
,cls);
std::cout << __FILE__ <<
"
:
"
<< __LINE__ <<
"
Native Constructor for %CLASS_NAME% this=
"
<<
this
<< std::endl;
}
if
(cls !=
NULL
) {
static
jmethodID mid = env->
GetMethodID
(cls,
"
<init>
"
,
"
(J)V
"
);
if
(
NULL
== mid) {
std::cerr <<
"
Class %CLASS_NAME% has no method constructor signature %JNI_SIGNATURE%
"
<< std::endl;
}
else
{
jthis = env->
NewObject
(cls, mid , ((jlong)
this
));
jthrowable t = env->
ExceptionOccurred
();
if
(t !=
NULL
) {
if
(
GetDebugJ4Cpp
()) {
DebugPrintJObject
(__FILE__,__LINE__,
"
%CLASS_NAME%::%METHOD_NAME% jthis=
"
,t);
env->
ExceptionDescribe
();
}
throw
t;
}
if
(jthis ==
NULL
) {
std::cerr <<
"
Call to create new %CLASS_NAME% with signature %JNI_SIGNATURE% returned null.
"
<< std::endl;
releaseEnv
(env);
return
;
}
jobjectRefType ref = env->
GetObjectRefType
(jthis);
if
(
GetDebugJ4Cpp
())
DebugPrintJObject
(__FILE__,__LINE__,
"
new %CLASS_NAME% jthis=
"
,jthis);
if
(ref != JNIGlobalRefType) {
jthis = env->
NewGlobalRef
(jthis);
}
}
}
releaseEnv
(env);
Back
|
FazBrowse Home
|
New Git URL