xobjectcomparator.cpp
来自「IBM的解析xml的工具Xerces的源代码」· C++ 代码 · 共 970 行 · 第 1/3 页
CPP
970 行
XTemplateComparator::isEquivalent(lValue->fAttributes , rValue->fAttributes) && XTemplateComparator::isEquivalent(lValue->fAnyAttributes , rValue->fAnyAttributes) );}/********************************************************** * * DatatypeValidator * * * DatatypeValidatorFactory * ***********************************************************/ bool XObjectComparator::isEquivalent(DatatypeValidator* const lValue , DatatypeValidator* const rValue){ IS_EQUIVALENT(lValue, rValue) if (lValue->getType() != rValue->getType()) { return false; } //todo //to call individual isEquivalent according to the actual type // return true;}bool XObjectComparator::isBaseEquivalent(DatatypeValidator* const lValue , DatatypeValidator* const rValue){ //todo return true;}bool XObjectComparator::isEquivalent(DatatypeValidatorFactory* const lValue , DatatypeValidatorFactory* const rValue){ IS_EQUIVALENT(lValue, rValue) return XTemplateComparator::isEquivalent(lValue->fUserDefinedRegistry , rValue->fUserDefinedRegistry);}/********************************************************** * * ContentSpecNode * QName * KVStringPair * XMLRefInfo * StringPool * ***********************************************************/ bool XObjectComparator::isEquivalent(ContentSpecNode* const lValue , ContentSpecNode* const rValue){ IS_EQUIVALENT(lValue, rValue) return ( (lValue->fType == rValue->fType) && (lValue->fAdoptFirst == rValue->fAdoptFirst) && (lValue->fAdoptSecond == rValue->fAdoptSecond) && (lValue->fMinOccurs == rValue->fMinOccurs) && (lValue->fMaxOccurs == rValue->fMaxOccurs) && isEquivalent(lValue->fElement, rValue->fElement) && isEquivalent(lValue->fFirst, rValue->fFirst) && isEquivalent(lValue->fSecond, rValue->fSecond) );}bool XObjectComparator::isEquivalent(QName* const lValue , QName* const rValue){ IS_EQUIVALENT(lValue, rValue) return (XMLString::equals(lValue->fPrefix, rValue->fPrefix) && XMLString::equals(lValue->fLocalPart, rValue->fLocalPart) && (lValue->fURIId == rValue->fURIId) );}bool XObjectComparator::isEquivalent(KVStringPair* const lValue , KVStringPair* const rValue){ IS_EQUIVALENT(lValue, rValue) return (XMLString::equals(lValue->fKey, rValue->fKey) && XMLString::equals(lValue->fValue, rValue->fValue) );}bool XObjectComparator::isEquivalent(XMLRefInfo* const lValue , XMLRefInfo* const rValue){ IS_EQUIVALENT(lValue, rValue) return ( (lValue->fDeclared == rValue->fDeclared) && (lValue->fUsed == rValue->fUsed) && XMLString::equals(lValue->fRefName, rValue->fRefName) );}bool XObjectComparator::isEquivalent(XMLStringPool* const lValue , XMLStringPool* const rValue){ IS_EQUIVALENT(lValue, rValue) if (lValue->getStringCount() != rValue->getStringCount()) return false; for (unsigned int i = 1; i < lValue->getStringCount(); i++) { if (!XMLString::equals(lValue->getValueForId(i), rValue->getValueForId(i))) return false; } return true;}/********************************************************** * * XercesNodeTest * XercesStep * XercesLocationPath * XercesXPath * ***********************************************************/ bool XObjectComparator::isEquivalent(XercesNodeTest* const lValue , XercesNodeTest* const rValue){ IS_EQUIVALENT(lValue, rValue) return ( (lValue->fType == rValue->fType) && isEquivalent(lValue->fName, rValue->fName) ); } bool XObjectComparator::isEquivalent(XercesStep* const lValue , XercesStep* const rValue){ IS_EQUIVALENT(lValue, rValue) return ( (lValue->fAxisType == rValue->fAxisType) && isEquivalent(lValue->fNodeTest, rValue->fNodeTest) ); }bool XObjectComparator::isEquivalent(XercesLocationPath* const lValue , XercesLocationPath* const rValue){ IS_EQUIVALENT(lValue, rValue) return ( XTemplateComparator::isEquivalent(lValue->fSteps, rValue->fSteps) ); }bool XObjectComparator::isEquivalent(XercesXPath* const lValue , XercesXPath* const rValue){ IS_EQUIVALENT(lValue, rValue) return ( (lValue->fEmptyNamespaceId == rValue->fEmptyNamespaceId) && XMLString::equals(lValue->fExpression , rValue->fExpression) && XTemplateComparator::isEquivalent(lValue->fLocationPaths , rValue->fLocationPaths) ); }/********************************************************** * * IC_Field * IC_Select * * IdentityConstraint * IC_Key * IC_KeyRef * IC_Unique * * ***********************************************************/ bool XObjectComparator::isEquivalent(IC_Field* const lValue , IC_Field* const rValue){ IS_EQUIVALENT(lValue, rValue) return ( isEquivalent(lValue->fXPath , rValue->fXPath) && isEquivalent(lValue->fIdentityConstraint , rValue->fIdentityConstraint) ); }bool XObjectComparator::isEquivalent(IC_Selector* const lValue , IC_Selector* const rValue){ IS_EQUIVALENT(lValue, rValue) return ( isEquivalent(lValue->fXPath , rValue->fXPath) && isEquivalent(lValue->fIdentityConstraint , rValue->fIdentityConstraint) ); }bool XObjectComparator::isEquivalent(IdentityConstraint* const lValue , IdentityConstraint* const rValue){ IS_EQUIVALENT(lValue, rValue) if (lValue->getType() != rValue->getType()) { //throw exception here return false; } switch(lValue->getType()) { case IdentityConstraint::UNIQUE: return isEquivalent((IC_Unique*)lValue, (IC_Unique*)rValue); case IdentityConstraint::KEY: return isEquivalent((IC_Key*)lValue, (IC_Key*)rValue); case IdentityConstraint::KEYREF: return isEquivalent((IC_KeyRef*)lValue, (IC_KeyRef*)rValue); default: //throw exception here return false; } }bool XObjectComparator::isBaseEquivalent(IdentityConstraint* const lValue , IdentityConstraint* const rValue){ return ( XMLString::equals(lValue->fIdentityConstraintName , rValue->fIdentityConstraintName) && XMLString::equals(lValue->fElemName , rValue->fElemName) && isEquivalent(lValue->fSelector, rValue->fSelector) && XTemplateComparator::isEquivalent(lValue->fFields , rValue->fFields) ); }bool XObjectComparator::isEquivalent(IC_Key* const lValue , IC_Key* const rValue){ IS_EQUIVALENT(lValue, rValue) if (!isBaseEquivalent(lValue, rValue)) return false; // no data return true;}bool XObjectComparator::isEquivalent(IC_KeyRef* const lValue , IC_KeyRef* const rValue){ IS_EQUIVALENT(lValue, rValue) if (!isBaseEquivalent(lValue, rValue)) return false; return isEquivalent(lValue->fKey, rValue->fKey);}bool XObjectComparator::isEquivalent(IC_Unique* const lValue , IC_Unique* const rValue){ IS_EQUIVALENT(lValue, rValue) if (!isBaseEquivalent(lValue, rValue)) return false; // no data return true;}/********************************************************** * XMLNumber * XMLDouble * XMLFloat * XMLBigDecimal * XMLDateTime * ***********************************************************/ bool XObjectComparator::isEquivalent(XMLNumber* const lValue , XMLNumber* const rValue){ IS_EQUIVALENT(lValue, rValue) //to do, to introduce numberType later return true;}XERCES_CPP_NAMESPACE_END
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?