IdStr#
Added in version 1.26.
- class IdStr(**kwargs)#
A 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.
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#
Methods#
- class IdStr
-
- get_len() int#
Returns the length of
s, exluding the NUL-terminator. This is equivalent to callingstrcmp()but potentially faster.Added in version 1.26.
- init() None#
Initializes a (usually stack-allocated) id string
s. The newly-initialized id string will contain an empty string by default as value.Added in version 1.26.
- is_equal(s2: IdStr) bool#
Compares
s1ands2for equality.Added in version 1.26.
- Parameters:
s2 – A %GstIdStr
- is_equal_to_str(s2: str) bool#
Compares
s1ands2for equality.Added in version 1.26.
- Parameters:
s2 – A string
- is_equal_to_str_with_len(s2: str, len: int) bool#
Compares
s1ands2with lengthlenfor equality.s2does not have to be NUL-terminated andlenshould not include the NUL-terminator.This is generally faster than
is_equal_to_str()if the length is already known.Added in version 1.26.
- Parameters:
s2 – A string
len – Length of
s2.
- move(s: IdStr) None#
Moves
sintodand resetss.Added in version 1.26.
- Parameters:
s – The source %GstIdStr
- set(value: str) None#
Sets
sto the stringvalue.Added in version 1.26.
- Parameters:
value – A NUL-terminated string
- set_static_str(value: str) None#
Sets
sto the stringvalue.valueneeds to be valid for the remaining lifetime of the process, e.g. has to be a static string.Added in version 1.26.
- Parameters:
value – A NUL-terminated string
- set_static_str_with_len(value: str, len: int) None#
Sets
sto the stringvalueof lengthlen.valueneeds to be valid for the remaining lifetime of the process, e.g. has to be a static string.valuemust be NUL-terminated andlenshould not include the NUL-terminator.Added in version 1.26.
- Parameters:
value – A string
len – Length of the string