summaryrefslogtreecommitdiffstats
path: root/platform/android/api/java_class_wrapper.h
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/api/java_class_wrapper.h')
-rw-r--r--platform/android/api/java_class_wrapper.h53
1 files changed, 31 insertions, 22 deletions
diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h
index 59fcd94b4d..d6c7a1abe5 100644
--- a/platform/android/api/java_class_wrapper.h
+++ b/platform/android/api/java_class_wrapper.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -31,7 +31,7 @@
#ifndef JAVA_CLASS_WRAPPER_H
#define JAVA_CLASS_WRAPPER_H
-#include "core/reference.h"
+#include "core/object/reference.h"
#ifdef ANDROID_ENABLED
#include <android/log.h>
@@ -43,12 +43,10 @@ class JavaObject;
#endif
class JavaClass : public Reference {
-
GDCLASS(JavaClass, Reference);
#ifdef ANDROID_ENABLED
enum ArgumentType{
-
ARG_TYPE_VOID,
ARG_TYPE_BOOLEAN,
ARG_TYPE_BYTE,
@@ -68,24 +66,25 @@ class JavaClass : public Reference {
Map<StringName, Variant> constant_map;
struct MethodInfo {
-
- bool _static;
+ bool _static = false;
Vector<uint32_t> param_types;
Vector<StringName> param_sigs;
- uint32_t return_type;
+ uint32_t return_type = 0;
jmethodID method;
};
_FORCE_INLINE_ static void _convert_to_variant_type(int p_sig, Variant::Type &r_type, float &likelihood) {
-
likelihood = 1.0;
r_type = Variant::NIL;
switch (p_sig) {
-
- case ARG_TYPE_VOID: r_type = Variant::NIL; break;
+ case ARG_TYPE_VOID:
+ r_type = Variant::NIL;
+ break;
case ARG_TYPE_BOOLEAN | ARG_NUMBER_CLASS_BIT:
- case ARG_TYPE_BOOLEAN: r_type = Variant::BOOL; break;
+ case ARG_TYPE_BOOLEAN:
+ r_type = Variant::BOOL;
+ break;
case ARG_TYPE_BYTE | ARG_NUMBER_CLASS_BIT:
case ARG_TYPE_BYTE:
r_type = Variant::INT;
@@ -121,10 +120,18 @@ class JavaClass : public Reference {
r_type = Variant::FLOAT;
likelihood = 0.5;
break;
- case ARG_TYPE_STRING: r_type = Variant::STRING; break;
- case ARG_TYPE_CLASS: r_type = Variant::OBJECT; break;
- case ARG_ARRAY_BIT | ARG_TYPE_VOID: r_type = Variant::NIL; break;
- case ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN: r_type = Variant::ARRAY; break;
+ case ARG_TYPE_STRING:
+ r_type = Variant::STRING;
+ break;
+ case ARG_TYPE_CLASS:
+ r_type = Variant::OBJECT;
+ break;
+ case ARG_ARRAY_BIT | ARG_TYPE_VOID:
+ r_type = Variant::NIL;
+ break;
+ case ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN:
+ r_type = Variant::ARRAY;
+ break;
case ARG_ARRAY_BIT | ARG_TYPE_BYTE:
r_type = Variant::PACKED_BYTE_ARRAY;
likelihood = 1.0;
@@ -153,8 +160,12 @@ class JavaClass : public Reference {
r_type = Variant::PACKED_FLOAT32_ARRAY;
likelihood = 0.5;
break;
- case ARG_ARRAY_BIT | ARG_TYPE_STRING: r_type = Variant::PACKED_STRING_ARRAY; break;
- case ARG_ARRAY_BIT | ARG_TYPE_CLASS: r_type = Variant::ARRAY; break;
+ case ARG_ARRAY_BIT | ARG_TYPE_STRING:
+ r_type = Variant::PACKED_STRING_ARRAY;
+ break;
+ case ARG_ARRAY_BIT | ARG_TYPE_CLASS:
+ r_type = Variant::ARRAY;
+ break;
}
}
@@ -168,13 +179,12 @@ class JavaClass : public Reference {
#endif
public:
- virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
+ virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override;
JavaClass();
};
class JavaObject : public Reference {
-
GDCLASS(JavaObject, Reference);
#ifdef ANDROID_ENABLED
@@ -185,7 +195,7 @@ class JavaObject : public Reference {
#endif
public:
- virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
+ virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override;
#ifdef ANDROID_ENABLED
JavaObject(const Ref<JavaClass> &p_base, jobject *p_instance);
@@ -194,7 +204,6 @@ public:
};
class JavaClassWrapper : public Object {
-
GDCLASS(JavaClassWrapper, Object);
#ifdef ANDROID_ENABLED