Gst.IdStr

Fields

Name

Type

Access

Description

padding

bytes

r

pointer

object

r

Methods

class

new ()

as_str ()

clear ()

copy ()

copy_into (s)

free ()

get_len ()

init ()

is_equal (s2)

is_equal_to_str (s2)

is_equal_to_str_with_len (s2, len)

move (s)

set (value)

set_static_str (value)

set_static_str_with_len (value, len)

set_with_len (value, len)

Details

class Gst.IdStr

A 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.

```cpp Gst.IdStr s = 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:

Gst.IdStr

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:

str

Added in version 1.26.

clear()[source]

Clears self and sets it to the empty string.

Added in version 1.26.

copy()[source]
Returns:

A heap-allocated copy of self.

Return type:

Gst.IdStr

Copies self into newly allocated heap memory.

Added in version 1.26.

copy_into(s)[source]
Parameters:

s (Gst.IdStr) – The source Gst.IdStr

Copies s into self.

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:

int

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(s2)[source]
Parameters:

s2 (Gst.IdStr) – A Gst.IdStr

Returns:

True if self and s2 are equal.

Return type:

bool

Compares self and s2 for equality.

Added in version 1.26.

is_equal_to_str(s2)[source]
Parameters:

s2 (str) – A string

Returns:

True if self and s2 are equal.

Return type:

bool

Compares self and s2 for equality.

Added in version 1.26.

is_equal_to_str_with_len(s2, len)[source]
Parameters:
  • s2 (str) – A string

  • len (int) – Length of s2.

Returns:

True if self and s2 are equal.

Return type:

bool

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.

move(s)[source]
Parameters:

s (Gst.IdStr) – The source Gst.IdStr

Moves s into self and resets s.

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.

set_static_str_with_len(value, len)[source]
Parameters:
  • value (str) – A string

  • len (int) – Length of the string

Sets self 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.

Added in version 1.26.

set_with_len(value, len)[source]
Parameters:
  • value (str) – A string

  • len (int) – Length of the string

Sets self to the string value of length len. value does not have to be NUL-terminated and len should not include the NUL-terminator.

Added in version 1.26.