MCPcopy Create free account
hub / github.com/MyGUI/mygui / mergeNodes

Method mergeNodes

Tools/EditorFramework/SettingsManager.cpp:138–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 9

endWithFunction · 0.50
nameMethod · 0.45
first_childMethod · 0.45
emptyMethod · 0.45
typeMethod · 0.45
set_valueMethod · 0.45
append_childMethod · 0.45
valueMethod · 0.45
childMethod · 0.45

Tested by

no test coverage detected