2023-06-02 12:08:05 +02:00
|
|
|
{%- block pxd_header %}
|
|
|
|
{% endblock -%}
|
|
|
|
{%- block pyx_header %}
|
|
|
|
{% endblock -%}
|
|
|
|
|
|
|
|
@cython.final
|
|
|
|
cdef class StringName:
|
|
|
|
{% block cdef_attributes %}
|
|
|
|
cdef pandemonium_string_name _gd_data
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block python_defs %}
|
|
|
|
def __init__(self, from_):
|
|
|
|
{{ force_mark_rendered("pandemonium_string_name_new") }}
|
|
|
|
cdef pandemonium_string gd_from
|
|
|
|
try:
|
2023-06-02 17:59:23 +02:00
|
|
|
gdapi10.pandemonium_string_name_new_data_string(&self._gd_data, &(<GDString?>from_)._gd_data)
|
2023-06-02 12:08:05 +02:00
|
|
|
except TypeError:
|
|
|
|
if not isinstance(from_, str):
|
|
|
|
raise TypeError("`from_` must be str or GDString")
|
|
|
|
pyobj_to_pandemonium_string(from_, &gd_from)
|
2023-06-02 17:59:23 +02:00
|
|
|
gdapi10.pandemonium_string_name_new_data_string(&self._gd_data, &gd_from)
|
2023-06-02 12:08:05 +02:00
|
|
|
gdapi10.pandemonium_string_destroy(&gd_from)
|
|
|
|
|
|
|
|
def __dealloc__(StringName self):
|
|
|
|
{{ force_mark_rendered("pandemonium_string_name_destroy") }}
|
|
|
|
# /!\ if `__init__` is skipped, `_gd_data` must be initialized by
|
|
|
|
# hand otherwise we will get a segfault here
|
|
|
|
gdapi10.pandemonium_string_name_destroy(&self._gd_data)
|
|
|
|
|
|
|
|
def __repr__(StringName self):
|
2023-06-02 14:06:15 +02:00
|
|
|
return f"<StringName({self.get_name()})>"
|
2023-06-02 12:08:05 +02:00
|
|
|
|
|
|
|
def __str__(StringName self):
|
2023-06-02 14:06:15 +02:00
|
|
|
return str(self.get_name())
|
2023-06-02 12:08:05 +02:00
|
|
|
|
2023-06-02 17:59:23 +02:00
|
|
|
#{{ render_operator_eq() | indent }}
|
|
|
|
#{{ render_operator_ne() | indent }}
|
2023-06-02 12:08:05 +02:00
|
|
|
|
|
|
|
{{ render_method("destroy") | indent }}
|
2023-06-02 14:06:15 +02:00
|
|
|
{{ render_method("get_name") | indent }}
|
2023-06-02 12:08:05 +02:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{%- block python_consts %}
|
|
|
|
{% endblock %}
|