Skip to content
Snippets Groups Projects
Commit 0c6ef834 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

lib: properties: add wp_properties_copy_keys

A method to copy specific keys from one properties set to another
parent cc3f01b2
No related branches found
No related tags found
No related merge requests found
......@@ -178,6 +178,32 @@ wp_properties_update_from_dict (WpProperties * self,
return pw_properties_update (self->props, dict);
}
gint
wp_properties_copy_keys (WpProperties * src, WpProperties * dst,
const gchar *key1, ...)
{
gint ret;
va_list args;
va_start (args, key1);
ret = wp_properties_copy_keys_valist (src, dst, key1, args);
va_end (args);
return ret;
}
gint
wp_properties_copy_keys_valist (WpProperties * src, WpProperties * dst,
const gchar *key1, va_list args)
{
gint changed = 0;
const gchar *value;
for (; key1; key1 = va_arg (args, const gchar *)) {
if ((value = wp_properties_get (src, key1)) != NULL)
changed += wp_properties_set (dst, key1, value);
}
return changed;
}
const gchar *
wp_properties_get (WpProperties * self, const gchar * key)
{
......
......@@ -41,6 +41,11 @@ void wp_properties_unref (WpProperties * self);
gint wp_properties_update_from_dict (WpProperties * self,
const struct spa_dict * dict);
gint wp_properties_copy_keys (WpProperties * src, WpProperties * dst,
const gchar *key1, ...) G_GNUC_NULL_TERMINATED;
gint wp_properties_copy_keys_valist (WpProperties * src, WpProperties * dst,
const gchar *key1, va_list args);
const gchar * wp_properties_get (WpProperties * self, const gchar * key);
gint wp_properties_set (WpProperties * self, const gchar * key,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment