GstIdStr

A GstIdStr 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);

GstIdStr

String type optimized for short strings.

Strings are usually stack- or inline-allocated, and for short strings smaller than 16 bytes (including NUL terminator) no heap allocations are performed.

Since : 1.26


Constructors

gst_id_str_new

GstIdStr *
gst_id_str_new ()

Returns a newly heap allocated empty string.

Returns ( [transfer: full])

A heap-allocated string.

Since : 1.26


Methods

gst_id_str_as_str

const gchar *
gst_id_str_as_str (const GstIdStr * s)

Parameters:

s

A GstIdStr

Returns

the NUL-terminated string representation of s.

Since : 1.26


gst_id_str_clear

gst_id_str_clear (GstIdStr * s)

Clears s and sets it to the empty string.

Parameters:

s

A GstIdStr

Since : 1.26


gst_id_str_copy

GstIdStr *
gst_id_str_copy (const GstIdStr * s)

Copies s into newly allocated heap memory.

Parameters:

s

A GstIdStr

Returns ( [transfer: full])

A heap-allocated copy of s.

Since : 1.26


gst_id_str_copy_into

gst_id_str_copy_into (GstIdStr * d,
                      const GstIdStr * s)

Copies s into d.

Parameters:

d

The destination GstIdStr

s

The source GstIdStr

Since : 1.26


gst_id_str_free

gst_id_str_free (GstIdStr * s)

Frees s. This should only be called for heap-allocated GstIdStr.

Parameters:

s

A heap allocated GstIdStr

Since : 1.26


gst_id_str_get_len

gsize
gst_id_str_get_len (const GstIdStr * s)

Returns the length of s, exluding the NUL-terminator. This is equivalent to calling strcmp() but potentially faster.

Parameters:

s

A GstIdStr

Returns
No description available

Since : 1.26


gst_id_str_init

gst_id_str_init (GstIdStr * s)

Initializes a (usually stack-allocated) id string s. The newly-initialized id string will contain an empty string by default as value.

Parameters:

s

A GstIdStr

Since : 1.26


gst_id_str_is_equal

gboolean
gst_id_str_is_equal (const GstIdStr * s1,
                     const GstIdStr * s2)

Compares s1 and s2 for equality.

Parameters:

s1

A GstIdStr

s2

A GstIdStr

Returns

TRUE if s1 and s2 are equal.

Since : 1.26


gst_id_str_is_equal_to_str

gboolean
gst_id_str_is_equal_to_str (const GstIdStr * s1,
                            const gchar * s2)

Compares s1 and s2 for equality.

Parameters:

s1

A GstIdStr

s2

A string

Returns

TRUE if s1 and s2 are equal.

Since : 1.26


gst_id_str_is_equal_to_str_with_len

gboolean
gst_id_str_is_equal_to_str_with_len (const GstIdStr * s1,
                                     const gchar * s2,
                                     gsize len)

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 gst_id_str_is_equal_to_str if the length is already known.

Parameters:

s1

A GstIdStr

s2

A string

len

Length of s2.

Returns

TRUE if s1 and s2 are equal.

Since : 1.26


gst_id_str_move

gst_id_str_move (GstIdStr * d,
                 GstIdStr * s)

Moves s into d and resets s.

Parameters:

d

The destination GstIdStr

s

The source GstIdStr

Since : 1.26


gst_id_str_set

gst_id_str_set (GstIdStr * s,
                const gchar * value)

Sets s to the string value.

Parameters:

s

A GstIdStr

value

A NUL-terminated string

Since : 1.26


gst_id_str_set_static_str

gst_id_str_set_static_str (GstIdStr * s,
                           const gchar * value)

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.

Parameters:

s

A GstIdStr

value

A NUL-terminated string

Since : 1.26


gst_id_str_set_static_str_with_len

gst_id_str_set_static_str_with_len (GstIdStr * s,
                                    const gchar * value,
                                    gsize len)

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.

Parameters:

s

A GstIdStr

value

A string

len

Length of the string

Since : 1.26


gst_id_str_set_with_len

gst_id_str_set_with_len (GstIdStr * s,
                         const gchar * value,
                         gsize len)

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.

Parameters:

s

A GstIdStr

value

A string

len

Length of the string

Since : 1.26


Constants

GST_ID_STR_INIT

#define GST_ID_STR_INIT { .pointer = NULL, .padding = {0, } }

Initializer for GstIdStr.

Since : 1.26


The results of the search are