------------------------------------------------------------------------------
| 125 | |
| 126 | //------------------------------------------------------------------------------ |
| 127 | void vtkXMLDataElement::SetName(const char* _arg) |
| 128 | { |
| 129 | vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Name to " |
| 130 | << (_arg ? _arg : "(null)")); |
| 131 | |
| 132 | if (this->Name == nullptr && _arg == nullptr) |
| 133 | { |
| 134 | return; |
| 135 | } |
| 136 | if (this->Name && _arg && (!strcmp(this->Name, _arg))) |
| 137 | { |
| 138 | return; |
| 139 | } |
| 140 | delete[] this->Name; |
| 141 | this->IgnoreCharacterData = 0; |
| 142 | if (_arg) |
| 143 | { |
| 144 | // NOTE: Tags that have specialized character data |
| 145 | // handlers can set this flag to improve performance. |
| 146 | if (strstr(_arg, "DataArray")) |
| 147 | { |
| 148 | this->IgnoreCharacterData = 1; |
| 149 | } |
| 150 | size_t n = strlen(_arg) + 1; |
| 151 | char* cp1 = new char[n]; |
| 152 | const char* cp2 = (_arg); |
| 153 | this->Name = cp1; |
| 154 | do |
| 155 | { |
| 156 | *cp1++ = *cp2++; |
| 157 | } while (--n); |
| 158 | } |
| 159 | else |
| 160 | { |
| 161 | this->Name = nullptr; |
| 162 | } |
| 163 | this->Modified(); |
| 164 | } |
| 165 | |
| 166 | //------------------------------------------------------------------------------ |
| 167 | void vtkXMLDataElement::SetCharacterData(const char* data, int length) |