Wp.SpaJson¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Wp.SpaJson¶
New in version 0.4.8.
- classmethod new_boolean(value)¶
- Parameters:
value (
bool
) – the boolean value- Returns:
The new spa json
- Return type:
Creates a spa json of type boolean.
- classmethod new_float(value)¶
- Parameters:
value (
float
) – the float value- Returns:
The new spa json
- Return type:
Creates a spa json of type float.
- classmethod new_from_string(json_str)¶
- Parameters:
json_str (
str
) – a JSON string- Returns:
a new
Wp.SpaJson
; unlike the “wrap” variants, this function copies the data in json_str, so it does not need to stay alive.- Return type:
Constructs a new
Wp.SpaJson
from a JSON string.New in version 0.5.0.
- classmethod new_from_stringn(json_str, len)¶
- Parameters:
- Returns:
a new
Wp.SpaJson
; unlike the “wrap” variants, this function copies the data in json_str, so it does not need to stay alive.- Return type:
Constructs a new
Wp.SpaJson
from a JSON string with specific length.New in version 0.5.0.
- classmethod new_int(value)¶
- Parameters:
value (
int
) – the int value- Returns:
The new spa json
- Return type:
Creates a spa json of type int.
- classmethod new_string(value)¶
- Parameters:
value (
str
) – the string value- Returns:
The new spa json
- Return type:
Creates a spa json of type string.
- classmethod new_wrap(json)¶
- Parameters:
- Returns:
a new
Wp.SpaJson
that references the data in json. json is not copied, so it needs to stay alive.- Return type:
Constructs a new
Wp.SpaJson
that wraps the given spa_json.
- classmethod new_wrap_string(json_str)¶
- Parameters:
json_str (
str
) – a JSON string- Returns:
a new
Wp.SpaJson
that references the data in json_str. json_str is not copied, so it needs to stay alive.- Return type:
Constructs a new
Wp.SpaJson
that wraps a JSON string.New in version 0.5.0.
- classmethod new_wrap_stringn(json_str, len)¶
- Parameters:
- Returns:
a new
Wp.SpaJson
that references the data in json_str. json_str is not copied, so it needs to stay alive.- Return type:
Constructs a new
Wp.SpaJson
that wraps a JSON string with specific length.New in version 0.5.0.
- copy()¶
- Returns:
The newly copied spa json
- Return type:
Copies a spa json object.
- ensure_unique_owner()¶
- Returns:
the uniquely owned spa json object which may or may not be the same as self.
- Return type:
If self is not uniquely owned already, then it is unrefed and a copy of it is returned instead. You should always consider self as unsafe to use after this call and you should use the returned object instead.
- get_spa_json()¶
-
Converts a
Wp.SpaJson
pointer to a struct spa_json one, for use with native pipewire & spa functions. The returned pointer is owned byWp.SpaJson
and may not be modified or freed.
- is_array()¶
-
Checks whether the spa json is of type array or not.
- is_boolean()¶
-
Checks wether the spa json is of type boolean or not.
- is_container()¶
-
Checks whether the spa json is of type container or not.
- is_float()¶
-
Checks wether the spa json is of type float or not.
- is_int()¶
-
Checks wether the spa json is of type int or not.
- is_null()¶
-
Checks wether the spa json is of type null or not.
- is_object()¶
-
Checks whether the spa json is of type object or not.
- is_string()¶
-
Checks wether the spa json is of type string or not.
- is_unique_owner()¶
-
Checks if the json is the unique owner of its data or not.
- new_iterator()¶
- Returns:
the new spa json iterator
- Return type:
Creates a new iterator for a spa json object.
- parse_boolean()¶
-
Parses the boolean value of a spa json object.
- parse_float()¶
-
Parses the float value of a spa json object.
- parse_int()¶
-
Parses the int value of a spa json object.
- parse_string()¶
- Returns:
The newly allocated parsed string
- Return type:
Parses the string value of a spa json object.
- ref()¶
- Returns:
self with an additional reference count on it
- Return type:
Increases the reference count of a spa json object.
- to_string()¶
- Returns:
the json string with length matching the size
- Return type:
Returns a newly allocated json string with length matching the size.
New in version 0.4.11.
- unref()¶
Decreases the reference count on self and frees it when the ref count reaches zero.