| 136 | } |
| 137 | |
| 138 | void SettingsManager::mergeNodes(pugi::xml_node _nodeTarget, pugi::xml_node _nodeSource) |
| 139 | { |
| 140 | bool listElement = MyGUI::utility::endWith(_nodeTarget.name(), ".List"); |
| 141 | |
| 142 | // затираем текст у цели потому что любое значение текста источника является конечным |
| 143 | pugi::xml_node targetTextNode = _nodeTarget.first_child(); |
| 144 | if (!targetTextNode.empty() && targetTextNode.type() == pugi::node_pcdata) |
| 145 | targetTextNode.set_value(""); |
| 146 | |
| 147 | pugi::xml_node sourceTextNode = _nodeSource.first_child(); |
| 148 | if (!sourceTextNode.empty() && sourceTextNode.type() == pugi::node_pcdata) |
| 149 | { |
| 150 | targetTextNode = _nodeTarget.first_child(); |
| 151 | if (targetTextNode.empty()) |
| 152 | targetTextNode = _nodeTarget.append_child(pugi::node_pcdata); |
| 153 | targetTextNode.set_value(sourceTextNode.value()); |
| 154 | } |
| 155 | |
| 156 | for (auto& child : _nodeSource) |
| 157 | { |
| 158 | if (child.type() != pugi::node_element) |
| 159 | continue; |
| 160 | |
| 161 | pugi::xml_node targetChildNode; |
| 162 | |
| 163 | if (listElement) |
| 164 | { |
| 165 | targetChildNode = _nodeTarget.append_child(child.name()); |
| 166 | } |
| 167 | else |
| 168 | { |
| 169 | targetChildNode = _nodeTarget.child(child.name()); |
| 170 | if (targetChildNode.empty()) |
| 171 | targetChildNode = _nodeTarget.append_child(child.name()); |
| 172 | } |
| 173 | |
| 174 | mergeAttributes(targetChildNode, child); |
| 175 | mergeNodes(targetChildNode, child); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | void SettingsManager::mergeAttributes(pugi::xml_node _nodeTarget, pugi::xml_node _nodeSource) |
| 180 | { |
nothing calls this directly
no test coverage detected