| 35 | } |
| 36 | |
| 37 | WidgetInfo ResourceLayout::parseWidget(xml::ElementEnumerator& _widget) |
| 38 | { |
| 39 | WidgetInfo widgetInfo; |
| 40 | |
| 41 | std::string tmp; |
| 42 | |
| 43 | _widget->findAttribute("type", widgetInfo.type); |
| 44 | _widget->findAttribute("skin", widgetInfo.skin); |
| 45 | _widget->findAttribute("layer", widgetInfo.layer); |
| 46 | |
| 47 | if (_widget->findAttribute("align", tmp)) |
| 48 | widgetInfo.align = Align::parse(tmp); |
| 49 | |
| 50 | _widget->findAttribute("name", widgetInfo.name); |
| 51 | |
| 52 | if (_widget->findAttribute("style", tmp)) |
| 53 | widgetInfo.style = WidgetStyle::parse(tmp); |
| 54 | |
| 55 | if (_widget->findAttribute("position", tmp)) |
| 56 | { |
| 57 | widgetInfo.intCoord = IntCoord::parse(tmp); |
| 58 | widgetInfo.positionType = WidgetInfo::Pixels; |
| 59 | } |
| 60 | else if (_widget->findAttribute("position_real", tmp)) |
| 61 | { |
| 62 | widgetInfo.floatCoord = FloatCoord::parse(tmp); |
| 63 | widgetInfo.positionType = WidgetInfo::Relative; |
| 64 | } |
| 65 | |
| 66 | // берем детей и крутимся |
| 67 | xml::ElementEnumerator node = _widget->getElementEnumerator(); |
| 68 | while (node.next()) |
| 69 | { |
| 70 | if (node->getName() == "Widget") |
| 71 | { |
| 72 | widgetInfo.childWidgetsInfo.push_back(parseWidget(node)); |
| 73 | } |
| 74 | else if (node->getName() == "Property") |
| 75 | { |
| 76 | widgetInfo.properties.emplace_back(node->findAttribute("key"), node->findAttribute("value")); |
| 77 | } |
| 78 | else if (node->getName() == "UserString") |
| 79 | { |
| 80 | std::string_view key = node->findAttribute("key"); |
| 81 | std::string_view value = node->findAttribute("value"); |
| 82 | mapSet(widgetInfo.userStrings, key, value); |
| 83 | } |
| 84 | else if (node->getName() == "Controller") |
| 85 | { |
| 86 | ControllerInfo controllerInfo; |
| 87 | controllerInfo.type = node->findAttribute("type"); |
| 88 | |
| 89 | xml::ElementEnumerator prop = node->getElementEnumerator(); |
| 90 | while (prop.next("Property")) |
| 91 | { |
| 92 | std::string_view key = prop->findAttribute("key"); |
| 93 | std::string_view value = prop->findAttribute("value"); |
| 94 | mapSet(controllerInfo.properties, key, value); |
nothing calls this directly
no test coverage detected