CMPIStatus enum_profiles(const CMPIBroker *broker, const CMPIObjectPath *reference, const char **properties, struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; virConnectPtr conn = NULL; int i; conn = connect_by_classname(broker, CLASSNAME(reference), &s); if (conn == NULL) goto out; for (i = 0; profiles[i] != NULL; i++) { CMPIInstance *inst = NULL; s = get_profile(broker, reference, properties, pfx_from_conn(conn), profiles[i], &inst); if (s.rc != CMPI_RC_OK) continue; inst_list_add(list, inst); } out: virConnectClose(conn); return s; }
bool SelectionTool::canPerform(const Object *o) const { if (!o->inherits(CLASSNAME(PointObject))) return false; if (interaction().button() == Qt::LeftButton) return true; if (interaction().type() == Interaction::Move) return true; return false; }
CMPIStatus get_profile_by_name(const CMPIBroker *broker, const CMPIObjectPath *reference, const char *name, const char **properties, CMPIInstance **_inst) { CMPIStatus s = {CMPI_RC_OK, NULL}; virConnectPtr conn = NULL; int i; bool found = false; conn = connect_by_classname(broker, CLASSNAME(reference), &s); if (conn == NULL) { cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, "No such instance"); goto out; } for (i = 0; profiles[i] != NULL; i++) { if(STREQ(name, profiles[i]->reg_id)) { CMPIInstance *inst = NULL; s = get_profile(broker, reference, properties, pfx_from_conn(conn), profiles[i], &inst); if (s.rc != CMPI_RC_OK) goto out; *_inst = inst; found = true; break; } } if (found == false) cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, "No such instance (%s)", name); out: virConnectClose(conn); return s; }
void SelectionTool::perform_virtual(Object *o) { PointObject* pointObject = (PointObject*) o; Point* p = pointObject->pointAt(interaction(o).point()); if (p && interaction().click() == Interaction::DoubleClick) { PointEditDialog::exec_static(p, pointObject->inherits(CLASSNAME(Spline)) && ((Spline*) pointObject)->type() == Spline::Bezier, parentWidget()); } if (interaction().type() == Interaction::Press) { if (p && !p->isSelected()) { _justSelectedOrRemoved = true; } if (interaction().modifiers() != Qt::SHIFT) pointObject->deselectAllPoints(); if (p) { pointObject->selectPoint(p); } } else if (interaction().type() == Interaction::Release) { if (interaction().modifiers() != Qt::SHIFT) { pointObject->deselectAllPoints(); } if (p && !p->isSelected()) { pointObject->selectPoint(p); } if (p && p->isSelected() && !_justSelectedOrRemoved) { pointObject->deselectPoint(p); } _justSelectedOrRemoved = false; } else if (interaction().type() == Interaction::Move) { for (Point* point : pointObject->selection()) { point->move(interaction(o).point()); } if (!pointObject->selection().isEmpty()) { pointObject->emitChanged(); _justSelectedOrRemoved = true; } } }
static void finalize_object(GCObjectPtr p) { GCObjectHeader* headerp = (GCObjectHeader*)p; if ((*headerp & EJS_SCAN_TYPE_OBJECT) != 0) { SPEW(2, _ejs_log ("finalizing object %p(%s)\n", p, CLASSNAME(p))); OP(p, finalize)((EJSObject*)p); } else if ((*headerp & EJS_SCAN_TYPE_CLOSUREENV) != 0) { SPEW(2, _ejs_log ("finalizing closureenv %p\n", p)); } else if ((*headerp & EJS_SCAN_TYPE_PRIMSTR) != 0) { SPEW(1, { EJSPrimString* primstr = (EJSPrimString*)p; if (EJS_PRIMSTR_GET_TYPE(primstr) == EJS_STRING_FLAT) { char* utf8 = ucs2_to_utf8(primstr->data.flat); SPEW(2, _ejs_log ("finalizing flat primitive string %p(%s)\n", p, utf8)); free (utf8); } else { SPEW(2, _ejs_log ("finalizing primitive string %p\n", p)); } });
static CMPIStatus raise_indication(const CMPIBroker *broker, const CMPIContext *ctx, const CMPIObjectPath *ref, const CMPIInstance *ind) { struct std_indication_ctx *_ctx = NULL; CMPIStatus s = {CMPI_RC_OK, NULL}; struct ind_args *args = NULL; CMPIObjectPath *_ref = NULL; _ctx = malloc(sizeof(struct std_indication_ctx)); if (_ctx == NULL) { cu_statusf(broker, &s, CMPI_RC_ERR_FAILED, "Unable to allocate indication context"); goto out; } _ctx->brkr = broker; _ctx->handler = NULL; _ctx->filters = filters; _ctx->enabled = 1; args = malloc(sizeof(struct ind_args)); if (args == NULL) { cu_statusf(broker, &s, CMPI_RC_ERR_FAILED, "Unable to allocate ind_args"); goto out; } _ref = CMGetObjectPath(ind, &s); if (_ref == NULL) { cu_statusf(broker, &s, CMPI_RC_ERR_FAILED, "Got a null object path"); goto out; } /* FIXME: This is a Pegasus work around. Pegsus loses the namespace when an ObjectPath is pulled from an instance */ CMSetNameSpace(_ref, "root/virt"); args->ns = strdup(NAMESPACE(_ref)); args->classname = strdup(CLASSNAME(_ref)); args->_ctx = _ctx; /* This is a workaround for Pegasus, it loses its objectpath by CMGetObjectPath. So set it back. */ ind->ft->setObjectPath((CMPIInstance *)ind, _ref); s = stdi_deliver(broker, ctx, args, (CMPIInstance *)ind); if (s.rc == CMPI_RC_OK) { CU_DEBUG("Indication delivered"); } else { if (s.msg == NULL) { CU_DEBUG("Not delivered: msg is NULL."); } else { CU_DEBUG("Not delivered: %s", CMGetCharPtr(s.msg)); } } out: if (args != NULL) stdi_free_ind_args(&args); if (_ctx != NULL) free(_ctx); return s; }
bool DeselectAllTool::canPerform(const Object *o) const { return o->inherits(CLASSNAME(PointObject)); }