char __comps_doccategory_idcmp(void *c1, void *c2) { COMPS_Object *obj1, *obj2; char ret; obj1 = comps_objdict_get(((COMPS_DocCategory*)c1)->properties, "id"); obj2 = comps_objdict_get(((COMPS_DocCategory*)c2)->properties, "id"); ret = comps_object_cmp(obj1, obj2); COMPS_OBJECT_DESTROY(obj1); COMPS_OBJECT_DESTROY(obj2); return ret; }
char __comps_docgroup_idcmp(void *g1, void *g2) { COMPS_Object *obj1, *obj2; char ret; obj1 = comps_objdict_get(((COMPS_DocGroup*)g1)->properties, "id"); obj2 = comps_objdict_get(((COMPS_DocGroup*)g2)->properties, "id"); ret = comps_object_cmp(obj1, obj2); COMPS_OBJECT_DESTROY(obj1); COMPS_OBJECT_DESTROY(obj2); return ret; }
PyObject* pycomps_group_boolattr_getter(PyObject *self, void *closure) { COMPS_Object *tmp_prop; PyObject *ret; tmp_prop = comps_objdict_get(((PyCOMPS_Group*)self)->group->properties, (char*)closure); if (tmp_prop) { ret = PyBool_FromLong(((COMPS_Num*)tmp_prop)->val); COMPS_OBJECT_DESTROY(tmp_prop); return ret; } else Py_RETURN_NONE; }
PyObject* PyCOMPSDict_has_key(PyObject * self, PyObject *key) { char *ckey; COMPS_Object *val; if (__pycomps_stringable_to_char(key, &ckey)) { return NULL; } val = comps_objdict_get(((PyCOMPS_Dict*)self)->dict, ckey); free(ckey); if (!val) Py_RETURN_FALSE; else Py_RETURN_TRUE; }
PyObject* PyCOMPSDict_get(PyObject *self, PyObject *key) { char *ckey; COMPS_Object* val; PyObject *ret = NULL; if (__pycomps_stringable_to_char(key, &ckey)) { return NULL; } val = comps_objdict_get(((PyCOMPS_Dict*)self)->dict, ckey); if (!val) { PyErr_Format(PyExc_KeyError, "KeyError: '%s'", ckey); } else { ret = ((PyCOMPS_Dict*)self)->it_info->out_convert_func(val); COMPS_OBJECT_DESTROY(val); } free(ckey); return ret; }
PyObject* PyCOMPSDict_get_(PyObject *self, PyObject *key) { char *ckey; COMPS_Object* val; PyObject *ret; if (__pycomps_stringable_to_char(key, &ckey)) return NULL; val = comps_objdict_get(((PyCOMPS_Dict*)self)->dict, ckey); if (!val) { free(ckey); Py_RETURN_NONE; } else { free(ckey); ckey = comps_object_tostr(val); COMPS_OBJECT_DESTROY(val); ret = PyUnicode_FromString(ckey); free(ckey); return ret; } }