Beispiel #1
0
static int propCompare(QLOperand* self, QLOperand* op, 
   QLPropertySource* src)
{
   QLOperand *nop=NULL;
   QLOpd type;
   int rc;
   CMPIValue v=getPropValue(self, src, &type);
   char *str;

   switch (type) {
   case QL_Integer: 
      nop=newIntQueryOperand(NULL,v.sint64);
      break;
   case QL_UInteger: 
      nop=newIntQueryOperand(NULL,v.sint64);
      nop->type=QL_UInteger;
      break;
   case QL_Double:
      nop=newDoubleQueryOperand(NULL,v.real64);
      break;
   case QL_Boolean:
      nop=newBooleanQueryOperand(NULL,v.boolean);
      break;
   case QL_Chars:
      nop=newCharsQueryOperand(NULL,v.chars);
      break;
   case QL_Char:
      nop=newCharsQueryOperand(NULL,v.chars);
      nop->type=QL_Char;
      nop->value.char16=v.char16;
      break;
    case QL_Inst:
      nop=newInstQueryOperand(NULL,v.inst);
      nop->type=QL_Char;
      nop->value.char16=v.char16;
      break;
   case QL_PropertyName:
   case QL_Name:
      mlogf(M_ERROR,M_SHOW,"### propCompare(): (QL_PropertyName QL_Name) got a problem\n");
      return -2;
      /*      abort();*/
      break;
   case QL_Invalid:
      mlogf(M_ERROR,M_SHOW,"### propCompare(): got a problem\n");
      return -2;
      /* abort();*/
      break;
   case QL_NotFound:
      str=propToString(self);
      mlogf(M_ERROR,M_SHOW,"### propCompare(): %s not found\n",str);
      free(str);
      return -2;
      /*abort();*/
   default:
      ; // what should we do here ?  
   }
   
   if (nop) {
    rc=nop->ft->compare(nop,op,src);
   } else {
      rc=-2;
      if ((type == QL_Null) && (op->type == QL_PropertyName)) {
         // both are property names
         v=getPropValue(op, src, &type);
         if (type == QL_Null) {
            rc=0; // both are NULL, a match
         }
      } 
   }
   

   QL_TRACE(fprintf(stderr,"propCompare(%s) %d\n",self->propertyName->propName,rc));
   return rc;
}
Beispiel #2
0
void
CPCDAPISession::printProperty(Properties *prop, const char *key) {
  m_output->println("%s: %s", key, propToString(prop, key));
}