IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
core
public
ice
os
android.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/os/unix.hxx
>
6
7
#if ISP_ANDROID
8
#include <jni.h>
9
10
template
<
typename
JNIType>
11
struct
AndroidJNIHandleDescriptorBase
12
{
15
using
PlatformHandleType = JNIType;
16
using
HandleManagerType = JNIEnv*;
17
20
static
constexpr
PlatformHandleType InvalidHandle = JNIType{};
21
22
static
bool
is_valid(PlatformHandleType handle, HandleManagerType jni)
noexcept
23
{
24
return
handle != InvalidHandle && jni !=
nullptr
;
25
}
26
27
static
bool
close(PlatformHandleType handle, HandleManagerType jni)
noexcept
28
{
29
jni->DeleteLocalRef(handle);
30
return
true
;
31
}
32
};
33
34
template
<>
35
struct
ice::os::HandleDescriptor
<
ice
::os::HandleType::JClass> : AndroidJNIHandleDescriptorBase<jclass> { };
36
template
<>
37
struct
ice::os::HandleDescriptor
<
ice
::os::HandleType::JObject> : AndroidJNIHandleDescriptorBase<jobject> { };
38
template
<>
39
struct
ice::os::HandleDescriptor
<
ice
::os::HandleType::JString> : AndroidJNIHandleDescriptorBase<jstring> { };
40
41
// Can't use 'unix' since it's a define
42
namespace
ice::jni
43
{
44
45
using
JClass = ice::os::Handle<ice::os::HandleType::JClass>;
46
using
JObject = ice::os::Handle<ice::os::HandleType::JObject>;
47
using
JString = ice::os::Handle<ice::os::HandleType::JString>;
48
49
}
// namespace ice::unix
50
51
#endif
// ISP_ANDROID
ice
SPDX-License-Identifier: MIT.
Definition
array.hxx:12
ice::os::HandleDescriptor
Definition
handle.hxx:26
unix.hxx
Generated by
1.18.0