diff options
Diffstat (limited to 'include/godot_cpp/core')
-rw-r--r-- | include/godot_cpp/core/binder_common.hpp | 82 | ||||
-rw-r--r-- | include/godot_cpp/core/builtin_ptrcall.hpp | 12 | ||||
-rw-r--r-- | include/godot_cpp/core/class_db.hpp | 36 | ||||
-rw-r--r-- | include/godot_cpp/core/defs.hpp | 2 | ||||
-rw-r--r-- | include/godot_cpp/core/engine_ptrcall.hpp | 12 | ||||
-rw-r--r-- | include/godot_cpp/core/math.hpp | 4 | ||||
-rw-r--r-- | include/godot_cpp/core/memory.hpp | 14 | ||||
-rw-r--r-- | include/godot_cpp/core/method_bind.hpp | 42 | ||||
-rw-r--r-- | include/godot_cpp/core/method_ptrcall.hpp | 6 | ||||
-rw-r--r-- | include/godot_cpp/core/object.hpp | 16 | ||||
-rw-r--r-- | include/godot_cpp/core/type_info.hpp | 8 |
11 files changed, 117 insertions, 117 deletions
diff --git a/include/godot_cpp/core/binder_common.hpp b/include/godot_cpp/core/binder_common.hpp index ce90acd..26ed4ca 100644 --- a/include/godot_cpp/core/binder_common.hpp +++ b/include/godot_cpp/core/binder_common.hpp @@ -83,7 +83,7 @@ namespace godot { }; \ } -template <class T> +template <typename T> struct VariantCaster { static _FORCE_INLINE_ T cast(const Variant &p_variant) { using TStripped = std::remove_pointer_t<T>; @@ -95,7 +95,7 @@ struct VariantCaster { } }; -template <class T> +template <typename T> struct VariantCaster<T &> { static _FORCE_INLINE_ T cast(const Variant &p_variant) { using TStripped = std::remove_pointer_t<T>; @@ -107,7 +107,7 @@ struct VariantCaster<T &> { } }; -template <class T> +template <typename T> struct VariantCaster<const T &> { static _FORCE_INLINE_ T cast(const Variant &p_variant) { using TStripped = std::remove_pointer_t<T>; @@ -144,7 +144,7 @@ struct VariantObjectClassChecker<const Ref<T> &> { } }; -template <class T> +template <typename T> struct VariantCasterAndValidate { static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDExtensionCallError &r_error) { GDExtensionVariantType argtype = GDExtensionVariantType(GetTypeInfo<T>::VARIANT_TYPE); @@ -159,7 +159,7 @@ struct VariantCasterAndValidate { } }; -template <class T> +template <typename T> struct VariantCasterAndValidate<T &> { static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDExtensionCallError &r_error) { GDExtensionVariantType argtype = GDExtensionVariantType(GetTypeInfo<T>::VARIANT_TYPE); @@ -174,7 +174,7 @@ struct VariantCasterAndValidate<T &> { } }; -template <class T> +template <typename T> struct VariantCasterAndValidate<const T &> { static _FORCE_INLINE_ T cast(const Variant **p_args, uint32_t p_arg_idx, GDExtensionCallError &r_error) { GDExtensionVariantType argtype = GDExtensionVariantType(GetTypeInfo<T>::VARIANT_TYPE); @@ -189,47 +189,47 @@ struct VariantCasterAndValidate<const T &> { } }; -template <class T, class... P, size_t... Is> +template <typename T, typename... P, size_t... Is> void call_with_ptr_args_helper(T *p_instance, void (T::*p_method)(P...), const GDExtensionConstTypePtr *p_args, IndexSequence<Is...>) { (p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...); } -template <class T, class... P, size_t... Is> +template <typename T, typename... P, size_t... Is> void call_with_ptr_argsc_helper(T *p_instance, void (T::*p_method)(P...) const, const GDExtensionConstTypePtr *p_args, IndexSequence<Is...>) { (p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...); } -template <class T, class R, class... P, size_t... Is> +template <typename T, typename R, typename... P, size_t... Is> void call_with_ptr_args_ret_helper(T *p_instance, R (T::*p_method)(P...), const GDExtensionConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) { PtrToArg<R>::encode((p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...), r_ret); } -template <class T, class R, class... P, size_t... Is> +template <typename T, typename R, typename... P, size_t... Is> void call_with_ptr_args_retc_helper(T *p_instance, R (T::*p_method)(P...) const, const GDExtensionConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) { PtrToArg<R>::encode((p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...), r_ret); } -template <class T, class... P> +template <typename T, typename... P> void call_with_ptr_args(T *p_instance, void (T::*p_method)(P...), const GDExtensionConstTypePtr *p_args, void * /*ret*/) { call_with_ptr_args_helper<T, P...>(p_instance, p_method, p_args, BuildIndexSequence<sizeof...(P)>{}); } -template <class T, class... P> +template <typename T, typename... P> void call_with_ptr_args(T *p_instance, void (T::*p_method)(P...) const, const GDExtensionConstTypePtr *p_args, void * /*ret*/) { call_with_ptr_argsc_helper<T, P...>(p_instance, p_method, p_args, BuildIndexSequence<sizeof...(P)>{}); } -template <class T, class R, class... P> +template <typename T, typename R, typename... P> void call_with_ptr_args(T *p_instance, R (T::*p_method)(P...), const GDExtensionConstTypePtr *p_args, void *r_ret) { call_with_ptr_args_ret_helper<T, R, P...>(p_instance, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{}); } -template <class T, class R, class... P> +template <typename T, typename R, typename... P> void call_with_ptr_args(T *p_instance, R (T::*p_method)(P...) const, const GDExtensionConstTypePtr *p_args, void *r_ret) { call_with_ptr_args_retc_helper<T, R, P...>(p_instance, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{}); } -template <class T, class... P, size_t... Is> +template <typename T, typename... P, size_t... Is> void call_with_variant_args_helper(T *p_instance, void (T::*p_method)(P...), const Variant **p_args, GDExtensionCallError &r_error, IndexSequence<Is...>) { r_error.error = GDEXTENSION_CALL_OK; @@ -241,7 +241,7 @@ void call_with_variant_args_helper(T *p_instance, void (T::*p_method)(P...), con (void)(p_args); // Avoid warning. } -template <class T, class... P, size_t... Is> +template <typename T, typename... P, size_t... Is> void call_with_variant_argsc_helper(T *p_instance, void (T::*p_method)(P...) const, const Variant **p_args, GDExtensionCallError &r_error, IndexSequence<Is...>) { r_error.error = GDEXTENSION_CALL_OK; @@ -253,7 +253,7 @@ void call_with_variant_argsc_helper(T *p_instance, void (T::*p_method)(P...) con (void)(p_args); // Avoid warning. } -template <class T, class R, class... P, size_t... Is> +template <typename T, typename R, typename... P, size_t... Is> void call_with_variant_args_ret_helper(T *p_instance, R (T::*p_method)(P...), const Variant **p_args, Variant &r_ret, GDExtensionCallError &r_error, IndexSequence<Is...>) { r_error.error = GDEXTENSION_CALL_OK; @@ -264,7 +264,7 @@ void call_with_variant_args_ret_helper(T *p_instance, R (T::*p_method)(P...), co #endif } -template <class T, class R, class... P, size_t... Is> +template <typename T, typename R, typename... P, size_t... Is> void call_with_variant_args_retc_helper(T *p_instance, R (T::*p_method)(P...) const, const Variant **p_args, Variant &r_ret, GDExtensionCallError &r_error, IndexSequence<Is...>) { r_error.error = GDEXTENSION_CALL_OK; @@ -276,7 +276,7 @@ void call_with_variant_args_retc_helper(T *p_instance, R (T::*p_method)(P...) co (void)p_args; } -template <class T, class... P> +template <typename T, typename... P> void call_with_variant_args(T *p_instance, void (T::*p_method)(P...), const Variant **p_args, int p_argcount, GDExtensionCallError &r_error) { #ifdef DEBUG_ENABLED if ((size_t)p_argcount > sizeof...(P)) { @@ -294,7 +294,7 @@ void call_with_variant_args(T *p_instance, void (T::*p_method)(P...), const Vari call_with_variant_args_helper<T, P...>(p_instance, p_method, p_args, r_error, BuildIndexSequence<sizeof...(P)>{}); } -template <class T, class R, class... P> +template <typename T, typename R, typename... P> void call_with_variant_args_ret(T *p_instance, R (T::*p_method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, GDExtensionCallError &r_error) { #ifdef DEBUG_ENABLED if ((size_t)p_argcount > sizeof...(P)) { @@ -312,7 +312,7 @@ void call_with_variant_args_ret(T *p_instance, R (T::*p_method)(P...), const Var call_with_variant_args_ret_helper<T, R, P...>(p_instance, p_method, p_args, r_ret, r_error, BuildIndexSequence<sizeof...(P)>{}); } -template <class T, class R, class... P> +template <typename T, typename R, typename... P> void call_with_variant_args_retc(T *p_instance, R (T::*p_method)(P...) const, const Variant **p_args, int p_argcount, Variant &r_ret, GDExtensionCallError &r_error) { #ifdef DEBUG_ENABLED if ((size_t)p_argcount > sizeof...(P)) { @@ -330,7 +330,7 @@ void call_with_variant_args_retc(T *p_instance, R (T::*p_method)(P...) const, co call_with_variant_args_retc_helper<T, R, P...>(p_instance, p_method, p_args, r_ret, r_error, BuildIndexSequence<sizeof...(P)>{}); } -template <class T, class... P> +template <typename T, typename... P> void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const GDExtensionConstVariantPtr *p_args, int p_argcount, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) { #ifdef DEBUG_ENABLED if ((size_t)p_argcount > sizeof...(P)) { @@ -365,7 +365,7 @@ void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const G call_with_variant_args_helper(p_instance, p_method, argsp.data(), r_error, BuildIndexSequence<sizeof...(P)>{}); } -template <class T, class... P> +template <typename T, typename... P> void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const, const GDExtensionConstVariantPtr *p_args, int p_argcount, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) { #ifdef DEBUG_ENABLED if ((size_t)p_argcount > sizeof...(P)) { @@ -400,7 +400,7 @@ void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const, call_with_variant_argsc_helper(p_instance, p_method, argsp.data(), r_error, BuildIndexSequence<sizeof...(P)>{}); } -template <class T, class R, class... P> +template <typename T, typename R, typename... P> void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const GDExtensionConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) { #ifdef DEBUG_ENABLED if ((size_t)p_argcount > sizeof...(P)) { @@ -435,7 +435,7 @@ void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const call_with_variant_args_ret_helper(p_instance, p_method, argsp.data(), r_ret, r_error, BuildIndexSequence<sizeof...(P)>{}); } -template <class T, class R, class... P> +template <typename T, typename R, typename... P> void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const, const GDExtensionConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) { #ifdef DEBUG_ENABLED if ((size_t)p_argcount > sizeof...(P)) { @@ -477,7 +477,7 @@ void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const, #pragma GCC diagnostic ignored "-Wunused-but-set-parameter" #endif -template <class Q> +template <typename Q> void call_get_argument_type_helper(int p_arg, int &index, GDExtensionVariantType &type) { if (p_arg == index) { type = GDExtensionVariantType(GetTypeInfo<Q>::VARIANT_TYPE); @@ -485,7 +485,7 @@ void call_get_argument_type_helper(int p_arg, int &index, GDExtensionVariantType index++; } -template <class... P> +template <typename... P> GDExtensionVariantType call_get_argument_type(int p_arg) { GDExtensionVariantType type = GDEXTENSION_VARIANT_TYPE_NIL; int index = 0; @@ -497,7 +497,7 @@ GDExtensionVariantType call_get_argument_type(int p_arg) { return type; } -template <class Q> +template <typename Q> void call_get_argument_type_info_helper(int p_arg, int &index, PropertyInfo &info) { if (p_arg == index) { info = GetTypeInfo<Q>::get_class_info(); @@ -505,7 +505,7 @@ void call_get_argument_type_info_helper(int p_arg, int &index, PropertyInfo &inf index++; } -template <class... P> +template <typename... P> void call_get_argument_type_info(int p_arg, PropertyInfo &info) { int index = 0; // I think rocket science is simpler than modern C++. @@ -515,7 +515,7 @@ void call_get_argument_type_info(int p_arg, PropertyInfo &info) { (void)index; // Suppress GCC warning. } -template <class Q> +template <typename Q> void call_get_argument_metadata_helper(int p_arg, int &index, GDExtensionClassMethodArgumentMetadata &md) { if (p_arg == index) { md = GetTypeInfo<Q>::METADATA; @@ -523,7 +523,7 @@ void call_get_argument_metadata_helper(int p_arg, int &index, GDExtensionClassMe index++; } -template <class... P> +template <typename... P> GDExtensionClassMethodArgumentMetadata call_get_argument_metadata(int p_arg) { GDExtensionClassMethodArgumentMetadata md = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; @@ -536,7 +536,7 @@ GDExtensionClassMethodArgumentMetadata call_get_argument_metadata(int p_arg) { return md; } -template <class... P, size_t... Is> +template <typename... P, size_t... Is> void call_with_variant_args_static(void (*p_method)(P...), const Variant **p_args, GDExtensionCallError &r_error, IndexSequence<Is...>) { r_error.error = GDEXTENSION_CALL_OK; @@ -547,7 +547,7 @@ void call_with_variant_args_static(void (*p_method)(P...), const Variant **p_arg #endif } -template <class... P> +template <typename... P> void call_with_variant_args_static_dv(void (*p_method)(P...), const GDExtensionConstVariantPtr *p_args, int p_argcount, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) { #ifdef DEBUG_ENABLED if ((size_t)p_argcount > sizeof...(P)) { @@ -582,17 +582,17 @@ void call_with_variant_args_static_dv(void (*p_method)(P...), const GDExtensionC call_with_variant_args_static(p_method, argsp.data(), r_error, BuildIndexSequence<sizeof...(P)>{}); } -template <class... P, size_t... Is> +template <typename... P, size_t... Is> void call_with_ptr_args_static_method_helper(void (*p_method)(P...), const GDExtensionConstTypePtr *p_args, IndexSequence<Is...>) { p_method(PtrToArg<P>::convert(p_args[Is])...); } -template <class... P> +template <typename... P> void call_with_ptr_args_static_method(void (*p_method)(P...), const GDExtensionConstTypePtr *p_args) { call_with_ptr_args_static_method_helper<P...>(p_method, p_args, BuildIndexSequence<sizeof...(P)>{}); } -template <class R, class... P> +template <typename R, typename... P> void call_with_variant_args_static_ret(R (*p_method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, GDExtensionCallError &r_error) { #ifdef DEBUG_ENABLED if ((size_t)p_argcount > sizeof...(P)) { @@ -610,7 +610,7 @@ void call_with_variant_args_static_ret(R (*p_method)(P...), const Variant **p_ar call_with_variant_args_static_ret<R, P...>(p_method, p_args, r_ret, r_error, BuildIndexSequence<sizeof...(P)>{}); } -template <class... P> +template <typename... P> void call_with_variant_args_static_ret(void (*p_method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, GDExtensionCallError &r_error) { #ifdef DEBUG_ENABLED if ((size_t)p_argcount > sizeof...(P)) { @@ -628,7 +628,7 @@ void call_with_variant_args_static_ret(void (*p_method)(P...), const Variant **p call_with_variant_args_static<P...>(p_method, p_args, r_error, BuildIndexSequence<sizeof...(P)>{}); } -template <class R, class... P, size_t... Is> +template <typename R, typename... P, size_t... Is> void call_with_variant_args_static_ret(R (*p_method)(P...), const Variant **p_args, Variant &r_ret, GDExtensionCallError &r_error, IndexSequence<Is...>) { r_error.error = GDEXTENSION_CALL_OK; @@ -639,7 +639,7 @@ void call_with_variant_args_static_ret(R (*p_method)(P...), const Variant **p_ar #endif } -template <class R, class... P> +template <typename R, typename... P> void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const GDExtensionConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDExtensionCallError &r_error, const std::vector<Variant> &default_values) { #ifdef DEBUG_ENABLED if ((size_t)p_argcount > sizeof...(P)) { @@ -674,12 +674,12 @@ void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const GDExtension call_with_variant_args_static_ret(p_method, argsp.data(), r_ret, r_error, BuildIndexSequence<sizeof...(P)>{}); } -template <class R, class... P, size_t... Is> +template <typename R, typename... P, size_t... Is> void call_with_ptr_args_static_method_ret_helper(R (*p_method)(P...), const GDExtensionConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) { PtrToArg<R>::encode(p_method(PtrToArg<P>::convert(p_args[Is])...), r_ret); } -template <class R, class... P> +template <typename R, typename... P> void call_with_ptr_args_static_method_ret(R (*p_method)(P...), const GDExtensionConstTypePtr *p_args, void *r_ret) { call_with_ptr_args_static_method_ret_helper<R, P...>(p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{}); } diff --git a/include/godot_cpp/core/builtin_ptrcall.hpp b/include/godot_cpp/core/builtin_ptrcall.hpp index 19250d8..286051f 100644 --- a/include/godot_cpp/core/builtin_ptrcall.hpp +++ b/include/godot_cpp/core/builtin_ptrcall.hpp @@ -40,7 +40,7 @@ namespace godot { namespace internal { -template <class O, class... Args> +template <typename O, typename... Args> O *_call_builtin_method_ptr_ret_obj(const GDExtensionPtrBuiltInMethod method, GDExtensionTypePtr base, const Args &...args) { GodotObject *ret = nullptr; std::array<GDExtensionConstTypePtr, sizeof...(Args)> call_args = { { (GDExtensionConstTypePtr)args... } }; @@ -51,13 +51,13 @@ O *_call_builtin_method_ptr_ret_obj(const GDExtensionPtrBuiltInMethod method, GD return reinterpret_cast<O *>(internal::get_object_instance_binding(ret)); } -template <class... Args> +template <typename... Args> void _call_builtin_constructor(const GDExtensionPtrConstructor constructor, GDExtensionTypePtr base, Args... args) { std::array<GDExtensionConstTypePtr, sizeof...(Args)> call_args = { { (GDExtensionConstTypePtr)args... } }; constructor(base, call_args.data()); } -template <class T, class... Args> +template <typename T, typename... Args> T _call_builtin_method_ptr_ret(const GDExtensionPtrBuiltInMethod method, GDExtensionTypePtr base, Args... args) { T ret; std::array<GDExtensionConstTypePtr, sizeof...(Args)> call_args = { { (GDExtensionConstTypePtr)args... } }; @@ -65,20 +65,20 @@ T _call_builtin_method_ptr_ret(const GDExtensionPtrBuiltInMethod method, GDExten return ret; } -template <class... Args> +template <typename... Args> void _call_builtin_method_ptr_no_ret(const GDExtensionPtrBuiltInMethod method, GDExtensionTypePtr base, Args... args) { std::array<GDExtensionConstTypePtr, sizeof...(Args)> call_args = { { (GDExtensionConstTypePtr)args... } }; method(base, call_args.data(), nullptr, sizeof...(Args)); } -template <class T> +template <typename T> T _call_builtin_operator_ptr(const GDExtensionPtrOperatorEvaluator op, GDExtensionConstTypePtr left, GDExtensionConstTypePtr right) { T ret; op(left, right, &ret); return ret; } -template <class T> +template <typename T> T _call_builtin_ptr_getter(const GDExtensionPtrGetter getter, GDExtensionConstTypePtr base) { T ret; getter(base, &ret); diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp index 91748e6..fdac1e2 100644 --- a/include/godot_cpp/core/class_db.hpp +++ b/include/godot_cpp/core/class_db.hpp @@ -109,10 +109,10 @@ private: static void initialize_class(const ClassInfo &cl); static void bind_method_godot(const StringName &p_class_name, MethodBind *p_method); - template <class T, bool is_abstract> + template <typename T, bool is_abstract> static void _register_class(bool p_virtual = false, bool p_exposed = true, bool p_runtime = false); - template <class T> + template <typename T> static GDExtensionObjectPtr _create_instance_func(void *data) { if constexpr (!std::is_abstract_v<T>) { T *new_object = memnew(T); @@ -122,7 +122,7 @@ private: } } - template <class T> + template <typename T> static GDExtensionClassInstancePtr _recreate_instance_func(void *data, GDExtensionObjectPtr obj) { if constexpr (!std::is_abstract_v<T>) { #ifdef HOT_RELOAD_ENABLED @@ -140,26 +140,26 @@ private: } public: - template <class T> + template <typename T> static void register_class(bool p_virtual = false); - template <class T> + template <typename T> static void register_abstract_class(); - template <class T> + template <typename T> static void register_internal_class(); - template <class T> + template <typename T> static void register_runtime_class(); _FORCE_INLINE_ static void _register_engine_class(const StringName &p_name, const GDExtensionInstanceBindingCallbacks *p_callbacks) { instance_binding_callbacks[p_name] = p_callbacks; } - template <class N, class M, typename... VarArgs> + template <typename N, typename M, typename... VarArgs> static MethodBind *bind_method(N p_method_name, M p_method, VarArgs... p_args); - template <class N, class M, typename... VarArgs> + template <typename N, typename M, typename... VarArgs> static MethodBind *bind_static_method(StringName p_class, N p_method_name, M p_method, VarArgs... p_args); - template <class M> + template <typename M> static MethodBind *bind_vararg_method(uint32_t p_flags, StringName p_name, M p_method, const MethodInfo &p_info = MethodInfo(), const std::vector<Variant> &p_default_args = std::vector<Variant>{}, bool p_return_nil_is_variant = true); static void add_property_group(const StringName &p_class, const String &p_name, const String &p_prefix); @@ -200,7 +200,7 @@ public: godot::ClassDB::bind_virtual_method(m_class::get_class_static(), #m_method, _call##m_method); \ } -template <class T, bool is_abstract> +template <typename T, bool is_abstract> void ClassDB::_register_class(bool p_virtual, bool p_exposed, bool p_runtime) { static_assert(TypesAreSame<typename T::self_type, T>::value, "Class not declared properly, please use GDCLASS."); instance_binding_callbacks[T::get_class_static()] = &T::_gde_binding_callbacks; @@ -254,27 +254,27 @@ void ClassDB::_register_class(bool p_virtual, bool p_exposed, bool p_runtime) { initialize_class(classes[cl.name]); } -template <class T> +template <typename T> void ClassDB::register_class(bool p_virtual) { ClassDB::_register_class<T, false>(p_virtual); } -template <class T> +template <typename T> void ClassDB::register_abstract_class() { ClassDB::_register_class<T, true>(); } -template <class T> +template <typename T> void ClassDB::register_internal_class() { ClassDB::_register_class<T, false>(false, false); } -template <class T> +template <typename T> void ClassDB::register_runtime_class() { ClassDB::_register_class<T, false>(false, true, true); } -template <class N, class M, typename... VarArgs> +template <typename N, typename M, typename... VarArgs> MethodBind *ClassDB::bind_method(N p_method_name, M p_method, VarArgs... p_args) { Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; // +1 makes sure zero sized arrays are also supported. const Variant *argptrs[sizeof...(p_args) + 1]; @@ -285,7 +285,7 @@ MethodBind *ClassDB::bind_method(N p_method_name, M p_method, VarArgs... p_args) return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, sizeof...(p_args) == 0 ? nullptr : (const void **)argptrs, sizeof...(p_args)); } -template <class N, class M, typename... VarArgs> +template <typename N, typename M, typename... VarArgs> MethodBind *ClassDB::bind_static_method(StringName p_class, N p_method_name, M p_method, VarArgs... p_args) { Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; // +1 makes sure zero sized arrays are also supported. const Variant *argptrs[sizeof...(p_args) + 1]; @@ -297,7 +297,7 @@ MethodBind *ClassDB::bind_static_method(StringName p_class, N p_method_name, M p return bind_methodfi(0, bind, p_method_name, sizeof...(p_args) == 0 ? nullptr : (const void **)argptrs, sizeof...(p_args)); } -template <class M> +template <typename M> MethodBind *ClassDB::bind_vararg_method(uint32_t p_flags, StringName p_name, M p_method, const MethodInfo &p_info, const std::vector<Variant> &p_default_args, bool p_return_nil_is_variant) { MethodBind *bind = create_vararg_method_bind(p_method, p_info, p_return_nil_is_variant); ERR_FAIL_NULL_V(bind, nullptr); diff --git a/include/godot_cpp/core/defs.hpp b/include/godot_cpp/core/defs.hpp index c03db50..16812c2 100644 --- a/include/godot_cpp/core/defs.hpp +++ b/include/godot_cpp/core/defs.hpp @@ -108,7 +108,7 @@ typedef float real_t; // Generic swap template. #ifndef SWAP #define SWAP(m_x, m_y) __swap_tmpl((m_x), (m_y)) -template <class T> +template <typename T> inline void __swap_tmpl(T &x, T &y) { T aux = x; x = y; diff --git a/include/godot_cpp/core/engine_ptrcall.hpp b/include/godot_cpp/core/engine_ptrcall.hpp index 69ab196..482dfab 100644 --- a/include/godot_cpp/core/engine_ptrcall.hpp +++ b/include/godot_cpp/core/engine_ptrcall.hpp @@ -43,7 +43,7 @@ namespace godot { namespace internal { -template <class O, class... Args> +template <typename O, typename... Args> O *_call_native_mb_ret_obj(const GDExtensionMethodBindPtr mb, void *instance, const Args &...args) { GodotObject *ret = nullptr; std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } }; @@ -54,7 +54,7 @@ O *_call_native_mb_ret_obj(const GDExtensionMethodBindPtr mb, void *instance, co return reinterpret_cast<O *>(internal::get_object_instance_binding(ret)); } -template <class R, class... Args> +template <typename R, typename... Args> R _call_native_mb_ret(const GDExtensionMethodBindPtr mb, void *instance, const Args &...args) { R ret; std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } }; @@ -62,13 +62,13 @@ R _call_native_mb_ret(const GDExtensionMethodBindPtr mb, void *instance, const A return ret; } -template <class... Args> +template <typename... Args> void _call_native_mb_no_ret(const GDExtensionMethodBindPtr mb, void *instance, const Args &...args) { std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } }; internal::gdextension_interface_object_method_bind_ptrcall(mb, instance, mb_args.data(), nullptr); } -template <class R, class... Args> +template <typename R, typename... Args> R _call_utility_ret(GDExtensionPtrUtilityFunction func, const Args &...args) { R ret; std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } }; @@ -76,7 +76,7 @@ R _call_utility_ret(GDExtensionPtrUtilityFunction func, const Args &...args) { return ret; } -template <class... Args> +template <typename... Args> Object *_call_utility_ret_obj(const GDExtensionPtrUtilityFunction func, void *instance, const Args &...args) { GodotObject *ret = nullptr; std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } }; @@ -84,7 +84,7 @@ Object *_call_utility_ret_obj(const GDExtensionPtrUtilityFunction func, void *in return (Object *)internal::get_object_instance_binding(ret); } -template <class... Args> +template <typename... Args> void _call_utility_no_ret(const GDExtensionPtrUtilityFunction func, const Args &...args) { std::array<GDExtensionConstTypePtr, sizeof...(Args)> mb_args = { { (GDExtensionConstTypePtr)args... } }; func(nullptr, mb_args.data(), mb_args.size()); diff --git a/include/godot_cpp/core/math.hpp b/include/godot_cpp/core/math.hpp index db97ba5..2cbbe27 100644 --- a/include/godot_cpp/core/math.hpp +++ b/include/godot_cpp/core/math.hpp @@ -84,7 +84,7 @@ constexpr auto CLAMP(const T m_a, const T2 m_min, const T3 m_max) { // Generic swap template. #ifndef SWAP #define SWAP(m_x, m_y) __swap_tmpl((m_x), (m_y)) -template <class T> +template <typename T> inline void __swap_tmpl(T &x, T &y) { T aux = x; x = y; @@ -138,7 +138,7 @@ static inline int get_shift_from_power_of_2(unsigned int p_bits) { return -1; } -template <class T> +template <typename T> static _FORCE_INLINE_ T nearest_power_of_2_templated(T x) { --x; diff --git a/include/godot_cpp/core/memory.hpp b/include/godot_cpp/core/memory.hpp index 6775cf7..3c98c19 100644 --- a/include/godot_cpp/core/memory.hpp +++ b/include/godot_cpp/core/memory.hpp @@ -84,7 +84,7 @@ public: _ALWAYS_INLINE_ void postinitialize_handler(void *) {} -template <class T> +template <typename T> _ALWAYS_INLINE_ T *_post_initialize(T *p_obj) { postinitialize_handler(p_obj); return p_obj; @@ -100,12 +100,12 @@ _ALWAYS_INLINE_ T *_post_initialize(T *p_obj) { #define memnew_placement(m_placement, m_class) ::godot::_post_initialize(new ("", m_placement, sizeof(m_class), "") m_class) // Generic comparator used in Map, List, etc. -template <class T> +template <typename T> struct Comparator { _ALWAYS_INLINE_ bool operator()(const T &p_a, const T &p_b) const { return (p_a < p_b); } }; -template <class T> +template <typename T> void memdelete(T *p_class, typename std::enable_if<!std::is_base_of_v<godot::Wrapped, T>>::type * = nullptr) { if constexpr (!std::is_trivially_destructible_v<T>) { p_class->~T(); @@ -114,12 +114,12 @@ void memdelete(T *p_class, typename std::enable_if<!std::is_base_of_v<godot::Wra Memory::free_static(p_class); } -template <class T, std::enable_if_t<std::is_base_of_v<godot::Wrapped, T>, bool> = true> +template <typename T, std::enable_if_t<std::is_base_of_v<godot::Wrapped, T>, bool> = true> void memdelete(T *p_class) { godot::internal::gdextension_interface_object_destroy(p_class->_owner); } -template <class T, class A> +template <typename T, typename A> void memdelete_allocator(T *p_class) { if constexpr (!std::is_trivially_destructible_v<T>) { p_class->~T(); @@ -134,10 +134,10 @@ public: _ALWAYS_INLINE_ static void free(void *p_ptr) { Memory::free_static(p_ptr); } }; -template <class T> +template <typename T> class DefaultTypedAllocator { public: - template <class... Args> + template <typename... Args> _ALWAYS_INLINE_ T *new_allocation(const Args &&...p_args) { return memnew(T(p_args...)); } _ALWAYS_INLINE_ void delete_allocation(T *p_allocation) { memdelete(p_allocation); } }; diff --git a/include/godot_cpp/core/method_bind.hpp b/include/godot_cpp/core/method_bind.hpp index 37ae731..4afd7b8 100644 --- a/include/godot_cpp/core/method_bind.hpp +++ b/include/godot_cpp/core/method_bind.hpp @@ -147,7 +147,7 @@ public: virtual ~MethodBind(); }; -template <class Derived, class T, class R, bool should_returns> +template <typename Derived, typename T, typename R, bool should_returns> class MethodBindVarArgBase : public MethodBind { protected: R(T::*method) @@ -208,7 +208,7 @@ private: } }; -template <class T> +template <typename T> class MethodBindVarArgT : public MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false> { friend class MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>; @@ -231,14 +231,14 @@ private: } }; -template <class T> +template <typename T> MethodBind *create_vararg_method_bind(void (T::*p_method)(const Variant **, GDExtensionInt, GDExtensionCallError &), const MethodInfo &p_info, bool p_return_nil_is_variant) { MethodBind *a = memnew((MethodBindVarArgT<T>)(p_method, p_info, p_return_nil_is_variant)); a->set_instance_class(T::get_class_static()); return a; } -template <class T, class R> +template <typename T, typename R> class MethodBindVarArgTR : public MethodBindVarArgBase<MethodBindVarArgTR<T, R>, T, R, true> { friend class MethodBindVarArgBase<MethodBindVarArgTR<T, R>, T, R, true>; @@ -260,7 +260,7 @@ private: } }; -template <class T, class R> +template <typename T, typename R> MethodBind *create_vararg_method_bind(R (T::*p_method)(const Variant **, GDExtensionInt, GDExtensionCallError &), const MethodInfo &p_info, bool p_return_nil_is_variant) { MethodBind *a = memnew((MethodBindVarArgTR<T, R>)(p_method, p_info, p_return_nil_is_variant)); a->set_instance_class(T::get_class_static()); @@ -277,9 +277,9 @@ class _gde_UnexistingClass; // No return, not const. #ifdef TYPED_METHOD_BIND -template <class T, class... P> +template <typename T, typename... P> #else -template <class... P> +template <typename... P> #endif // TYPED_METHOD_BIND class MethodBindT : public MethodBind { void (MB_T::*method)(P...); @@ -339,7 +339,7 @@ public: } }; -template <class T, class... P> +template <typename T, typename... P> MethodBind *create_method_bind(void (T::*p_method)(P...)) { #ifdef TYPED_METHOD_BIND MethodBind *a = memnew((MethodBindT<T, P...>)(p_method)); @@ -353,9 +353,9 @@ MethodBind *create_method_bind(void (T::*p_method)(P...)) { // No return, const. #ifdef TYPED_METHOD_BIND -template <class T, class... P> +template <typename T, typename... P> #else -template <class... P> +template <typename... P> #endif // TYPED_METHOD_BIND class MethodBindTC : public MethodBind { void (MB_T::*method)(P...) const; @@ -415,7 +415,7 @@ public: } }; -template <class T, class... P> +template <typename T, typename... P> MethodBind *create_method_bind(void (T::*p_method)(P...) const) { #ifdef TYPED_METHOD_BIND MethodBind *a = memnew((MethodBindTC<T, P...>)(p_method)); @@ -429,9 +429,9 @@ MethodBind *create_method_bind(void (T::*p_method)(P...) const) { // Return, not const. #ifdef TYPED_METHOD_BIND -template <class T, class R, class... P> +template <typename T, typename R, typename... P> #else -template <class R, class... P> +template <typename R, typename... P> #endif // TYPED_METHOD_BIND class MethodBindTR : public MethodBind { R(MB_T::*method) @@ -498,7 +498,7 @@ public: } }; -template <class T, class R, class... P> +template <typename T, typename R, typename... P> MethodBind *create_method_bind(R (T::*p_method)(P...)) { #ifdef TYPED_METHOD_BIND MethodBind *a = memnew((MethodBindTR<T, R, P...>)(p_method)); @@ -512,9 +512,9 @@ MethodBind *create_method_bind(R (T::*p_method)(P...)) { // Return, const. #ifdef TYPED_METHOD_BIND -template <class T, class R, class... P> +template <typename T, typename R, typename... P> #else -template <class R, class... P> +template <typename R, typename... P> #endif // TYPED_METHOD_BIND class MethodBindTRC : public MethodBind { R(MB_T::*method) @@ -581,7 +581,7 @@ public: } }; -template <class T, class R, class... P> +template <typename T, typename R, typename... P> MethodBind *create_method_bind(R (T::*p_method)(P...) const) { #ifdef TYPED_METHOD_BIND MethodBind *a = memnew((MethodBindTRC<T, R, P...>)(p_method)); @@ -596,7 +596,7 @@ MethodBind *create_method_bind(R (T::*p_method)(P...) const) { // no return -template <class... P> +template <typename... P> class MethodBindTS : public MethodBind { void (*function)(P...); @@ -652,7 +652,7 @@ public: } }; -template <class... P> +template <typename... P> MethodBind *create_static_method_bind(void (*p_method)(P...)) { MethodBind *a = memnew((MethodBindTS<P...>)(p_method)); return a; @@ -660,7 +660,7 @@ MethodBind *create_static_method_bind(void (*p_method)(P...)) { // return -template <class R, class... P> +template <typename R, typename... P> class MethodBindTRS : public MethodBind { R(*function) (P...); @@ -722,7 +722,7 @@ public: } }; -template <class R, class... P> +template <typename R, typename... P> MethodBind *create_static_method_bind(R (*p_method)(P...)) { MethodBind *a = memnew((MethodBindTRS<R, P...>)(p_method)); return a; diff --git a/include/godot_cpp/core/method_ptrcall.hpp b/include/godot_cpp/core/method_ptrcall.hpp index 32f3f45..ca3327e 100644 --- a/include/godot_cpp/core/method_ptrcall.hpp +++ b/include/godot_cpp/core/method_ptrcall.hpp @@ -39,7 +39,7 @@ namespace godot { -template <class T> +template <typename T> struct PtrToArg {}; #define MAKE_PTRARG(m_type) \ @@ -166,7 +166,7 @@ MAKE_PTRARG_BY_REFERENCE(Variant); // This is for Object. -template <class T> +template <typename T> struct PtrToArg<T *> { static_assert(std::is_base_of<Object, T>::value, "Cannot encode non-Object value as an Object"); _FORCE_INLINE_ static T *convert(const void *p_ptr) { @@ -178,7 +178,7 @@ struct PtrToArg<T *> { } }; -template <class T> +template <typename T> struct PtrToArg<const T *> { static_assert(std::is_base_of<Object, T>::value, "Cannot encode non-Object value as an Object"); _FORCE_INLINE_ static const T *convert(const void *p_ptr) { diff --git a/include/godot_cpp/core/object.hpp b/include/godot_cpp/core/object.hpp index c1f1069..0857200 100644 --- a/include/godot_cpp/core/object.hpp +++ b/include/godot_cpp/core/object.hpp @@ -80,31 +80,31 @@ struct MethodInfo { MethodInfo(); MethodInfo(StringName p_name); - template <class... Args> + template <typename... Args> MethodInfo(StringName p_name, const Args &...args); MethodInfo(Variant::Type ret); MethodInfo(Variant::Type ret, StringName p_name); - template <class... Args> + template <typename... Args> MethodInfo(Variant::Type ret, StringName p_name, const Args &...args); MethodInfo(const PropertyInfo &p_ret, StringName p_name); - template <class... Args> + template <typename... Args> MethodInfo(const PropertyInfo &p_ret, StringName p_name, const Args &...); }; -template <class... Args> +template <typename... Args> MethodInfo::MethodInfo(StringName p_name, const Args &...args) : name(p_name), flags(GDEXTENSION_METHOD_FLAG_NORMAL) { arguments = { args... }; } -template <class... Args> +template <typename... Args> MethodInfo::MethodInfo(Variant::Type ret, StringName p_name, const Args &...args) : name(p_name), flags(GDEXTENSION_METHOD_FLAG_NORMAL) { return_val.type = ret; arguments = { args... }; } -template <class... Args> +template <typename... Args> MethodInfo::MethodInfo(const PropertyInfo &p_ret, StringName p_name, const Args &...args) : name(p_name), return_val(p_ret), flags(GDEXTENSION_METHOD_FLAG_NORMAL) { arguments = { args... }; @@ -121,7 +121,7 @@ public: } }; -template <class T> +template <typename T> T *Object::cast_to(Object *p_object) { if (p_object == nullptr) { return nullptr; @@ -134,7 +134,7 @@ T *Object::cast_to(Object *p_object) { return dynamic_cast<T *>(internal::get_object_instance_binding(casted)); } -template <class T> +template <typename T> const T *Object::cast_to(const Object *p_object) { if (p_object == nullptr) { return nullptr; diff --git a/include/godot_cpp/core/type_info.hpp b/include/godot_cpp/core/type_info.hpp index a5cb174..2bed6be 100644 --- a/include/godot_cpp/core/type_info.hpp +++ b/include/godot_cpp/core/type_info.hpp @@ -90,7 +90,7 @@ static PropertyInfo make_property_info(Variant::Type p_type, const StringName &p // instead of a forward declaration. You can always forward declare 'T' in a header file, and then // include the actual declaration of 'T' in the source file where 'GetTypeInfo<T>' is instantiated. -template <class T, typename = void> +template <typename T, typename = void> struct GetTypeInfo; #define MAKE_TYPE_INFO(m_type, m_var_type) \ @@ -248,7 +248,7 @@ inline StringName _gde_constant_get_enum_name(T param, StringName p_constant) { return GetTypeInfo<T>::get_class_info().class_name; } -template <class T> +template <typename T> class BitField { int64_t value = 0; @@ -295,7 +295,7 @@ inline StringName _gde_constant_get_bitfield_name(T param, StringName p_constant return GetTypeInfo<BitField<T>>::get_class_info().class_name; } -template <class T> +template <typename T> struct PtrToArg<TypedArray<T>> { _FORCE_INLINE_ static TypedArray<T> convert(const void *p_ptr) { return TypedArray<T>(*reinterpret_cast<const Array *>(p_ptr)); @@ -306,7 +306,7 @@ struct PtrToArg<TypedArray<T>> { } }; -template <class T> +template <typename T> struct PtrToArg<const TypedArray<T> &> { typedef Array EncodeT; _FORCE_INLINE_ static TypedArray<T> |