Enforce template syntax `typename` over `class`
parent
cc1217a43c
commit
87f5fb0691
|
@ -687,7 +687,7 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
|
|||
|
||||
vararg = method["is_vararg"]
|
||||
if vararg:
|
||||
result.append("\ttemplate<class... Args>")
|
||||
result.append("\ttemplate<typename... Args>")
|
||||
|
||||
method_signature = "\t"
|
||||
if "is_static" in method and method["is_static"]:
|
||||
|
@ -786,7 +786,7 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
|
|||
result.append("\tchar32_t *ptrw();")
|
||||
|
||||
if class_name == "Array":
|
||||
result.append("\ttemplate <class... Args>")
|
||||
result.append("\ttemplate <typename... Args>")
|
||||
result.append("\tstatic Array make(Args... args) {")
|
||||
result.append("\t\treturn helpers::append_all(Array(), args...);")
|
||||
result.append("\t}")
|
||||
|
@ -1527,7 +1527,7 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
|
|||
result.append("protected:")
|
||||
# T is the custom class we want to register (from which the call initiates, going up the inheritance chain),
|
||||
# B is its base class (can be a custom class too, that's why we pass it).
|
||||
result.append("\ttemplate <class T, class B>")
|
||||
result.append("\ttemplate <typename T, typename B>")
|
||||
result.append("\tstatic void register_virtuals() {")
|
||||
if class_name != "Object":
|
||||
result.append(f"\t\t{inherits}::register_virtuals<T, B>();")
|
||||
|
@ -1573,16 +1573,16 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
|
|||
if class_name == "Object":
|
||||
result.append("")
|
||||
|
||||
result.append("\ttemplate<class T>")
|
||||
result.append("\ttemplate<typename T>")
|
||||
result.append("\tstatic T *cast_to(Object *p_object);")
|
||||
|
||||
result.append("\ttemplate<class T>")
|
||||
result.append("\ttemplate<typename T>")
|
||||
result.append("\tstatic const T *cast_to(const Object *p_object);")
|
||||
|
||||
result.append("\tvirtual ~Object() = default;")
|
||||
|
||||
elif use_template_get_node and class_name == "Node":
|
||||
result.append("\ttemplate<class T>")
|
||||
result.append("\ttemplate<typename T>")
|
||||
result.append(
|
||||
"\tT *get_node(const NodePath &p_path) const { return Object::cast_to<T>(get_node_internal(p_path)); }"
|
||||
)
|
||||
|
@ -2216,7 +2216,7 @@ def make_varargs_template(
|
|||
if with_public_declare:
|
||||
function_signature = "public: "
|
||||
|
||||
function_signature += "template<class... Args> "
|
||||
function_signature += "template<typename... Args> "
|
||||
|
||||
if static:
|
||||
function_signature += "static "
|
||||
|
|
|
@ -47,11 +47,11 @@ public:
|
|||
static void remove_plugin_class(const StringName &p_class_name);
|
||||
static void deinitialize(GDExtensionInitializationLevel p_level);
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
static void add_by_type() {
|
||||
add_plugin_class(T::get_class_static());
|
||||
}
|
||||
template <class T>
|
||||
template <typename T>
|
||||
static void remove_by_type() {
|
||||
remove_plugin_class(T::get_class_static());
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace godot {
|
|||
|
||||
class RefCounted;
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class Ref {
|
||||
T *reference = nullptr;
|
||||
|
||||
|
@ -108,7 +108,7 @@ public:
|
|||
ref(p_from);
|
||||
}
|
||||
|
||||
template <class T_Other>
|
||||
template <typename T_Other>
|
||||
void operator=(const Ref<T_Other> &p_from) {
|
||||
RefCounted *refb = const_cast<RefCounted *>(static_cast<const RefCounted *>(p_from.ptr()));
|
||||
if (!refb) {
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
template <class T_Other>
|
||||
template <typename T_Other>
|
||||
void reference_ptr(T_Other *p_ptr) {
|
||||
if (reference == p_ptr) {
|
||||
return;
|
||||
|
@ -161,7 +161,7 @@ public:
|
|||
ref(p_from);
|
||||
}
|
||||
|
||||
template <class T_Other>
|
||||
template <typename T_Other>
|
||||
Ref(const Ref<T_Other> &p_from) {
|
||||
RefCounted *refb = const_cast<RefCounted *>(static_cast<const RefCounted *>(p_from.ptr()));
|
||||
if (!refb) {
|
||||
|
@ -226,7 +226,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
struct PtrToArg<Ref<T>> {
|
||||
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
|
||||
GDExtensionRefPtr ref = (GDExtensionRefPtr)p_ptr;
|
||||
|
@ -248,7 +248,7 @@ struct PtrToArg<Ref<T>> {
|
|||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
struct PtrToArg<const Ref<T> &> {
|
||||
typedef Ref<T> EncodeT;
|
||||
|
||||
|
@ -259,7 +259,7 @@ struct PtrToArg<const Ref<T> &> {
|
|||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
struct GetTypeInfo<Ref<T>, typename EnableIf<TypeInherits<RefCounted, T>::value>::type> {
|
||||
static const GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_OBJECT;
|
||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
|
@ -269,7 +269,7 @@ struct GetTypeInfo<Ref<T>, typename EnableIf<TypeInherits<RefCounted, T>::value>
|
|||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
struct GetTypeInfo<const Ref<T> &, typename EnableIf<TypeInherits<RefCounted, T>::value>::type> {
|
||||
static const GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_OBJECT;
|
||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||
|
|
|
@ -115,13 +115,13 @@ _FORCE_INLINE_ void snarray_add_str(Vector<StringName> &arr, const StringName &p
|
|||
arr.push_back(p_str);
|
||||
}
|
||||
|
||||
template <class... P>
|
||||
template <typename... P>
|
||||
_FORCE_INLINE_ void snarray_add_str(Vector<StringName> &arr, const StringName &p_str, P... p_args) {
|
||||
arr.push_back(p_str);
|
||||
snarray_add_str(arr, p_args...);
|
||||
}
|
||||
|
||||
template <class... P>
|
||||
template <typename... P>
|
||||
_FORCE_INLINE_ Vector<StringName> snarray(P... p_args) {
|
||||
Vector<StringName> arr;
|
||||
snarray_add_str(arr, p_args...);
|
||||
|
@ -138,7 +138,7 @@ void add_engine_class_registration_callback(EngineClassRegistrationCallback p_ca
|
|||
void register_engine_class(const StringName &p_name, const GDExtensionInstanceBindingCallbacks *p_callbacks);
|
||||
void register_engine_classes();
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
struct EngineClassRegistration {
|
||||
EngineClassRegistration() {
|
||||
add_engine_class_registration_callback(&EngineClassRegistration<T>::callback);
|
||||
|
@ -207,7 +207,7 @@ protected:
|
|||
return (::godot::String(::godot::Wrapped::*)() const) & m_class::_to_string; \
|
||||
} \
|
||||
\
|
||||
template <class T, class B> \
|
||||
template <typename T, typename B> \
|
||||
static void register_virtuals() { \
|
||||
m_inherits::register_virtuals<T, B>(); \
|
||||
} \
|
||||
|
|
|
@ -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)>{});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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); }
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -43,13 +43,13 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class Vector;
|
||||
|
||||
template <class T, class V>
|
||||
template <typename T, typename V>
|
||||
class VMap;
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class CharStringT;
|
||||
|
||||
static_assert(std::is_trivially_destructible_v<std::atomic<uint64_t>>);
|
||||
|
@ -60,15 +60,15 @@ static_assert(std::is_trivially_destructible_v<std::atomic<uint64_t>>);
|
|||
#pragma GCC diagnostic ignored "-Wplacement-new"
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class CowData {
|
||||
template <class TV>
|
||||
template <typename TV>
|
||||
friend class Vector;
|
||||
|
||||
template <class TV, class VV>
|
||||
template <typename TV, typename VV>
|
||||
friend class VMap;
|
||||
|
||||
template <class TS>
|
||||
template <typename TS>
|
||||
friend class CharStringT;
|
||||
|
||||
public:
|
||||
|
@ -248,7 +248,7 @@ public:
|
|||
_FORCE_INLINE_ CowData(CowData<T> &p_from) { _ref(p_from); };
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
void CowData<T>::_unref(void *p_data) {
|
||||
if (!p_data) {
|
||||
return;
|
||||
|
@ -275,7 +275,7 @@ void CowData<T>::_unref(void *p_data) {
|
|||
Memory::free_static(((uint8_t *)p_data) - DATA_OFFSET, false);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
typename CowData<T>::USize CowData<T>::_copy_on_write() {
|
||||
if (!_ptr) {
|
||||
return 0;
|
||||
|
@ -315,7 +315,7 @@ typename CowData<T>::USize CowData<T>::_copy_on_write() {
|
|||
return rc;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
template <bool p_ensure_zero>
|
||||
Error CowData<T>::resize(Size p_size) {
|
||||
ERR_FAIL_COND_V(p_size < 0, ERR_INVALID_PARAMETER);
|
||||
|
@ -407,7 +407,7 @@ Error CowData<T>::resize(Size p_size) {
|
|||
return OK;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
typename CowData<T>::Size CowData<T>::find(const T &p_val, Size p_from) const {
|
||||
Size ret = -1;
|
||||
|
||||
|
@ -425,7 +425,7 @@ typename CowData<T>::Size CowData<T>::find(const T &p_val, Size p_from) const {
|
|||
return ret;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
typename CowData<T>::Size CowData<T>::rfind(const T &p_val, Size p_from) const {
|
||||
const Size s = size();
|
||||
|
||||
|
@ -444,7 +444,7 @@ typename CowData<T>::Size CowData<T>::rfind(const T &p_val, Size p_from) const {
|
|||
return -1;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
typename CowData<T>::Size CowData<T>::count(const T &p_val) const {
|
||||
Size amount = 0;
|
||||
for (Size i = 0; i < size(); i++) {
|
||||
|
@ -455,12 +455,12 @@ typename CowData<T>::Size CowData<T>::count(const T &p_val) const {
|
|||
return amount;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
void CowData<T>::_ref(const CowData *p_from) {
|
||||
_ref(*p_from);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
void CowData<T>::_ref(const CowData &p_from) {
|
||||
if (_ptr == p_from._ptr) {
|
||||
return; // self assign, do nothing.
|
||||
|
@ -478,7 +478,7 @@ void CowData<T>::_ref(const CowData &p_from) {
|
|||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
CowData<T>::~CowData() {
|
||||
_unref(_ptr);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace godot {
|
|||
* The assignment operator copy the pairs from one map to the other.
|
||||
*/
|
||||
|
||||
template <class TKey, class TValue>
|
||||
template <typename TKey, typename TValue>
|
||||
struct HashMapElement {
|
||||
HashMapElement *next = nullptr;
|
||||
HashMapElement *prev = nullptr;
|
||||
|
@ -62,10 +62,10 @@ struct HashMapElement {
|
|||
data(p_key, p_value) {}
|
||||
};
|
||||
|
||||
template <class TKey, class TValue,
|
||||
class Hasher = HashMapHasherDefault,
|
||||
class Comparator = HashMapComparatorDefault<TKey>,
|
||||
class Allocator = DefaultTypedAllocator<HashMapElement<TKey, TValue>>>
|
||||
template <typename TKey, typename TValue,
|
||||
typename Hasher = HashMapHasherDefault,
|
||||
typename Comparator = HashMapComparatorDefault<TKey>,
|
||||
typename Allocator = DefaultTypedAllocator<HashMapElement<TKey, TValue>>>
|
||||
class HashMap {
|
||||
public:
|
||||
const uint32_t MIN_CAPACITY_INDEX = 2; // Use a prime.
|
||||
|
|
|
@ -48,9 +48,9 @@ namespace godot {
|
|||
*
|
||||
*/
|
||||
|
||||
template <class TKey,
|
||||
class Hasher = HashMapHasherDefault,
|
||||
class Comparator = HashMapComparatorDefault<TKey>>
|
||||
template <typename TKey,
|
||||
typename Hasher = HashMapHasherDefault,
|
||||
typename Comparator = HashMapComparatorDefault<TKey>>
|
||||
class HashSet {
|
||||
public:
|
||||
static constexpr uint32_t MIN_CAPACITY_INDEX = 2; // Use a prime.
|
||||
|
|
|
@ -253,7 +253,7 @@ static _FORCE_INLINE_ uint32_t hash_djb2_one_float(double p_in, uint32_t p_prev
|
|||
return ((p_prev << 5) + p_prev) + hash_one_uint64(u.i);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
static _FORCE_INLINE_ uint32_t hash_make_uint32_t(T p_in) {
|
||||
union {
|
||||
T t;
|
||||
|
@ -286,7 +286,7 @@ static _FORCE_INLINE_ uint64_t hash_djb2_one_64(uint64_t p_in, uint64_t p_prev =
|
|||
return ((p_prev << 5) + p_prev) ^ p_in;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
static _FORCE_INLINE_ uint64_t hash_make_uint64_t(T p_in) {
|
||||
union {
|
||||
T t;
|
||||
|
@ -298,15 +298,15 @@ static _FORCE_INLINE_ uint64_t hash_make_uint64_t(T p_in) {
|
|||
return _u._u64;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class Ref;
|
||||
|
||||
struct HashMapHasherDefault {
|
||||
// Generic hash function for any type.
|
||||
template <class T>
|
||||
template <typename T>
|
||||
static _FORCE_INLINE_ uint32_t hash(const T *p_pointer) { return hash_one_uint64((uint64_t)p_pointer); }
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
static _FORCE_INLINE_ uint32_t hash(const Ref<T> &p_ref) { return hash_one_uint64((uint64_t)p_ref.operator->()); }
|
||||
|
||||
static _FORCE_INLINE_ uint32_t hash(const String &p_string) { return p_string.hash(); }
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class T, class A = DefaultAllocator>
|
||||
template <typename T, typename A = DefaultAllocator>
|
||||
class List {
|
||||
struct _Data;
|
||||
|
||||
|
@ -410,7 +410,7 @@ public:
|
|||
/**
|
||||
* find an element in the list,
|
||||
*/
|
||||
template <class T_v>
|
||||
template <typename T_v>
|
||||
Element *find(const T_v &p_val) {
|
||||
Element *it = front();
|
||||
while (it) {
|
||||
|
@ -646,7 +646,7 @@ public:
|
|||
sort_custom<Comparator<T>>();
|
||||
}
|
||||
|
||||
template <class C>
|
||||
template <typename C>
|
||||
void sort_custom_inplace() {
|
||||
if (size() < 2) {
|
||||
return;
|
||||
|
@ -693,7 +693,7 @@ public:
|
|||
_data->last = to;
|
||||
}
|
||||
|
||||
template <class C>
|
||||
template <typename C>
|
||||
struct AuxiliaryComparator {
|
||||
C compare;
|
||||
_FORCE_INLINE_ bool operator()(const Element *a, const Element *b) const {
|
||||
|
@ -701,7 +701,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class C>
|
||||
template <typename C>
|
||||
void sort_custom() {
|
||||
// this version uses auxiliary memory for speed.
|
||||
// if you don't want to use auxiliary memory, use the in_place version
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace godot {
|
|||
|
||||
// If tight, it grows strictly as much as needed.
|
||||
// Otherwise, it grows exponentially (the default and what you want in most cases).
|
||||
template <class T, class U = uint32_t, bool force_trivial = false, bool tight = false>
|
||||
template <typename T, typename U = uint32_t, bool force_trivial = false, bool tight = false>
|
||||
class LocalVector {
|
||||
private:
|
||||
U count = 0;
|
||||
|
@ -257,7 +257,7 @@ public:
|
|||
return -1;
|
||||
}
|
||||
|
||||
template <class C>
|
||||
template <typename C>
|
||||
void sort_custom() {
|
||||
U len = count;
|
||||
if (len == 0) {
|
||||
|
@ -331,7 +331,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class T, class U = uint32_t, bool force_trivial = false>
|
||||
template <typename T, typename U = uint32_t, bool force_trivial = false>
|
||||
using TightLocalVector = LocalVector<T, U, force_trivial, true>;
|
||||
|
||||
} // namespace godot
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class F, class S>
|
||||
template <typename F, typename S>
|
||||
struct Pair {
|
||||
F first;
|
||||
S second;
|
||||
|
@ -49,17 +49,17 @@ struct Pair {
|
|||
}
|
||||
};
|
||||
|
||||
template <class F, class S>
|
||||
template <typename F, typename S>
|
||||
bool operator==(const Pair<F, S> &pair, const Pair<F, S> &other) {
|
||||
return (pair.first == other.first) && (pair.second == other.second);
|
||||
}
|
||||
|
||||
template <class F, class S>
|
||||
template <typename F, typename S>
|
||||
bool operator!=(const Pair<F, S> &pair, const Pair<F, S> &other) {
|
||||
return (pair.first != other.first) || (pair.second != other.second);
|
||||
}
|
||||
|
||||
template <class F, class S>
|
||||
template <typename F, typename S>
|
||||
struct PairSort {
|
||||
bool operator()(const Pair<F, S> &A, const Pair<F, S> &B) const {
|
||||
if (A.first != B.first) {
|
||||
|
@ -69,7 +69,7 @@ struct PairSort {
|
|||
}
|
||||
};
|
||||
|
||||
template <class K, class V>
|
||||
template <typename K, typename V>
|
||||
struct KeyValue {
|
||||
const K key;
|
||||
V value;
|
||||
|
@ -85,17 +85,17 @@ struct KeyValue {
|
|||
}
|
||||
};
|
||||
|
||||
template <class K, class V>
|
||||
template <typename K, typename V>
|
||||
bool operator==(const KeyValue<K, V> &pair, const KeyValue<K, V> &other) {
|
||||
return (pair.key == other.key) && (pair.value == other.value);
|
||||
}
|
||||
|
||||
template <class K, class V>
|
||||
template <typename K, typename V>
|
||||
bool operator!=(const KeyValue<K, V> &pair, const KeyValue<K, V> &other) {
|
||||
return (pair.key != other.key) || (pair.value != other.value);
|
||||
}
|
||||
|
||||
template <class K, class V>
|
||||
template <typename K, typename V>
|
||||
struct KeyValueSort {
|
||||
bool operator()(const KeyValue<K, V> &A, const KeyValue<K, V> &B) const {
|
||||
return A.key < B.key;
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace godot {
|
|||
// based on the very nice implementation of rb-trees by:
|
||||
// https://web.archive.org/web/20120507164830/https://web.mit.edu/~emin/www/source_code/red_black_tree/index.html
|
||||
|
||||
template <class K, class V, class C = Comparator<K>, class A = DefaultAllocator>
|
||||
template <typename K, typename V, typename C = Comparator<K>, typename A = DefaultAllocator>
|
||||
class RBMap {
|
||||
enum Color {
|
||||
RED,
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class T, class C = Comparator<T>, class A = DefaultAllocator>
|
||||
template <typename T, typename C = Comparator<T>, typename A = DefaultAllocator>
|
||||
class RBSet {
|
||||
enum Color {
|
||||
RED,
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class T, bool THREAD_SAFE = false>
|
||||
template <typename T, bool THREAD_SAFE = false>
|
||||
class RID_Alloc {
|
||||
T **chunks = nullptr;
|
||||
uint32_t **free_list_chunks = nullptr;
|
||||
|
@ -347,7 +347,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class T, bool THREAD_SAFE = false>
|
||||
template <typename T, bool THREAD_SAFE = false>
|
||||
class RID_PtrOwner {
|
||||
RID_Alloc<T *, THREAD_SAFE> alloc;
|
||||
|
||||
|
@ -406,7 +406,7 @@ public:
|
|||
alloc(p_target_chunk_byte_size) {}
|
||||
};
|
||||
|
||||
template <class T, bool THREAD_SAFE = false>
|
||||
template <typename T, bool THREAD_SAFE = false>
|
||||
class RID_Owner {
|
||||
RID_Alloc<T, THREAD_SAFE> alloc;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace godot {
|
|||
static_assert(sizeof(SafeFlag) == sizeof(bool)); \
|
||||
static_assert(alignof(SafeFlag) == alignof(bool));
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class SafeNumeric {
|
||||
std::atomic<T> value;
|
||||
|
||||
|
@ -195,7 +195,7 @@ public:
|
|||
|
||||
#else
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class SafeNumeric {
|
||||
protected:
|
||||
T value;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class T, class Comparator = _DefaultComparator<T>>
|
||||
template <typename T, typename Comparator = _DefaultComparator<T>>
|
||||
class SearchArray {
|
||||
public:
|
||||
Comparator compare;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class SelfList {
|
||||
public:
|
||||
class List {
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace godot {
|
|||
break; \
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
struct _DefaultComparator {
|
||||
_FORCE_INLINE_ bool operator()(const T &a, const T &b) const { return (a < b); }
|
||||
};
|
||||
|
@ -52,7 +52,7 @@ struct _DefaultComparator {
|
|||
#define SORT_ARRAY_VALIDATE_ENABLED false
|
||||
#endif
|
||||
|
||||
template <class T, class Comparator = _DefaultComparator<T>, bool Validate = SORT_ARRAY_VALIDATE_ENABLED>
|
||||
template <typename T, typename Comparator = _DefaultComparator<T>, bool Validate = SORT_ARRAY_VALIDATE_ENABLED>
|
||||
class SortArray {
|
||||
enum {
|
||||
INTROSORT_THRESHOLD = 16
|
||||
|
|
|
@ -52,7 +52,7 @@ class ThreadWorkPool {
|
|||
virtual ~BaseWork() = default;
|
||||
};
|
||||
|
||||
template <class C, class M, class U>
|
||||
template <typename C, typename M, typename U>
|
||||
struct Work : public BaseWork {
|
||||
C *instance;
|
||||
M method;
|
||||
|
@ -94,7 +94,7 @@ class ThreadWorkPool {
|
|||
}
|
||||
|
||||
public:
|
||||
template <class C, class M, class U>
|
||||
template <typename C, typename M, typename U>
|
||||
void begin_work(uint32_t p_elements, C *p_instance, M p_method, U p_userdata) {
|
||||
ERR_FAIL_NULL(threads); // Never initialized.
|
||||
ERR_FAIL_COND(current_work != nullptr);
|
||||
|
@ -145,7 +145,7 @@ public:
|
|||
current_work = nullptr;
|
||||
}
|
||||
|
||||
template <class C, class M, class U>
|
||||
template <typename C, typename M, typename U>
|
||||
void do_work(uint32_t p_elements, C *p_instance, M p_method, U p_userdata) {
|
||||
switch (p_elements) {
|
||||
case 0:
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class VectorWriteProxy {
|
||||
public:
|
||||
_FORCE_INLINE_ T &operator[](typename CowData<T>::Size p_index) {
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class Vector {
|
||||
friend class VectorWriteProxy<T>;
|
||||
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
sort_custom<_DefaultComparator<T>>();
|
||||
}
|
||||
|
||||
template <class Comparator, bool Validate = SORT_ARRAY_VALIDATE_ENABLED, class... Args>
|
||||
template <typename Comparator, bool Validate = SORT_ARRAY_VALIDATE_ENABLED, typename... Args>
|
||||
void sort_custom(Args &&...args) {
|
||||
Size len = _cowdata.size();
|
||||
if (len == 0) {
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
return bsearch_custom<_DefaultComparator<T>>(p_value, p_before);
|
||||
}
|
||||
|
||||
template <class Comparator, class Value, class... Args>
|
||||
template <typename Comparator, typename Value, typename... Args>
|
||||
Size bsearch_custom(const Value &p_value, bool p_before, Args &&...args) {
|
||||
SearchArray<T, Comparator> search{ args... };
|
||||
return search.bisect(ptrw(), size(), p_value, p_before);
|
||||
|
@ -293,7 +293,7 @@ public:
|
|||
_FORCE_INLINE_ ~Vector() {}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
void Vector<T>::reverse() {
|
||||
for (Size i = 0; i < size() / 2; i++) {
|
||||
T *p = ptrw();
|
||||
|
@ -301,7 +301,7 @@ void Vector<T>::reverse() {
|
|||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
void Vector<T>::append_array(Vector<T> p_other) {
|
||||
const Size ds = p_other.size();
|
||||
if (ds == 0) {
|
||||
|
@ -314,7 +314,7 @@ void Vector<T>::append_array(Vector<T> p_other) {
|
|||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
bool Vector<T>::push_back(T p_elem) {
|
||||
Error err = resize(size() + 1);
|
||||
ERR_FAIL_COND_V(err, true);
|
||||
|
@ -323,7 +323,7 @@ bool Vector<T>::push_back(T p_elem) {
|
|||
return false;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
void Vector<T>::fill(T p_elem) {
|
||||
T *p = ptrw();
|
||||
for (Size i = 0; i < size(); i++) {
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class T, class V>
|
||||
template <typename T, typename V>
|
||||
class VMap {
|
||||
public:
|
||||
struct Pair {
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class VSet {
|
||||
Vector<T> _data;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ Callable create_callable_from_ccmp(CallableCustomMethodPointerBase *p_callable_m
|
|||
// No return value.
|
||||
//
|
||||
|
||||
template <class T, class... P>
|
||||
template <typename T, typename... P>
|
||||
class CallableCustomMethodPointer : public CallableCustomMethodPointerBase {
|
||||
struct Data {
|
||||
T *instance;
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class T, class... P>
|
||||
template <typename T, typename... P>
|
||||
Callable create_custom_callable_function_pointer(T *p_instance, void (T::*p_method)(P...)) {
|
||||
typedef CallableCustomMethodPointer<T, P...> CCMP;
|
||||
CCMP *ccmp = memnew(CCMP(p_instance, p_method));
|
||||
|
@ -96,7 +96,7 @@ Callable create_custom_callable_function_pointer(T *p_instance, void (T::*p_meth
|
|||
// With return value.
|
||||
//
|
||||
|
||||
template <class T, class R, class... P>
|
||||
template <typename T, typename R, typename... P>
|
||||
class CallableCustomMethodPointerRet : public CallableCustomMethodPointerBase {
|
||||
struct Data {
|
||||
T *instance;
|
||||
|
@ -122,7 +122,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class T, class R, class... P>
|
||||
template <typename T, typename R, typename... P>
|
||||
Callable create_custom_callable_function_pointer(T *p_instance, R (T::*p_method)(P...)) {
|
||||
typedef CallableCustomMethodPointerRet<T, R, P...> CCMP; // Messes with memnew otherwise.
|
||||
CCMP *ccmp = memnew(CCMP(p_instance, p_method));
|
||||
|
@ -133,7 +133,7 @@ Callable create_custom_callable_function_pointer(T *p_instance, R (T::*p_method)
|
|||
// Const with return value.
|
||||
//
|
||||
|
||||
template <class T, class R, class... P>
|
||||
template <typename T, typename R, typename... P>
|
||||
class CallableCustomMethodPointerRetC : public CallableCustomMethodPointerBase {
|
||||
struct Data {
|
||||
T *instance;
|
||||
|
@ -159,7 +159,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class T, class R, class... P>
|
||||
template <typename T, typename R, typename... P>
|
||||
Callable create_custom_callable_function_pointer(const T *p_instance, R (T::*p_method)(P...) const) {
|
||||
typedef CallableCustomMethodPointerRetC<T, R, P...> CCMP; // Messes with memnew otherwise.
|
||||
CCMP *ccmp = memnew(CCMP(p_instance, p_method));
|
||||
|
@ -170,7 +170,7 @@ Callable create_custom_callable_function_pointer(const T *p_instance, R (T::*p_m
|
|||
// Static method with no return value.
|
||||
//
|
||||
|
||||
template <class... P>
|
||||
template <typename... P>
|
||||
class CallableCustomStaticMethodPointer : public CallableCustomMethodPointerBase {
|
||||
struct Data {
|
||||
void (*method)(P...);
|
||||
|
@ -194,7 +194,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class... P>
|
||||
template <typename... P>
|
||||
Callable create_custom_callable_static_function_pointer(void (*p_method)(P...)) {
|
||||
typedef CallableCustomStaticMethodPointer<P...> CCMP;
|
||||
CCMP *ccmp = memnew(CCMP(p_method));
|
||||
|
@ -205,7 +205,7 @@ Callable create_custom_callable_static_function_pointer(void (*p_method)(P...))
|
|||
// Static method with return value.
|
||||
//
|
||||
|
||||
template <class R, class... P>
|
||||
template <typename R, typename... P>
|
||||
class CallableCustomStaticMethodPointerRet : public CallableCustomMethodPointerBase {
|
||||
struct Data {
|
||||
R(*method)
|
||||
|
@ -229,7 +229,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class R, class... P>
|
||||
template <typename R, typename... P>
|
||||
Callable create_custom_callable_static_function_pointer(R (*p_method)(P...)) {
|
||||
typedef CallableCustomStaticMethodPointerRet<R, P...> CCMP;
|
||||
CCMP *ccmp = memnew(CCMP(p_method));
|
||||
|
|
|
@ -38,12 +38,12 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class CharStringT;
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class CharProxy {
|
||||
template <class TS>
|
||||
template <typename TS>
|
||||
friend class CharStringT;
|
||||
|
||||
const int64_t _index;
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class CharStringT {
|
||||
friend class String;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class TypedArray : public Array {
|
||||
public:
|
||||
_FORCE_INLINE_ void operator=(const Array &p_array) {
|
||||
|
|
|
@ -270,7 +270,7 @@ public:
|
|||
|
||||
void callp(const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDExtensionCallError &r_error);
|
||||
|
||||
template <class... Args>
|
||||
template <typename... Args>
|
||||
Variant call(const StringName &method, Args... args) {
|
||||
std::array<Variant, sizeof...(args)> vargs = { args... };
|
||||
std::array<const Variant *, sizeof...(args)> argptrs;
|
||||
|
@ -285,7 +285,7 @@ public:
|
|||
|
||||
static void callp_static(Variant::Type type, const StringName &method, const Variant **args, int argcount, Variant &r_ret, GDExtensionCallError &r_error);
|
||||
|
||||
template <class... Args>
|
||||
template <typename... Args>
|
||||
static Variant call_static(Variant::Type type, const StringName &method, Args... args) {
|
||||
std::array<Variant, sizeof...(args)> vargs = { args... };
|
||||
std::array<const Variant *, sizeof...(args)> argptrs;
|
||||
|
|
|
@ -65,7 +65,7 @@ _FORCE_INLINE_ bool is_str_less(const L *l_ptr, const R *r_ptr) {
|
|||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
bool CharStringT<T>::operator<(const CharStringT<T> &p_right) const {
|
||||
if (length() == 0) {
|
||||
return p_right.length() != 0;
|
||||
|
@ -74,7 +74,7 @@ bool CharStringT<T>::operator<(const CharStringT<T> &p_right) const {
|
|||
return is_str_less(get_data(), p_right.get_data());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
CharStringT<T> &CharStringT<T>::operator+=(T p_char) {
|
||||
const int64_t lhs_len = length();
|
||||
resize(lhs_len + 2);
|
||||
|
@ -86,7 +86,7 @@ CharStringT<T> &CharStringT<T>::operator+=(T p_char) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
void CharStringT<T>::operator=(const T *p_cstr) {
|
||||
copy_from(p_cstr);
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ const wchar_t *CharStringT<wchar_t>::get_data() const {
|
|||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
void CharStringT<T>::copy_from(const T *p_cstr) {
|
||||
if (!p_cstr) {
|
||||
resize(0);
|
||||
|
|
Loading…
Reference in New Issue