lib: properties: add update() and copy_from_dict() API

This commit is contained in:
George Kiagiadakis 2019-08-29 19:41:04 +03:00
parent 7608ae37b5
commit ff59fc06db
2 changed files with 21 additions and 0 deletions

View file

@ -143,6 +143,12 @@ wp_properties_new_copy_dict (const struct spa_dict * dict)
return self;
}
WpProperties *
wp_properties_copy (WpProperties * other)
{
return wp_properties_new_copy_dict (wp_properties_peek_dict (other));
}
static void
wp_properties_free (WpProperties * self)
{
@ -162,6 +168,16 @@ wp_properties_unref (WpProperties * self)
g_rc_box_release_full (self, (GDestroyNotify) wp_properties_free);
}
gint
wp_properties_update_from_dict (WpProperties * self,
const struct spa_dict * dict)
{
g_return_val_if_fail (self != NULL, -EINVAL);
g_return_val_if_fail (!(self->flags & FLAG_IS_DICT), -EINVAL);
return pw_properties_update (self->props, dict);
}
const gchar *
wp_properties_get (WpProperties * self, const gchar * key)
{

View file

@ -33,9 +33,14 @@ WpProperties * wp_properties_new_copy (const struct pw_properties * props);
WpProperties * wp_properties_new_wrap_dict (const struct spa_dict * dict);
WpProperties * wp_properties_new_copy_dict (const struct spa_dict * dict);
WpProperties * wp_properties_copy (WpProperties * other);
WpProperties * wp_properties_ref (WpProperties * self);
void wp_properties_unref (WpProperties * self);
gint wp_properties_update_from_dict (WpProperties * self,
const struct spa_dict * dict);
const gchar * wp_properties_get (WpProperties * self, const gchar * key);
gint wp_properties_set (WpProperties * self, const gchar * key,