| 160 | } |
| 161 | |
| 162 | TiXmlNode* TiXmlNode::LinkEndChild(TiXmlNode* node) |
| 163 | { |
| 164 | assert(node->parent == 0 || node->parent == this); |
| 165 | assert(node->GetDocument() == 0 || node->GetDocument() == this->GetDocument()); |
| 166 | |
| 167 | if (node->Type() == TiXmlNode::DOCUMENT) |
| 168 | { |
| 169 | xr_delete(node); |
| 170 | if (GetDocument()) |
| 171 | GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); |
| 172 | return 0; |
| 173 | } |
| 174 | |
| 175 | node->parent = this; |
| 176 | |
| 177 | node->prev = lastChild; |
| 178 | node->next = 0; |
| 179 | |
| 180 | if (lastChild) |
| 181 | lastChild->next = node; |
| 182 | else |
| 183 | firstChild = node; // it was an empty list. |
| 184 | |
| 185 | lastChild = node; |
| 186 | return node; |
| 187 | } |
| 188 | |
| 189 | TiXmlNode* TiXmlNode::InsertEndChild(const TiXmlNode& addThis) |
| 190 | { |
no test coverage detected