diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2020-07-05 19:19:36 +0200 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2020-07-05 19:19:36 +0200 |
commit | 2511c439727226f64def8b15b38d084db187cf55 (patch) | |
tree | f56b1716af16025a32795691161b75c8a0362fb9 /modules/mono/glue | |
parent | 772f693e5b8b5912d422e8effb8d6a72260edcfc (diff) |
Mono/C#: Fix several clang-tidy warnings and cleanup
Diffstat (limited to 'modules/mono/glue')
-rw-r--r-- | modules/mono/glue/arguments_vector.h | 4 | ||||
-rw-r--r-- | modules/mono/glue/base_object_glue.cpp | 12 | ||||
-rw-r--r-- | modules/mono/glue/base_object_glue.h | 73 | ||||
-rw-r--r-- | modules/mono/glue/collections_glue.cpp | 5 | ||||
-rw-r--r-- | modules/mono/glue/collections_glue.h | 124 | ||||
-rw-r--r-- | modules/mono/glue/gd_glue.cpp | 16 | ||||
-rw-r--r-- | modules/mono/glue/gd_glue.h | 86 | ||||
-rw-r--r-- | modules/mono/glue/glue_header.h | 18 | ||||
-rw-r--r-- | modules/mono/glue/nodepath_glue.cpp | 9 | ||||
-rw-r--r-- | modules/mono/glue/nodepath_glue.h | 68 | ||||
-rw-r--r-- | modules/mono/glue/rid_glue.cpp | 9 | ||||
-rw-r--r-- | modules/mono/glue/rid_glue.h | 53 | ||||
-rw-r--r-- | modules/mono/glue/scene_tree_glue.cpp | 14 | ||||
-rw-r--r-- | modules/mono/glue/scene_tree_glue.h | 50 | ||||
-rw-r--r-- | modules/mono/glue/string_glue.cpp | 4 | ||||
-rw-r--r-- | modules/mono/glue/string_glue.h | 56 | ||||
-rw-r--r-- | modules/mono/glue/string_name_glue.cpp | 7 | ||||
-rw-r--r-- | modules/mono/glue/string_name_glue.h | 54 |
18 files changed, 58 insertions, 604 deletions
diff --git a/modules/mono/glue/arguments_vector.h b/modules/mono/glue/arguments_vector.h index 4ee553fc11..ab48904571 100644 --- a/modules/mono/glue/arguments_vector.h +++ b/modules/mono/glue/arguments_vector.h @@ -40,8 +40,8 @@ private: T *_ptr; int size; - ArgumentsVector(); - ArgumentsVector(const ArgumentsVector &); + ArgumentsVector() = delete; + ArgumentsVector(const ArgumentsVector &) = delete; public: T *ptr() { return _ptr; } diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp index f370883320..ebcd6d5e9c 100644 --- a/modules/mono/glue/base_object_glue.cpp +++ b/modules/mono/glue/base_object_glue.cpp @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "base_object_glue.h" - #ifdef MONO_GLUE_ENABLED +#include "core/class_db.h" +#include "core/object.h" #include "core/reference.h" #include "core/string_name.h" @@ -39,6 +39,7 @@ #include "../mono_gd/gd_mono_cache.h" #include "../mono_gd/gd_mono_class.h" #include "../mono_gd/gd_mono_internals.h" +#include "../mono_gd/gd_mono_marshal.h" #include "../mono_gd/gd_mono_utils.h" #include "../signal_awaiter_utils.h" #include "arguments_vector.h" @@ -140,16 +141,18 @@ MethodBind *godot_icall_Object_ClassDB_get_method(StringName *p_type, MonoString } MonoObject *godot_icall_Object_weakref(Object *p_ptr) { - if (!p_ptr) + if (!p_ptr) { return nullptr; + } Ref<WeakRef> wref; Reference *ref = Object::cast_to<Reference>(p_ptr); if (ref) { REF r = ref; - if (!r.is_valid()) + if (!r.is_valid()) { return nullptr; + } wref.instance(); wref->set_ref(r); @@ -241,6 +244,7 @@ void godot_register_object_icalls() { mono_add_internal_call("Godot.Object::godot_icall_Object_Ctor", (void *)godot_icall_Object_Ctor); mono_add_internal_call("Godot.Object::godot_icall_Object_Disposed", (void *)godot_icall_Object_Disposed); mono_add_internal_call("Godot.Object::godot_icall_Reference_Disposed", (void *)godot_icall_Reference_Disposed); + mono_add_internal_call("Godot.Object::godot_icall_Object_ConnectEventSignals", (void *)godot_icall_Object_ConnectEventSignals); mono_add_internal_call("Godot.Object::godot_icall_Object_ClassDB_get_method", (void *)godot_icall_Object_ClassDB_get_method); mono_add_internal_call("Godot.Object::godot_icall_Object_ToString", (void *)godot_icall_Object_ToString); mono_add_internal_call("Godot.Object::godot_icall_Object_weakref", (void *)godot_icall_Object_weakref); diff --git a/modules/mono/glue/base_object_glue.h b/modules/mono/glue/base_object_glue.h deleted file mode 100644 index 67769f3061..0000000000 --- a/modules/mono/glue/base_object_glue.h +++ /dev/null @@ -1,73 +0,0 @@ -/*************************************************************************/ -/* base_object_glue.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 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 */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef BASE_OBJECT_GLUE_H -#define BASE_OBJECT_GLUE_H - -#ifdef MONO_GLUE_ENABLED - -#include "core/class_db.h" -#include "core/object.h" - -#include "../mono_gd/gd_mono_marshal.h" - -Object *godot_icall_Object_Ctor(MonoObject *p_obj); - -void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr); - -void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolean p_is_finalizer); - -void godot_icall_Object_ConnectEventSignals(Object *p_ptr); - -MethodBind *godot_icall_Object_ClassDB_get_method(StringName *p_type, MonoString *p_method); - -MonoObject *godot_icall_Object_weakref(Object *p_ptr); - -Error godot_icall_SignalAwaiter_connect(Object *p_source, StringName *p_signal, Object *p_target, MonoObject *p_awaiter); - -// DynamicGodotObject - -MonoArray *godot_icall_DynamicGodotObject_SetMemberList(Object *p_ptr); - -MonoBoolean godot_icall_DynamicGodotObject_InvokeMember(Object *p_ptr, MonoString *p_name, MonoArray *p_args, MonoObject **r_result); - -MonoBoolean godot_icall_DynamicGodotObject_GetMember(Object *p_ptr, MonoString *p_name, MonoObject **r_result); - -MonoBoolean godot_icall_DynamicGodotObject_SetMember(Object *p_ptr, MonoString *p_name, MonoObject *p_value); - -MonoString *godot_icall_Object_ToString(Object *p_ptr); - -// Register internal calls - -void godot_register_object_icalls(); - -#endif // MONO_GLUE_ENABLED - -#endif // BASE_OBJECT_GLUE_H diff --git a/modules/mono/glue/collections_glue.cpp b/modules/mono/glue/collections_glue.cpp index 4e3dc9c4ea..766b00d612 100644 --- a/modules/mono/glue/collections_glue.cpp +++ b/modules/mono/glue/collections_glue.cpp @@ -28,14 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "collections_glue.h" - #ifdef MONO_GLUE_ENABLED #include <mono/metadata/exception.h> +#include "core/array.h" + #include "../mono_gd/gd_mono_cache.h" #include "../mono_gd/gd_mono_class.h" +#include "../mono_gd/gd_mono_marshal.h" #include "../mono_gd/gd_mono_utils.h" Array *godot_icall_Array_Ctor() { diff --git a/modules/mono/glue/collections_glue.h b/modules/mono/glue/collections_glue.h deleted file mode 100644 index f8351a1fc7..0000000000 --- a/modules/mono/glue/collections_glue.h +++ /dev/null @@ -1,124 +0,0 @@ -/*************************************************************************/ -/* collections_glue.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 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 */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef COLLECTIONS_GLUE_H -#define COLLECTIONS_GLUE_H - -#ifdef MONO_GLUE_ENABLED - -#include "core/array.h" - -#include "../mono_gd/gd_mono_marshal.h" - -// Array - -Array *godot_icall_Array_Ctor(); - -void godot_icall_Array_Dtor(Array *ptr); - -MonoObject *godot_icall_Array_At(Array *ptr, int index); - -MonoObject *godot_icall_Array_At_Generic(Array *ptr, int index, uint32_t type_encoding, GDMonoClass *type_class); - -void godot_icall_Array_SetAt(Array *ptr, int index, MonoObject *value); - -int godot_icall_Array_Count(Array *ptr); - -int godot_icall_Array_Add(Array *ptr, MonoObject *item); - -void godot_icall_Array_Clear(Array *ptr); - -MonoBoolean godot_icall_Array_Contains(Array *ptr, MonoObject *item); - -void godot_icall_Array_CopyTo(Array *ptr, MonoArray *array, int array_index); - -Array *godot_icall_Array_Duplicate(Array *ptr, MonoBoolean deep); - -int godot_icall_Array_IndexOf(Array *ptr, MonoObject *item); - -void godot_icall_Array_Insert(Array *ptr, int index, MonoObject *item); - -MonoBoolean godot_icall_Array_Remove(Array *ptr, MonoObject *item); - -void godot_icall_Array_RemoveAt(Array *ptr, int index); - -Error godot_icall_Array_Resize(Array *ptr, int new_size); - -void godot_icall_Array_Generic_GetElementTypeInfo(MonoReflectionType *refltype, uint32_t *type_encoding, GDMonoClass **type_class); - -MonoString *godot_icall_Array_ToString(Array *ptr); - -// Dictionary - -Dictionary *godot_icall_Dictionary_Ctor(); - -void godot_icall_Dictionary_Dtor(Dictionary *ptr); - -MonoObject *godot_icall_Dictionary_GetValue(Dictionary *ptr, MonoObject *key); - -MonoObject *godot_icall_Dictionary_GetValue_Generic(Dictionary *ptr, MonoObject *key, uint32_t type_encoding, GDMonoClass *type_class); - -void godot_icall_Dictionary_SetValue(Dictionary *ptr, MonoObject *key, MonoObject *value); - -Array *godot_icall_Dictionary_Keys(Dictionary *ptr); - -Array *godot_icall_Dictionary_Values(Dictionary *ptr); - -int godot_icall_Dictionary_Count(Dictionary *ptr); - -void godot_icall_Dictionary_Add(Dictionary *ptr, MonoObject *key, MonoObject *value); - -void godot_icall_Dictionary_Clear(Dictionary *ptr); - -MonoBoolean godot_icall_Dictionary_Contains(Dictionary *ptr, MonoObject *key, MonoObject *value); - -MonoBoolean godot_icall_Dictionary_ContainsKey(Dictionary *ptr, MonoObject *key); - -Dictionary *godot_icall_Dictionary_Duplicate(Dictionary *ptr, MonoBoolean deep); - -MonoBoolean godot_icall_Dictionary_RemoveKey(Dictionary *ptr, MonoObject *key); - -MonoBoolean godot_icall_Dictionary_Remove(Dictionary *ptr, MonoObject *key, MonoObject *value); - -MonoBoolean godot_icall_Dictionary_TryGetValue(Dictionary *ptr, MonoObject *key, MonoObject **value); - -MonoBoolean godot_icall_Dictionary_TryGetValue_Generic(Dictionary *ptr, MonoObject *key, MonoObject **value, uint32_t type_encoding, GDMonoClass *type_class); - -void godot_icall_Dictionary_Generic_GetValueTypeInfo(MonoReflectionType *refltype, uint32_t *type_encoding, GDMonoClass **type_class); - -MonoString *godot_icall_Dictionary_ToString(Dictionary *ptr); - -// Register internal calls - -void godot_register_collections_icalls(); - -#endif // MONO_GLUE_ENABLED - -#endif // COLLECTIONS_GLUE_H diff --git a/modules/mono/glue/gd_glue.cpp b/modules/mono/glue/gd_glue.cpp index e43b06d18e..5e892b616b 100644 --- a/modules/mono/glue/gd_glue.cpp +++ b/modules/mono/glue/gd_glue.cpp @@ -28,8 +28,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "gd_glue.h" - #ifdef MONO_GLUE_ENABLED #include "core/array.h" @@ -40,6 +38,7 @@ #include "core/variant_parser.h" #include "../mono_gd/gd_mono_cache.h" +#include "../mono_gd/gd_mono_marshal.h" #include "../mono_gd/gd_mono_utils.h" MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes, MonoBoolean p_allow_objects) { @@ -147,8 +146,9 @@ void godot_icall_GD_prints(MonoArray *p_what) { return; } - if (i) + if (i) { str += " "; + } str += elem_str; } @@ -171,8 +171,9 @@ void godot_icall_GD_printt(MonoArray *p_what) { return; } - if (i) + if (i) { str += "\t"; + } str += elem_str; } @@ -197,7 +198,7 @@ double godot_icall_GD_rand_range(double from, double to) { } uint32_t godot_icall_GD_rand_seed(uint64_t seed, uint64_t *newSeed) { - int ret = Math::rand_from_seed(&seed); + uint32_t ret = Math::rand_from_seed(&seed); *newSeed = seed; return ret; } @@ -213,10 +214,11 @@ MonoString *godot_icall_GD_str(MonoArray *p_what) { for (int i = 0; i < what.size(); i++) { String os = what[i].operator String(); - if (i == 0) + if (i == 0) { str = os; - else + } else { str += os; + } } return GDMonoMarshal::mono_string_from_godot(str); diff --git a/modules/mono/glue/gd_glue.h b/modules/mono/glue/gd_glue.h deleted file mode 100644 index 3ad6058205..0000000000 --- a/modules/mono/glue/gd_glue.h +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************/ -/* gd_glue.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 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 */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef GD_GLUE_H -#define GD_GLUE_H - -#ifdef MONO_GLUE_ENABLED - -#include "../mono_gd/gd_mono_marshal.h" - -MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes, MonoBoolean p_allow_objects); - -MonoObject *godot_icall_GD_convert(MonoObject *p_what, int32_t p_type); - -int godot_icall_GD_hash(MonoObject *p_var); - -MonoObject *godot_icall_GD_instance_from_id(uint64_t p_instance_id); - -void godot_icall_GD_print(MonoArray *p_what); - -void godot_icall_GD_printerr(MonoArray *p_what); - -void godot_icall_GD_printraw(MonoArray *p_what); - -void godot_icall_GD_prints(MonoArray *p_what); - -void godot_icall_GD_printt(MonoArray *p_what); - -float godot_icall_GD_randf(); - -uint32_t godot_icall_GD_randi(); - -void godot_icall_GD_randomize(); - -double godot_icall_GD_rand_range(double from, double to); - -uint32_t godot_icall_GD_rand_seed(uint64_t seed, uint64_t *newSeed); - -void godot_icall_GD_seed(uint64_t p_seed); - -MonoString *godot_icall_GD_str(MonoArray *p_what); - -MonoObject *godot_icall_GD_str2var(MonoString *p_str); - -MonoBoolean godot_icall_GD_type_exists(StringName *p_type); - -MonoArray *godot_icall_GD_var2bytes(MonoObject *p_var, MonoBoolean p_full_objects); - -MonoString *godot_icall_GD_var2str(MonoObject *p_var); - -MonoObject *godot_icall_DefaultGodotTaskScheduler(); - -// Register internal calls - -void godot_register_gd_icalls(); - -#endif // MONO_GLUE_ENABLED - -#endif // GD_GLUE_H diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h index f6999d01fb..c1f1936711 100644 --- a/modules/mono/glue/glue_header.h +++ b/modules/mono/glue/glue_header.h @@ -30,14 +30,16 @@ #ifdef MONO_GLUE_ENABLED -#include "base_object_glue.h" -#include "collections_glue.h" -#include "gd_glue.h" -#include "nodepath_glue.h" -#include "rid_glue.h" -#include "scene_tree_glue.h" -#include "string_glue.h" -#include "string_name_glue.h" +#include "../mono_gd/gd_mono_marshal.h" + +void godot_register_collections_icalls(); +void godot_register_gd_icalls(); +void godot_register_string_name_icalls(); +void godot_register_nodepath_icalls(); +void godot_register_object_icalls(); +void godot_register_rid_icalls(); +void godot_register_string_icalls(); +void godot_register_scene_tree_icalls(); /** * Registers internal calls that were not generated. This function is called diff --git a/modules/mono/glue/nodepath_glue.cpp b/modules/mono/glue/nodepath_glue.cpp index e413f404d8..2aa75dd309 100644 --- a/modules/mono/glue/nodepath_glue.cpp +++ b/modules/mono/glue/nodepath_glue.cpp @@ -28,12 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "nodepath_glue.h" - #ifdef MONO_GLUE_ENABLED +#include "core/node_path.h" #include "core/ustring.h" +#include "../mono_gd/gd_mono_marshal.h" + NodePath *godot_icall_NodePath_Ctor(MonoString *p_path) { return memnew(NodePath(GDMonoMarshal::mono_string_to_godot(p_path))); } @@ -51,7 +52,7 @@ MonoBoolean godot_icall_NodePath_is_absolute(NodePath *p_ptr) { return (MonoBoolean)p_ptr->is_absolute(); } -uint32_t godot_icall_NodePath_get_name_count(NodePath *p_ptr) { +int32_t godot_icall_NodePath_get_name_count(NodePath *p_ptr) { return p_ptr->get_name_count(); } @@ -59,7 +60,7 @@ MonoString *godot_icall_NodePath_get_name(NodePath *p_ptr, uint32_t p_idx) { return GDMonoMarshal::mono_string_from_godot(p_ptr->get_name(p_idx)); } -uint32_t godot_icall_NodePath_get_subname_count(NodePath *p_ptr) { +int32_t godot_icall_NodePath_get_subname_count(NodePath *p_ptr) { return p_ptr->get_subname_count(); } diff --git a/modules/mono/glue/nodepath_glue.h b/modules/mono/glue/nodepath_glue.h deleted file mode 100644 index 727679c278..0000000000 --- a/modules/mono/glue/nodepath_glue.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************/ -/* nodepath_glue.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 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 */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef NODEPATH_GLUE_H -#define NODEPATH_GLUE_H - -#ifdef MONO_GLUE_ENABLED - -#include "core/node_path.h" - -#include "../mono_gd/gd_mono_marshal.h" - -NodePath *godot_icall_NodePath_Ctor(MonoString *p_path); - -void godot_icall_NodePath_Dtor(NodePath *p_ptr); - -MonoString *godot_icall_NodePath_operator_String(NodePath *p_np); - -MonoBoolean godot_icall_NodePath_is_absolute(NodePath *p_ptr); - -uint32_t godot_icall_NodePath_get_name_count(NodePath *p_ptr); - -MonoString *godot_icall_NodePath_get_name(NodePath *p_ptr, uint32_t p_idx); - -uint32_t godot_icall_NodePath_get_subname_count(NodePath *p_ptr); - -MonoString *godot_icall_NodePath_get_subname(NodePath *p_ptr, uint32_t p_idx); - -MonoString *godot_icall_NodePath_get_concatenated_subnames(NodePath *p_ptr); - -NodePath *godot_icall_NodePath_get_as_property_path(NodePath *p_ptr); - -MonoBoolean godot_icall_NodePath_is_empty(NodePath *p_ptr); - -// Register internal calls - -void godot_register_nodepath_icalls(); - -#endif // MONO_GLUE_ENABLED - -#endif // NODEPATH_GLUE_H diff --git a/modules/mono/glue/rid_glue.cpp b/modules/mono/glue/rid_glue.cpp index 66a49d8fec..6d2e6b559f 100644 --- a/modules/mono/glue/rid_glue.cpp +++ b/modules/mono/glue/rid_glue.cpp @@ -28,17 +28,20 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "rid_glue.h" - #ifdef MONO_GLUE_ENABLED +#include "core/object.h" #include "core/resource.h" +#include "core/rid.h" + +#include "../mono_gd/gd_mono_marshal.h" RID *godot_icall_RID_Ctor(Object *p_from) { Resource *res_from = Object::cast_to<Resource>(p_from); - if (res_from) + if (res_from) { return memnew(RID(res_from->get_rid())); + } return memnew(RID); } diff --git a/modules/mono/glue/rid_glue.h b/modules/mono/glue/rid_glue.h deleted file mode 100644 index 506d715451..0000000000 --- a/modules/mono/glue/rid_glue.h +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************/ -/* rid_glue.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 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 */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef RID_GLUE_H -#define RID_GLUE_H - -#ifdef MONO_GLUE_ENABLED - -#include "core/object.h" -#include "core/rid.h" - -#include "../mono_gd/gd_mono_marshal.h" - -RID *godot_icall_RID_Ctor(Object *p_from); - -void godot_icall_RID_Dtor(RID *p_ptr); - -uint32_t godot_icall_RID_get_id(RID *p_ptr); - -// Register internal calls - -void godot_register_rid_icalls(); - -#endif // MONO_GLUE_ENABLED - -#endif // RID_GLUE_H diff --git a/modules/mono/glue/scene_tree_glue.cpp b/modules/mono/glue/scene_tree_glue.cpp index bea9544b08..b43daccc1b 100644 --- a/modules/mono/glue/scene_tree_glue.cpp +++ b/modules/mono/glue/scene_tree_glue.cpp @@ -28,14 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "scene_tree_glue.h" - #ifdef MONO_GLUE_ENABLED +#include "core/array.h" #include "core/class_db.h" -#include "modules/mono/csharp_script.h" -#include "modules/mono/mono_gd/gd_mono_utils.h" +#include "core/string_name.h" #include "scene/main/node.h" +#include "scene/main/scene_tree.h" + +#include "../csharp_script.h" +#include "../mono_gd/gd_mono_marshal.h" +#include "../mono_gd/gd_mono_utils.h" Array *godot_icall_SceneTree_get_nodes_in_group_Generic(SceneTree *ptr, StringName *group, MonoReflectionType *refltype) { List<Node *> nodes; @@ -54,8 +57,9 @@ Array *godot_icall_SceneTree_get_nodes_in_group_Generic(SceneTree *ptr, StringNa // If we're trying to get native objects, just check the inheritance list StringName native_class_name = GDMonoUtils::get_native_godot_class_name(klass); for (int i = 0; i < nodes.size(); ++i) { - if (ClassDB::is_parent_class(nodes[i]->get_class(), native_class_name)) + if (ClassDB::is_parent_class(nodes[i]->get_class(), native_class_name)) { ret.push_back(nodes[i]); + } } } else { // If we're trying to get csharpscript instances, get the mono object and compare the classes diff --git a/modules/mono/glue/scene_tree_glue.h b/modules/mono/glue/scene_tree_glue.h deleted file mode 100644 index e9af35a30b..0000000000 --- a/modules/mono/glue/scene_tree_glue.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************/ -/* scene_tree_glue.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 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 */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef SCENE_TREE_GLUE_H -#define SCENE_TREE_GLUE_H - -#ifdef MONO_GLUE_ENABLED - -#include "core/array.h" -#include "core/string_name.h" -#include "scene/main/scene_tree.h" - -#include "../mono_gd/gd_mono_marshal.h" - -Array *godot_icall_SceneTree_get_nodes_in_group_Generic(SceneTree *ptr, StringName *group, MonoReflectionType *refltype); - -// Register internal calls - -void godot_register_scene_tree_icalls(); - -#endif // MONO_GLUE_ENABLED - -#endif // SCENE_TREE_GLUE_H diff --git a/modules/mono/glue/string_glue.cpp b/modules/mono/glue/string_glue.cpp index e407a70db9..595b8d71f1 100644 --- a/modules/mono/glue/string_glue.cpp +++ b/modules/mono/glue/string_glue.cpp @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "string_glue.h" - #ifdef MONO_GLUE_ENABLED #include "core/ustring.h" #include "core/variant.h" #include "core/vector.h" +#include "../mono_gd/gd_mono_marshal.h" + MonoArray *godot_icall_String_md5_buffer(MonoString *p_str) { Vector<uint8_t> ret = GDMonoMarshal::mono_string_to_godot(p_str).md5_buffer(); // TODO Check possible Array/Vector<uint8_t> problem? diff --git a/modules/mono/glue/string_glue.h b/modules/mono/glue/string_glue.h deleted file mode 100644 index a5e833ba61..0000000000 --- a/modules/mono/glue/string_glue.h +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************/ -/* string_glue.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 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 */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef STRING_GLUE_H -#define STRING_GLUE_H - -#ifdef MONO_GLUE_ENABLED - -#include "../mono_gd/gd_mono_marshal.h" - -MonoArray *godot_icall_String_md5_buffer(MonoString *p_str); - -MonoString *godot_icall_String_md5_text(MonoString *p_str); - -int godot_icall_String_rfind(MonoString *p_str, MonoString *p_what, int p_from); - -int godot_icall_String_rfindn(MonoString *p_str, MonoString *p_what, int p_from); - -MonoArray *godot_icall_String_sha256_buffer(MonoString *p_str); - -MonoString *godot_icall_String_sha256_text(MonoString *p_str); - -// Register internal calls - -void godot_register_string_icalls(); - -#endif // MONO_GLUE_ENABLED - -#endif // STRING_GLUE_H diff --git a/modules/mono/glue/string_name_glue.cpp b/modules/mono/glue/string_name_glue.cpp index 81006e5849..4b2e88569b 100644 --- a/modules/mono/glue/string_name_glue.cpp +++ b/modules/mono/glue/string_name_glue.cpp @@ -28,12 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "string_name_glue.h" - #ifdef MONO_GLUE_ENABLED +#include "core/string_name.h" #include "core/ustring.h" +#include "../mono_gd/gd_mono_marshal.h" + StringName *godot_icall_StringName_Ctor(MonoString *p_path) { return memnew(StringName(GDMonoMarshal::mono_string_to_godot(p_path))); } @@ -48,7 +49,7 @@ MonoString *godot_icall_StringName_operator_String(StringName *p_np) { } MonoBoolean godot_icall_StringName_is_empty(StringName *p_ptr) { - return (MonoBoolean)(p_ptr == StringName()); + return (MonoBoolean)(*p_ptr == StringName()); } void godot_register_string_name_icalls() { diff --git a/modules/mono/glue/string_name_glue.h b/modules/mono/glue/string_name_glue.h deleted file mode 100644 index 88354ddd84..0000000000 --- a/modules/mono/glue/string_name_glue.h +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************/ -/* string_name_glue.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 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 */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef STRING_NAME_GLUE_H -#define STRING_NAME_GLUE_H - -#ifdef MONO_GLUE_ENABLED - -#include "core/string_name.h" - -#include "../mono_gd/gd_mono_marshal.h" - -StringName *godot_icall_StringName_Ctor(MonoString *p_path); - -void godot_icall_StringName_Dtor(StringName *p_ptr); - -MonoString *godot_icall_StringName_operator_String(StringName *p_np); - -MonoBoolean godot_icall_StringName_is_empty(StringName *p_ptr); - -// Register internal calls - -void godot_register_string_name_icalls(); - -#endif // MONO_GLUE_ENABLED - -#endif // STRING_NAME_GLUE_H |