mirror of
https://github.com/godotengine/godot-cpp.git
synced 2025-12-31 01:48:45 +03:00
Merge pull request #1409 from Repiteo/class-to-typename
Enforce template syntax `typename` over `class`
This commit is contained in:
@@ -696,7 +696,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"]:
|
||||
@@ -795,7 +795,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}")
|
||||
@@ -1556,7 +1556,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>();")
|
||||
@@ -1602,16 +1602,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)); }"
|
||||
)
|
||||
@@ -2245,7 +2245,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 "
|
||||
|
||||
Reference in New Issue
Block a user