static CMPIData getQualifierAt(CMPIConstClass * cc, CMPICount i, CMPIString **name, CMPIStatus *rc) { ClClass *cls = (ClClass *) cc->hdl; char *n; CMPIData rv = { 0, CMPI_notFound, {0} }; if (ClClassGetQualifierAt(cls, i, &rv, name ? &n : NULL)) { if (rc) CMSetStatus(rc, CMPI_RC_ERR_NOT_FOUND); return rv; } if (rv.type == CMPI_chars) { rv.value.string = sfcb_native_new_CMPIString(ClObjectGetClString (&cls->hdr, (ClString *) & rv.value. chars), NULL, 0); rv.type = CMPI_string; } if (rv.type & CMPI_ARRAY && rv.value.array) { rv.value.array = native_make_CMPIArray((CMPIData *) rv.value.array, NULL, &cls->hdr); } if (name) { *name = sfcb_native_new_CMPIString(n, NULL, 0); } if (rc) CMSetStatus(rc, CMPI_RC_OK); return rv; }
static CMPIData getQualifier(CMPIConstClass * cc, const char *name, CMPIStatus *rc) { ClClass *cls = (ClClass *) cc->hdl; CMPIData rv_notfound = { 0, CMPI_notFound, {0} }; CMPIData rv; char *qname; int i; CMPICount cnt = ClClassGetQualifierCount(cls); for (i = 0; i < cnt; i++) { if (ClClassGetQualifierAt(cls, i, &rv, &qname)) { if (rc) CMSetStatus(rc, CMPI_RC_ERR_NOT_FOUND); return rv_notfound; } if (strcasecmp(name, qname) == 0) { if (rv.type == CMPI_chars) { rv.value.string = sfcb_native_new_CMPIString(ClObjectGetClString (&cls->hdr, (ClString *) & rv.value.chars), NULL, 0); rv.type = CMPI_string; } if (rv.type & CMPI_ARRAY && rv.value.array) { rv.value.array = native_make_CMPIArray((CMPIData *) rv.value.array, NULL, &cls->hdr); } if (rc) CMSetStatus(rc, CMPI_RC_OK); return rv; }; } if (rc) CMSetStatus(rc, CMPI_RC_ERR_NOT_FOUND); return rv_notfound; }
static int cpyClass(ClClass * cl, CMPIConstClass * cc, unsigned char originId) { ClClass *ccl = (ClClass *) cc->hdl; CMPIData d; // CMPIParameter p; // CMPIType t; char *name; char *refName = NULL; int i, m, iq, mq, propId; // int parmId, methId, mp, ip; unsigned long quals; ClProperty *prop; // ClMethod *meth; // ClParameter *parm; cl->quals |= ccl->quals; for (i = 0, m = ClClassGetQualifierCount(ccl); i < m; i++) { ClClassGetQualifierAt(ccl, i, &d, &name); ClClassAddQualifierSpecial(&cl->hdr, &cl->qualifiers, name, d, &ccl->hdr); if (!(d.type & CMPI_ARRAY)) sfcb_native_release_CMPIValue(d.type, &d.value); // free(name); } for (i = 0, m = ClClassGetPropertyCount(ccl); i < m; i++) { char *pname; ClClassGetPropertyAt(ccl, i, &d, &pname, &quals, &refName); propId = ClClassAddProperty(cl, pname, d, refName); prop = ((ClProperty *) ClObjectGetClSection(&cl->hdr, &cl->properties)) + propId - 1; if (refName) { // CJB free(refName); } for (iq = 0, mq = ClClassGetPropQualifierCount(ccl, i); iq < mq; iq++) { char *qname; ClClassGetPropQualifierAt(ccl, i, iq, &d, &qname); ClClassAddPropertyQualifierSpecial(&cl->hdr, prop, qname, d, &ccl->hdr); if (!(d.type & CMPI_ARRAY)) sfcb_native_release_CMPIValue(d.type, &d.value); // CJB free(qname); } // CJB free(pname); } /* * CJB for (i=0,m=ClClassGetMethodCount(ccl); i<m; i++) { * ClClassGetMethodAt(ccl,i,&t,&name,&quals); * methId=ClClassAddMethod(cl, name, t); * meth=((ClMethod*)ClObjectGetClSection(&cl->hdr,&cl->methods))+methId-1; * * // CJB // for (iq=0,mq=ClClassGetMethQualifierCount(ccl,methId-1); * iq<mq; iq++) { // ClClassGetMethQualifierAt(ccl, meth, iq, &d, * &name); // ClClassAddMethodQualifier(&cl->hdr, meth, name, d); // } * * * for (ip=0,mp=ClClassGetMethParameterCount(ccl,methId-1); ip<mp; ip++) * { ClClassGetMethParameterAt(ccl, meth, ip, &p, &name); * parmId=ClClassAddMethParameter(&cl->hdr, meth, name, p); * parm=((ClParameter*)ClObjectGetClSection(&cl->hdr,&meth->parameters))+parmId-1; * * for (iq=0,mq=ClClassGetMethParamQualifierCount(ccl,parm); iq<mq; * iq++) { ClClassGetMethParamQualifierAt(ccl, parm, iq, &d, &name); * ClClassAddMethParamQualifier(&cl->hdr, parm, name, d); } } } */ return 0; }
static int cpyClass(ClClass * cl, CMPIConstClass * cc) { ClClass *ccl = (ClClass *) cc->hdl; CMPIData d; CMPIParameter p; CMPIType t; char *name; char *refName = NULL; int i, m, iq, mq, ip, mp, propId, methId, parmId; unsigned long quals; ClProperty *prop; ClMethod *meth; ClParameter *parm; cl->quals |= ccl->quals; for (i = 0, m = ClClassGetQualifierCount(ccl); i < m; i++) { ClClassGetQualifierAt(ccl, i, &d, &name); ClClassAddQualifierSpecial(&cl->hdr, &cl->qualifiers, name, d, &ccl->hdr); } for (i = 0, m = ClClassGetPropertyCount(ccl); i < m; i++) { ClClassGetPropertyAt(ccl, i, &d, &name, &quals, &refName); propId = ClClassAddProperty(cl, name, d, refName); if (refName) { free(refName); } prop = ((ClProperty *) ClObjectGetClSection(&cl->hdr, &cl->properties)) + propId - 1; for (iq = 0, mq = ClClassGetPropQualifierCount(ccl, i); iq < mq; iq++) { ClClassGetPropQualifierAt(ccl, i, iq, &d, &name); ClClassAddPropertyQualifierSpecial(&cl->hdr, prop, name, d, &ccl->hdr); } } for (i = 0, m = ClClassGetMethodCount(ccl); i < m; i++) { ClClassGetMethodAt(ccl, i, &t, &name, &quals); methId = ClClassAddMethod(cl, name, t); meth = ((ClMethod *) ClObjectGetClSection(&cl->hdr, &cl->methods)) + methId - 1; for (iq = 0, mq = ClClassGetMethQualifierCount(ccl, methId - 1); iq < mq; iq++) { ClClassGetMethQualifierAt(ccl, meth, iq, &d, &name); ClClassAddMethodQualifier(&cl->hdr, meth, name, d); } for (ip = 0, mp = ClClassGetMethParameterCount(ccl, methId - 1); ip < mp; ip++) { ClClassGetMethParameterAt(ccl, meth, ip, &p, &name); parmId = ClClassAddMethParameter(&cl->hdr, meth, name, p); parm = ((ClParameter *) ClObjectGetClSection(&cl->hdr, &meth->parameters)) + parmId - 1; for (iq = 0, mq = ClClassGetMethParamQualifierCount(parm); iq < mq; iq++) { ClClassGetMethParamQualifierAt(ccl, parm, iq, &d, &name); ClClassAddMethParamQualifier(&cl->hdr, parm, name, d); } } } return 0; }