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

Method DeepCopy

Common/DataModel/vtkXMLDataElement.cxx:1069–1106  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1067
1068//------------------------------------------------------------------------------
1069void vtkXMLDataElement::DeepCopy(vtkXMLDataElement* elem)
1070{
1071 if (!elem)
1072 {
1073 return;
1074 }
1075
1076 this->SetName(elem->GetName());
1077 this->SetId(elem->GetId());
1078 this->SetXMLByteIndex(elem->GetXMLByteIndex());
1079 this->SetAttributeEncoding(elem->GetAttributeEncoding()); ///
1080 const char* elem_cdata = elem->GetCharacterData();
1081 this->SetCharacterData(elem_cdata, elem_cdata ? static_cast<int>(strlen(elem_cdata)) : 0);
1082 this->SetCharacterDataWidth(elem->GetCharacterDataWidth());
1083
1084 // Copy attributes
1085
1086 this->RemoveAllAttributes();
1087
1088 int i;
1089 for (i = 0; i < elem->GetNumberOfAttributes(); ++i)
1090 {
1091 const char* att_name = elem->GetAttributeName(i);
1092 this->SetAttribute(att_name, elem->GetAttribute(att_name));
1093 }
1094
1095 // Copy nested elements
1096
1097 this->RemoveAllNestedElements();
1098
1099 for (i = 0; i < elem->GetNumberOfNestedElements(); ++i)
1100 {
1101 vtkXMLDataElement* nested_elem = vtkXMLDataElement::New();
1102 nested_elem->DeepCopy(elem->GetNestedElement(i));
1103 this->AddNestedElement(nested_elem);
1104 nested_elem->Delete();
1105 }
1106}
1107
1108//------------------------------------------------------------------------------
1109void vtkXMLDataElement::PrintSelf(ostream& os, vtkIndent indent)

Callers

nothing calls this directly

Calls 15

SetNameMethod · 0.95
SetCharacterDataMethod · 0.95
RemoveAllAttributesMethod · 0.95
SetAttributeMethod · 0.95
AddNestedElementMethod · 0.95
GetXMLByteIndexMethod · 0.80
GetNestedElementMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetNameMethod · 0.45

Tested by

no test coverage detected