:right-sidebar: True IdStr =================================================================== .. currentmodule:: gi.repository.Gst .. versionadded:: 1.26 .. class:: IdStr(**kwargs) :no-contents-entry: A :obj:`~gi.repository.Gst.IdStr` is string type optimized for short strings and used for structure names, structure field names and in other places. Strings up to 16 bytes (including NUL terminator) are stored inline, other strings are stored on the heap. .. code-block:: cpp :dedent: GstIdStr s = GST_ID_STR_INIT; gst_id_str_set (&s, "Hello, World!"); g_print ("%s\n", gst_id_str_as_str (&s)); gst_id_str_clear (&s); Constructors ------------ .. rst-class:: interim-class .. class:: IdStr :no-index: .. classmethod:: new() -> ~gi.repository.Gst.IdStr Returns a newly heap allocated empty string. .. versionadded:: 1.26 Methods ------- .. rst-class:: interim-class .. class:: IdStr :no-index: .. method:: as_str() -> str .. versionadded:: 1.26 .. method:: clear() -> None Clears ``s`` and sets it to the empty string. .. versionadded:: 1.26 .. method:: free() -> None Frees ``s``\. This should only be called for heap-allocated :obj:`~gi.repository.Gst.IdStr`\. .. versionadded:: 1.26 .. method:: get_len() -> int Returns the length of ``s``\, exluding the NUL-terminator. This is equivalent to calling ``strcmp()`` but potentially faster. .. versionadded:: 1.26 .. method:: init() -> None Initializes a (usually stack-allocated) id string ``s``\. The newly-initialized id string will contain an empty string by default as value. .. versionadded:: 1.26 .. method:: is_equal(s2: ~gi.repository.Gst.IdStr) -> bool Compares ``s1`` and ``s2`` for equality. .. versionadded:: 1.26 :param s2: A %GstIdStr .. method:: is_equal_to_str(s2: str) -> bool Compares ``s1`` and ``s2`` for equality. .. versionadded:: 1.26 :param s2: A string .. method:: is_equal_to_str_with_len(s2: str, len: int) -> bool Compares ``s1`` and ``s2`` with length ``len`` for equality. ``s2`` does not have to be NUL-terminated and ``len`` should not include the NUL-terminator. This is generally faster than :func:`~gi.repository.Gst.IdStr.is_equal_to_str` if the length is already known. .. versionadded:: 1.26 :param s2: A string :param len: Length of ``s2``\. .. method:: move(s: ~gi.repository.Gst.IdStr) -> None Moves ``s`` into ``d`` and resets ``s``\. .. versionadded:: 1.26 :param s: The source %GstIdStr .. method:: set(value: str) -> None Sets ``s`` to the string ``value``\. .. versionadded:: 1.26 :param value: A NUL-terminated string .. method:: set_static_str(value: str) -> None Sets ``s`` to the string ``value``\. ``value`` needs to be valid for the remaining lifetime of the process, e.g. has to be a static string. .. versionadded:: 1.26 :param value: A NUL-terminated string .. method:: set_static_str_with_len(value: str, len: int) -> None Sets ``s`` to the string ``value`` of length ``len``\. ``value`` needs to be valid for the remaining lifetime of the process, e.g. has to be a static string. ``value`` must be NUL-terminated and ``len`` should not include the NUL-terminator. .. versionadded:: 1.26 :param value: A string :param len: Length of the string .. method:: set_with_len(value: str, len: int) -> None Sets ``s`` to the string ``value`` of length ``len``\. ``value`` does not have to be NUL-terminated and ``len`` should not include the NUL-terminator. .. versionadded:: 1.26 :param value: A string :param len: Length of the string Fields ------ .. rst-class:: interim-class .. class:: IdStr :no-index: .. attribute:: padding .. attribute:: pointer