MCPcopy Create free account
hub / github.com/Kitware/VTK / IsEqualTo

Method IsEqualTo

Common/DataModel/vtkXMLDataElement.cxx:1020–1066  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1018
1019//------------------------------------------------------------------------------
1020int vtkXMLDataElement::IsEqualTo(vtkXMLDataElement* elem)
1021{
1022 if (this == elem)
1023 {
1024 return 1;
1025 }
1026
1027 if (!elem)
1028 {
1029 return 0;
1030 }
1031
1032 if (this->GetNumberOfAttributes() != elem->GetNumberOfAttributes() ||
1033 this->GetNumberOfNestedElements() != elem->GetNumberOfNestedElements() ||
1034 (this->GetName() != elem->GetName() &&
1035 (!this->GetName() || !elem->GetName() || strcmp(this->GetName(), elem->GetName()) != 0)) ||
1036 (this->GetCharacterData() != elem->GetCharacterData() &&
1037 (!this->GetCharacterData() || !elem->GetCharacterData() ||
1038 strcmp(this->GetCharacterData(), elem->GetCharacterData()) != 0)))
1039 {
1040 return 0;
1041 }
1042
1043 // Compare attributes
1044
1045 int i;
1046 for (i = 0; i < this->GetNumberOfAttributes(); ++i)
1047 {
1048 const char* value = elem->GetAttribute(this->AttributeNames[i]);
1049 if (!value || strcmp(value, this->AttributeValues[i]) != 0)
1050 {
1051 return 0;
1052 }
1053 }
1054
1055 // Compare nested elements
1056
1057 for (i = 0; i < this->GetNumberOfNestedElements(); ++i)
1058 {
1059 if (!this->GetNestedElement(i)->IsEqualTo(elem->GetNestedElement(i)))
1060 {
1061 return 0;
1062 }
1063 }
1064
1065 return 1;
1066}
1067
1068//------------------------------------------------------------------------------
1069void vtkXMLDataElement::DeepCopy(vtkXMLDataElement* elem)

Calls 5

GetNestedElementMethod · 0.95
GetNumberOfAttributesMethod · 0.45
GetNameMethod · 0.45
GetAttributeMethod · 0.45

Tested by

no test coverage detected