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

Method load

Tools/LayoutEditor/EditorWidgets.cpp:52–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 }
51
52 bool EditorWidgets::load(const MyGUI::UString& _fileName)
53 {
54 size_t index = _fileName.find("|");
55 if (index != MyGUI::UString::npos)
56 {
57 MyGUI::UString fileName = _fileName.substr(0, index);
58 MyGUI::UString itemIndex = _fileName.substr(index + 1);
59
60 return loadFromProject(fileName, MyGUI::utility::parseValue<size_t>(itemIndex));
61 }
62
63 mCurrentFileName = _fileName;
64 mCurrentItemName.clear();
65
66 MyGUI::xml::Document doc;
67 if (!doc.open(_fileName))
68 {
69 MYGUI_LOGGING(LogSection, Error, getClassTypeName() << " : " << doc.getLastError());
70 return false;
71 }
72
73 MyGUI::xml::ElementPtr root = doc.getRoot();
74 if ((nullptr == root) || (root->getName() != "MyGUI"))
75 {
76 MYGUI_LOGGING(LogSection, Error, getClassTypeName() << " : '" << _fileName << "', tag 'MyGUI' not found");
77 return false;
78 }
79
80 if (root->findAttribute("type") == "Layout")
81 {
82 loadWidgetsFromXmlNode(root);
83 }
84 else
85 {
86 return false;
87 }
88
89 mWidgetsChanged = true;
90 return true;
91 }
92
93 bool EditorWidgets::loadFromProject(const MyGUI::UString& _fileName, size_t _index)
94 {

Callers

nothing calls this directly

Calls 8

getClassTypeNameFunction · 0.85
substrMethod · 0.80
getLastErrorMethod · 0.80
findAttributeMethod · 0.80
findMethod · 0.45
clearMethod · 0.45
openMethod · 0.45
getRootMethod · 0.45

Tested by

no test coverage detected