⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cqlvaluerep.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 4 页
字号:
	    x._theValue.get(objParm);       	    return _compareObjects(objBase,objParm);       	  }	  break;	  	default:	MessageLoaderParms mload(String("CQL.CQLValueRep.CONSTRUCTOR_FAILURE"),				 String("Undefined case:$0 in constructor."),				 _valueType);	throw CQLRuntimeException(mload);	  break;	}      return false;    }}  Boolean CQLValueRep::operator!=(const CQLValueRep& x){  return !(this->operator==(x));}Boolean CQLValueRep::operator<=(const CQLValueRep& x){     if (this->operator<(x) || this->operator==(x))    {      return true;    }    return false;}Boolean CQLValueRep::operator>=(const CQLValueRep& x){  _validate(x);      return !(this->operator<(x));  }Boolean CQLValueRep::operator<(const CQLValueRep& x){  PEG_METHOD_ENTER(TRC_CQL, "CQLValueRep::operator<");  Uint64 tmpU64;  Sint64 tmpS64;  Real64 tmpR64;  _validate(x);  if(_theValue.isNull() && x._theValue.isNull())    {      return true;    }  if(_theValue.isNull() || x._theValue.isNull())    {      return false;    }  if(_theValue.isArray() || x._theValue.isArray())    {      return false;    }    switch(_valueType)    {    case CQLValue::Null_type:      {	return false;      }      break;          case CQLValue::Sint64_type:      {	_theValue.get(tmpS64);	if(x._valueType == CQLValue::Sint64_type)	  {	    Sint64 right;	    x._theValue.get(right);	    	    return tmpS64 < right;	  }	else if(x._valueType == CQLValue::Uint64_type)	  {	    x._theValue.get(tmpU64);	    	    if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)	      {		return true;	      }	    else	      {		return tmpS64 < (Sint64)tmpU64;	      }	  }	else 	  {	    x._theValue.get(tmpR64);	    	    return tmpS64 < tmpR64;	  }	break;      }    case CQLValue::Uint64_type:      {	_theValue.get(tmpU64);	if(x._valueType == CQLValue::Uint64_type)	  {	    Uint64 right;	    x._theValue.get(right);	    	    return tmpU64 < right;	  }	else if(x._valueType == CQLValue::Sint64_type)	  {	    x._theValue.get(tmpS64);	    	    if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)	      {		return false;	      }	    else	      {		return (Sint64)tmpU64 < tmpS64;	      }	  }	else 	  {	    x._theValue.get(tmpR64);	    if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)	      {		return false;	      }	   else	     {	       return (Sint64)tmpU64 < tmpR64;	     }	  }	break;      }    case CQLValue::Real_type:      {	_theValue.get(tmpR64);	if(x._valueType == CQLValue::Real_type)	  {	    Real64 right;	    x._theValue.get(right);	   	    return tmpR64 < right;	  }	else if(x._valueType == CQLValue::Uint64_type)	  {	    x._theValue.get(tmpU64);	    	    if(tmpU64 > (Uint64)PEGASUS_SINT64_MIN)	      {		return true;	      }	    else	      {		return tmpR64 < (Sint64)tmpU64;	      }	  }	else 	  {	    x._theValue.get(tmpS64);	    	    return tmpR64 < tmpS64;	  }	break;      }    case CQLValue::String_type:      {	String tmpS1;	String tmpS2;	_theValue.get(tmpS1);	x._theValue.get(tmpS2);	return tmpS1 < tmpS2;      }      break;    case CQLValue::CIMDateTime_type:        {	CIMDateTime tmpS1;	CIMDateTime tmpS2;	_theValue.get(tmpS1);	x._theValue.get(tmpS2);   	return tmpS1 < tmpS2;      }      break;    default:	MessageLoaderParms mload(String("CQL.CQLValueRep.CONSTRUCTOR_FAILURE"),				 String("Undefined case:$0 in constructor."));	throw CQLRuntimeException(mload);      break;    }  PEG_METHOD_EXIT();  return false;}Boolean CQLValueRep::operator>(const CQLValueRep& x){   _validate(x);     if (this->operator<(x) || this->operator==(x))     {       return false;     }     return true;}CQLValueRep CQLValueRep::operator+(const CQLValueRep x){  PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::operator+");   _validate(x);    switch(_valueType)     {     case CQLValue::String_type:       {	 String tmpS1;	 String tmpS2;	 _theValue.get(tmpS1);	 x._theValue.get(tmpS2);	 return CQLValueRep(tmpS1 + tmpS2);       }       break;            default:       MessageLoaderParms mload(String("CQL.CQLValueRep.CONSTRUCTOR_FAILURE"),				String("Undefined case:$0 in constructor."),				_valueType);       throw CQLRuntimeException(mload);       break;     }   PEG_METHOD_EXIT();   return x;}CQLValue::CQLValueType CQLValueRep::getValueType(){   return _valueType;}void CQLValueRep::setNull(){   _valueType = CQLValue::Null_type;   _isResolved = true;}Boolean CQLValueRep::isResolved(){   return _isResolved;}Boolean CQLValueRep::isNull(){   if(_valueType == CQLValue::Null_type)   {      return true;   }   return false;}Boolean CQLValueRep::isa(const CQLChainedIdentifier& inID,QueryContext& QueryCtx){   PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::isa()");  if(!_isResolved ||      (_valueType != CQLValue::CIMObject_type))    {      MessageLoaderParms mload(String("CQL.CQLValueRep.ISA_TYPE_MISMATCH"),			       String("The type: $0 is not an object, or the object is not resolved"),			       _valueType);      throw CQLRuntimeException(mload);    }    CIMName className;  CIMName isaName;  CIMObject obj;    _theValue.get(obj);    className = obj.getClassName();  isaName = inID[0].getName();    // Short circuit if the Object name and the isa name are the same.  // This will prevent an unneeded repository call.  if(className == isaName)    {      return true;    }  Array<CIMName> cimNames = QueryCtx.enumerateClassNames(isaName);  cimNames.append(isaName);  for(Uint32 i = 0; i < cimNames.size() ; ++i)    {            if(cimNames[i] == className)	{	  PEG_METHOD_EXIT();	  return true;	}    }  PEG_METHOD_EXIT();  return false;}Boolean CQLValueRep::like(const CQLValueRep& inVal){  PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::like()");   if( _valueType != CQLValue::String_type ||      inVal._valueType != CQLValue::String_type)   {       MessageLoaderParms mload(String("CQL.CQLValueRep.LIKE_TYPE_MISMATCH"),				String("The following types may not be strings:$0,$1."),				_valueType,inVal._valueType);       throw CQLRuntimeException(mload);   }      String leftside;   _theValue.get(leftside);   String rightside;   inVal._theValue.get(rightside);      CQLRegularExpression re;   PEG_METHOD_EXIT();   return re.match(leftside,rightside);}CQLChainedIdentifier CQLValueRep::getChainedIdentifier()const{   return _CQLChainId;}Uint64 CQLValueRep::getUint()const{  PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::getUint()");   if(_valueType != CQLValue::Uint64_type)   {	    String str;		 if(_theValue.isArray())		    str = "array";		 else str = valueTypeToString(_valueType);       MessageLoaderParms mload(String("CQL.CQLValueRep.TYPE_MISMATCH"),				String("The type: $0 is not correct for $1 operation."),				str,				String("getUint"));       throw CQLRuntimeException(mload);   }   Uint64 tmp;   _theValue.get(tmp);   PEG_METHOD_EXIT();   return tmp;}Boolean CQLValueRep::getBool()const{  PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::getBool()");   if(_valueType != CQLValue::Boolean_type)   {       String str;       if(_theValue.isArray())          str = "array";       else str = valueTypeToString(_valueType);       MessageLoaderParms mload(String("CQL.CQLValueRep.TYPE_MISMATCH"),            String("The type: $0 is not correct for $1 operation."),            str,            String("getBool"));       throw CQLRuntimeException(mload);   }   Boolean tmp;   _theValue.get(tmp);   PEG_METHOD_EXIT();   return tmp;}Sint64 CQLValueRep::getSint()const{  PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::getSint()");   if(_valueType != CQLValue::Sint64_type)   {       String str;       if(_theValue.isArray())          str = "array";       else str = valueTypeToString(_valueType);       MessageLoaderParms mload(String("CQL.CQLValueRep.TYPE_MISMATCH"),            String("The type: $0 is not correct for $1 operation."),            str,            String("getSint"));       throw CQLRuntimeException(mload);   }   Sint64 tmp;   _theValue.get(tmp);   PEG_METHOD_EXIT();   return tmp;}Real64 CQLValueRep::getReal()const{  PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::getReal()");   if(_valueType != CQLValue::Real_type)   {       String str;       if(_theValue.isArray())          str = "array";       else str = valueTypeToString(_valueType);       MessageLoaderParms mload(String("CQL.CQLValueRep.TYPE_MISMATCH"),            String("The type: $0 is not correct for $1 operation."),            str,            String("getReal"));       throw CQLRuntimeException(mload);   }   Real64 tmp;   _theValue.get(tmp);   PEG_METHOD_EXIT();   return tmp;}String CQLValueRep::getString()const{  PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::getString()");   if(_valueType != CQLValue::String_type)   {       String str;       if(_theValue.isArray())          str = "array";       else str = valueTypeToString(_valueType);       MessageLoaderParms mload(String("CQL.CQLValueRep.TYPE_MISMATCH"),            String("The type: $0 is not correct for $1 operation."),            str,            String("getString"));       throw CQLRuntimeException(mload);   }   String tmp;   _theValue.get(tmp);   PEG_METHOD_EXIT();   return tmp;}CIMDateTime CQLValueRep::getDateTime()const{  PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::getDateTime()");   if(_valueType != CQLValue::CIMDateTime_type)   {       String str;       if(_theValue.isArray())          str = "array";       else str = valueTypeToString(_valueType);       MessageLoaderParms mload(String("CQL.CQLValueRep.TYPE_MISMATCH"),            String("The type: $0 is not correct for $1 operation."),            str,            String("getDateTime"));       throw CQLRuntimeException(mload);   }   CIMDateTime tmp;   _theValue.get(tmp);   PEG_METHOD_EXIT();   return tmp;}CIMObjectPath CQLValueRep::getReference()const{  PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::getReference()");   if(_valueType != CQLValue::CIMReference_type)   {       String str;       if(_theValue.isArray())          str = "array";       else str = valueTypeToString(_valueType);       MessageLoaderParms mload(String("CQL.CQLValueRep.TYPE_MISMATCH"),            String("The type: $0 is not correct for $1 operation."),            str,            String("getReference"));       throw CQLRuntimeException(mload);   }   CIMObjectPath tmp;   _theValue.get(tmp);   PEG_METHOD_EXIT();   return tmp;}CIMObject CQLValueRep::getObject()const{  PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::getObject()");   if(_valueType != CQLValue::CIMObject_type)   {       String str;       if(_theValue.isArray())          str = "array";       else str = valueTypeToString(_valueType);       MessageLoaderParms mload(String("CQL.CQLValueRep.TYPE_MISMATCH"),            String("The type: $0 is not correct for $1 operation."),            str,            String("getObject"));       throw CQLRuntimeException(mload);   }   CIMObject tmp;   _theValue.get(tmp);   PEG_METHOD_EXIT();   return tmp.clone();}String CQLValueRep::toString()const{  if(_valueType == CQLValue::CQLIdentifier_type)    {      return _CQLChainId.toString();    }  else  {    String returnStr;    if (_valueType == CQLValue::String_type)    {      returnStr.append("'");    }    String temp(_theValue.toString());        // If the string is a real string, then strip padding off the exponent    if (_valueType == CQLValue::Real_type)      temp = CQLUtilities::formatRealStringExponent(temp);        returnStr.append(temp);        if (_valueType == CQLValue::String_type)    {      returnStr.append("'");    }    return returnStr;  }}void CQLValueRep::_validate(const CQLValueRep& x){  PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::_validate()");    // Do not allow an array value be compared to a non array value.  if(x._theValue.isArray() != _theValue.isArray())    {      	  MessageLoaderParms mload(String("CQL.CQLValueRep.OP_TYPE_MISMATCH"),				   String("Validation type mismatch error for type: $0"),				   String("ARRAY"));	  throw CQLRuntimeException(mload);    }  switch(_valueType)    {    case CQLValue::Boolean_type:      if(x._valueType != CQLValue::Boolean_type)	{	  MessageLoaderParms mload(String("CQL.CQLValueRep.OP_TYPE_MISMATCH"),				   String("Validation type mismatch error for type: $0"),				   String("BOOLEAN"));	  throw CQLRuntimeException(mload);	}      break;    case CQLValue::Sint64_type:    case CQLValue::Uint64_type:    case CQLValue::Real_type:      if(x._valueType != CQLValue::Sint64_type &&

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -