MCPcopy Create free account
hub / github.com/dfranx/SHADERed / LoadSnippets

Method LoadSnippets

src/SHADERed/UI/CodeEditorUI.cpp:589–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587 }
588
589 void CodeEditorUI::LoadSnippets()
590 {
591 Logger::Get().Log("Loading code snippets");
592
593 std::string snippetsFileLoc = Settings::Instance().ConvertPath("data/snippets.xml");
594
595 pugi::xml_document doc;
596 pugi::xml_parse_result result = doc.load_file(snippetsFileLoc.c_str());
597 if (!result)
598 return;
599
600 m_snippets.clear();
601
602 pugi::xml_node snippetsList = doc.child("snippets");
603 for (pugi::xml_node snippetNode : snippetsList.children("snippet")) {
604 CodeSnippet snippet;
605
606 snippet.Language = snippetNode.child("language").text().as_string();
607 snippet.Display = snippetNode.child("display").text().as_string();
608 snippet.Search = snippetNode.child("search").text().as_string();
609 snippet.Code = snippetNode.child("code").text().as_string();
610
611 m_snippets.push_back(snippet);
612 }
613 }
614 void CodeEditorUI::SaveSnippets()
615 {
616 pugi::xml_document doc;

Callers 1

GUIManagerMethod · 0.80

Calls 5

InstanceClass · 0.85
LogMethod · 0.80
ConvertPathMethod · 0.80
clearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected