class Xmms::RawDict
Public Instance Methods
to_propdict( src_prefs ) → propdict
click to toggle source
Transforms a RawDict (key-source-value) to a regular key-value dict. The optional src_prefs argument restricts which sources are considered. The value may be a string or an array of strings, which may contain wildcards. Example: rawdict.to_propdict( [‘server’,‘plugin/*’] )
static VALUE c_raw_dict_to_propdict (int argc, VALUE *argv, VALUE self) { VALUE value, sources = Qnil; RbDict *dict = NULL, *dict2 = NULL; xmmsv_t *inner_dict; const char **csources = NULL; Data_Get_Struct (self, RbDict, dict); rb_scan_args (argc, argv, "01", &sources); if (!NIL_P (sources)) csources = parse_string_array (sources); inner_dict = xmmsv_propdict_to_dict (dict->real, csources); if (csources) free (csources); value = Data_Make_Struct (cDict, RbDict, c_dict_mark, c_dict_free, dict2); // don't add a second reference here dict2->real = inner_dict; dict2->parent = dict->parent; rb_obj_call_init (value, 0, NULL); return value; }