Gst.IdStr¶
Fields¶
Name |
Type |
Access |
Description |
|---|---|---|---|
padding |
r |
||
pointer |
r |
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gst.IdStr¶
A
Gst.IdStris 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.
```cpp
Gst.IdStrs = GST_ID_STR_INIT;Gst.IdStr.set(&s, “Hello, World!”); g_print (“%s\n”,Gst.IdStr.as_str(&s));Gst.IdStr.clear(&s); ```Added in version 1.26.
- classmethod new()[source]¶
- Returns:
A heap-allocated string.
- Return type:
Returns a newly heap allocated empty string.
Added in version 1.26.
- as_str()[source]¶
- Returns:
the NUL-terminated string representation of self.
- Return type:
Added in version 1.26.
- copy()[source]¶
- Returns:
A heap-allocated copy of self.
- Return type:
Copies self into newly allocated heap memory.
Added in version 1.26.
- free()[source]¶
Frees self. This should only be called for heap-allocated
Gst.IdStr.Added in version 1.26.
- get_len()[source]¶
- Return type:
Returns the length of self, exluding the NUL-terminator. This is equivalent to calling
strcmp()but potentially faster.Added in version 1.26.
- init()[source]¶
Initializes a (usually stack-allocated) id string self. The newly-initialized id string will contain an empty string by default as value.
Added in version 1.26.
- is_equal_to_str_with_len(s2, len)[source]¶
- Parameters:
- Returns:
Trueif self and s2 are equal.- Return type:
Compares self 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
Gst.IdStr.is_equal_to_str() if the length is already known.Added in version 1.26.
- set(value)[source]¶
- Parameters:
value (
str) – A NUL-terminated string
Sets self to the string value.
Added in version 1.26.
- set_static_str(value)[source]¶
- Parameters:
value (
str) – A NUL-terminated string
Sets self to the string value. value needs to be valid for the remaining lifetime of the process, e.g. has to be a static string.
Added in version 1.26.