gdnative_python/generation/builtins_templates/node_path.tmpl.pxi

67 lines
2.3 KiB
Cython

{%- block pxd_header %}
{% endblock -%}
{%- block pyx_header %}
{% endblock -%}
# TODO
{{ force_mark_rendered("pandemonium_node_path_get_sname") }}
{{ force_mark_rendered("pandemonium_node_path_hash") }}
{{ force_mark_rendered("pandemonium_node_path_prepend_period") }}
{{ force_mark_rendered("pandemonium_node_path_rel_path_to") }}
{{ force_mark_rendered("pandemonium_node_path_simplified") }}
{{ force_mark_rendered("pandemonium_node_path_simplify") }}
# END TODO
{{ force_mark_rendered("pandemonium_node_path_new_copy") }} {# NodePath is const, why does this exists in the first place ? #}
@cython.final
cdef class NodePath:
{% block cdef_attributes %}
cdef pandemonium_node_path _gd_data
{% endblock %}
{% block python_defs %}
def __init__(self, from_):
{{ force_mark_rendered("pandemonium_node_path_new") }}
cdef pandemonium_string gd_from
try:
gdapi10.pandemonium_node_path_new(&self._gd_data, &(<GDString?>from_)._gd_data)
except TypeError:
if not isinstance(from_, str):
raise TypeError("`from_` must be str or GDString")
pyobj_to_pandemonium_string(from_, &gd_from)
gdapi10.pandemonium_node_path_new(&self._gd_data, &gd_from)
gdapi10.pandemonium_string_destroy(&gd_from)
def __dealloc__(NodePath self):
{{ force_mark_rendered("pandemonium_node_path_destroy") }}
# /!\ if `__init__` is skipped, `_gd_data` must be initialized by
# hand otherwise we will get a segfault here
gdapi10.pandemonium_node_path_destroy(&self._gd_data)
def __repr__(NodePath self):
return f"<NodePath({self.as_string()})>"
def __str__(NodePath self):
return str(self.as_string())
{{ render_operator_eq() | indent }}
{{ render_operator_ne() | indent }}
{{ render_method("destroy") | indent }}
{{ render_method("as_string") | indent }}
{{ render_method("is_absolute") | indent }}
{{ render_method("get_name_count") | indent }}
{{ render_method("get_name") | indent }}
{{ render_method("get_subname_count") | indent }}
{{ render_method("get_subname") | indent }}
{{ render_method("get_concatenated_subnames") | indent }}
{{ render_method("is_empty") | indent }}
{{ render_method("get_as_property_path") | indent }}
{% endblock %}
{%- block python_consts %}
{% endblock %}