properties: Add API to clear all properties

This is useful if we want to clear all properties without destroying the instance.
This commit is contained in:
Julian Bouzas 2026-04-21 08:01:03 -04:00
parent 7fa44ef8d0
commit 9d8d0e2ae0
2 changed files with 19 additions and 0 deletions

View file

@ -440,6 +440,22 @@ wp_properties_update_from_json (WpProperties * self, const WpSpaJson * json)
wp_spa_json_get_size (json));
}
/*!
* \brief Clears all properties from \a self.
*
* \ingroup wpproperties
* \param self a properties object
*/
void
wp_properties_clear (WpProperties *self)
{
g_return_if_fail (self != NULL);
g_return_if_fail (!(self->flags & FLAG_IS_DICT));
g_return_if_fail (!(self->flags & FLAG_NO_OWNERSHIP));
pw_properties_clear (self->props);
}
/*!
* \brief Adds new properties in \a self, using the given \a props as a source.
*

View file

@ -85,6 +85,9 @@ gint wp_properties_update_from_dict (WpProperties * self,
WP_API
gint wp_properties_update_from_json (WpProperties * self, const WpSpaJson * json);
WP_API
void wp_properties_clear (WpProperties *self);
/* add */
WP_API