class Xmms::Dict
Public Instance Methods
[](p1)
click to toggle source
static VALUE c_dict_aref (VALUE self, VALUE key) { RbDict *dict = NULL; xmmsv_dict_iter_t *it; xmmsv_t *value; const char *ckey; int s; Check_Type (key, T_SYMBOL); Data_Get_Struct (self, RbDict, dict); ckey = rb_id2name (SYM2ID (key)); xmmsv_get_dict_iter (dict->real, &it); s = xmmsv_dict_iter_find (it, ckey); if (!s) return Qnil; xmmsv_dict_iter_pair (it, NULL, &value); return extract_value (self, value); }
each()
click to toggle source
static VALUE c_dict_each (VALUE self) { RbDict *dict = NULL; Data_Get_Struct (self, RbDict, dict); xmmsv_dict_foreach (dict->real, dict_each_pair, &self); return self; }
Also aliased as: each_pair
each_key()
click to toggle source
static VALUE c_dict_each_key (VALUE self) { RbDict *dict = NULL; Data_Get_Struct (self, RbDict, dict); xmmsv_dict_foreach (dict->real, dict_each_key, NULL); return self; }
each_value()
click to toggle source
static VALUE c_dict_each_value (VALUE self) { RbDict *dict = NULL; Data_Get_Struct (self, RbDict, dict); xmmsv_dict_foreach (dict->real, dict_each_value, &self); return self; }
empty?()
click to toggle source
static VALUE c_dict_empty (VALUE self) { RbDict *dict = NULL; int size; Data_Get_Struct (self, RbDict, dict); size = xmmsv_dict_get_size (dict->real); return size == 0 ? Qtrue : Qfalse; }
has_key?(p1)
click to toggle source
static VALUE c_dict_has_key (VALUE self, VALUE key) { RbDict *dict = NULL; xmmsv_dict_iter_t *it; const char *ckey; Check_Type (key, T_SYMBOL); Data_Get_Struct (self, RbDict, dict); ckey = rb_id2name (SYM2ID (key)); xmmsv_get_dict_iter (dict->real, &it); return xmmsv_dict_iter_find (it, ckey) ? Qtrue : Qfalse; }
inspect()
click to toggle source
static VALUE c_dict_inspect (VALUE self) { return rb_protect_inspect (dict_inspect, self, 0); }
size()
click to toggle source
static VALUE c_dict_size (VALUE self) { RbDict *dict = NULL; int size; Data_Get_Struct (self, RbDict, dict); size = xmmsv_dict_get_size (dict->real); return INT2NUM (size); }
Also aliased as: length