MCPcopy Create free account
hub / github.com/baldurk/renderdoc / XML2Config

Function XML2Config

renderdoc/core/settings.cpp:161–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161static SDObject *XML2Config(pugi::xml_node &obj)
162{
163 SDObject *ret =
164 new SDObject(rdcstr(obj.name()), obj.attribute("type") ? "setting"_lit : "category"_lit);
165
166 if(ret->type.name == "category"_lit)
167 {
168 uint32_t i = 0;
169 for(pugi::xml_node child = obj.first_child(); child; child = child.next_sibling())
170 {
171 if(child.type() == pugi::node_comment)
172 continue;
173
174 SDObject *childObj = XML2Config(child);
175 if(childObj)
176 {
177 ret->AddAndOwnChild(childObj);
178 }
179 else
180 {
181 RDCERR("Error converting child %u config option '%s'", i, ret->name.c_str());
182 delete ret;
183 return NULL;
184 }
185
186 i++;
187 }
188 }
189 else
190 {
191 pugi::xml_node value = obj.first_child();
192 rdcstr description = obj.previous_sibling().value();
193 description.trim();
194
195 ret->AddAndOwnChild(makeSDObject("description"_lit, description));
196
197 SDObject *valueObj = NULL;
198
199 SDBasic type = getType(obj.attribute("type").as_string());
200
201 if(type == SDBasic::Array)
202 {
203 type = getType(obj.attribute("elemtype").as_string());
204 valueObj = makeSDArray("value"_lit);
205
206 uint32_t i = 0;
207 for(pugi::xml_node el = value; el; el = el.next_sibling())
208 {
209 SDObject *childObj = makeSDObject("$el"_lit, type, el);
210
211 if(childObj)
212 {
213 valueObj->AddAndOwnChild(childObj);
214 }
215 else
216 {
217 RDCERR("Error converting array value %u in config option '%s'", i, ret->name.c_str());
218 delete valueObj;

Callers 1

importXMLConfigFunction · 0.85

Calls 14

rdcstrClass · 0.85
makeSDArrayFunction · 0.85
attributeMethod · 0.80
first_childMethod · 0.80
next_siblingMethod · 0.80
previous_siblingMethod · 0.80
as_stringMethod · 0.80
makeSDObjectFunction · 0.70
getTypeFunction · 0.70
nameMethod · 0.45
typeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected