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

Method setValueImpl

Tools/EditorFramework/SettingsManager.cpp:87–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85 }
86
87 void SettingsManager::setValueImpl(std::string_view _path, CString _value)
88 {
89 const char* path = _path.empty() ? "" : _path.data();
90 pugi::xpath_node node = mUserDocument->document_element().select_single_node(path);
91 if (!node.node().empty())
92 {
93 node.node().text().set(_value.c_str());
94 }
95 else
96 {
97 std::vector<std::string> names;
98 names = MyGUI::utility::split(_path, "/");
99
100 pugi::xml_node currentNode = mUserDocument->document_element();
101 for (const auto& name : names)
102 {
103 pugi::xml_node childNode = currentNode.child(name.data());
104 if (childNode.empty())
105 childNode = currentNode.append_child(name.data());
106
107 currentNode = childNode;
108 }
109
110 currentNode.text().set(_value.c_str());
111 }
112
113 eventSettingsChanged(_path);
114 }
115
116 SettingsManager::VectorString SettingsManager::getValueList(std::string_view _path)
117 {

Callers

nothing calls this directly

Calls 11

splitFunction · 0.85
emptyMethod · 0.45
dataMethod · 0.45
select_single_nodeMethod · 0.45
document_elementMethod · 0.45
nodeMethod · 0.45
setMethod · 0.45
textMethod · 0.45
c_strMethod · 0.45
childMethod · 0.45
append_childMethod · 0.45

Tested by

no test coverage detected