MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / parseIncludes

Method parseIncludes

src/server/gui/core/ThemeData.cpp:285–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285void ThemeData::parseIncludes(const pugi::xml_node& root)
286{
287 ThemeException error;
288 error.setFiles(mPaths);
289
290 for(pugi::xml_node node = root.child("include"); node; node = node.next_sibling("include"))
291 {
292 std::string relPath = resolvePlaceholders(node.text().as_string());
293 std::string path = Utils::FileSystem::resolveRelativePath(relPath, mPaths.back(), true);
294 if(!ResourceManager::getInstance()->fileExists(path))
295 throw error << "Included file \"" << relPath << "\" not found! (resolved to \"" << path << "\")";
296
297 error << " from included file \"" << relPath << "\":\n ";
298
299 mPaths.push_back(path);
300
301 LOG(LogInfo) << "Parsing include file: " << path;
302
303 pugi::xml_document includeDoc;
304 pugi::xml_parse_result result = includeDoc.load_file(path.c_str());
305 if(!result)
306 throw error << "Error parsing file: \n " << result.description();
307
308 pugi::xml_node theme = includeDoc.child("theme");
309 if(!theme)
310 throw error << "Missing <theme> tag!";
311
312 parseVariables(theme);
313 parseIncludes(theme);
314 parseViews(theme);
315 parseFeatures(theme);
316
317 mPaths.pop_back();
318 }
319}
320
321void ThemeData::parseFeatures(const pugi::xml_node& root)
322{

Callers

nothing calls this directly

Calls 11

resolveRelativePathFunction · 0.85
setFilesMethod · 0.80
childMethod · 0.80
next_siblingMethod · 0.80
as_stringMethod · 0.80
textMethod · 0.80
fileExistsMethod · 0.80
push_backMethod · 0.80
load_fileMethod · 0.80
c_strMethod · 0.80
descriptionMethod · 0.80

Tested by

no test coverage detected