MCPcopy Create free account
hub / github.com/comaps/comaps / GetPrioritizedTypes

Function GetPrioritizedTypes

libs/editor/editor_config.cpp:123–139  ·  view source on GitHub ↗

The priority is defined by elems order, except elements with priority="high".

Source from the content-addressed store, hash-verified

121
122/// The priority is defined by elems order, except elements with priority="high".
123std::vector<pugi::xml_node> GetPrioritizedTypes(pugi::xml_node const & node)
124{
125 std::vector<pugi::xml_node> result;
126 for (auto const & xNode : node.select_nodes("/comaps/editor/types/type[@id]"))
127 result.push_back(xNode.node());
128 stable_sort(begin(result), end(result), [](pugi::xml_node const & lhs, pugi::xml_node const & rhs)
129 {
130 auto const lhsWeight = kPriorityWeights.find(lhs.attribute("priority").value());
131 auto const rhsWeight = kPriorityWeights.find(rhs.attribute("priority").value());
132
133 CHECK(lhsWeight != kPriorityWeights.end(), (""));
134 CHECK(rhsWeight != kPriorityWeights.end(), (""));
135
136 return lhsWeight->second < rhsWeight->second;
137 });
138 return result;
139}
140} // namespace
141
142bool EditorConfig::GetTypeDescription(std::vector<std::string> classificatorTypes,

Callers 1

GetTypeDescriptionMethod · 0.85

Calls 6

beginFunction · 0.50
endFunction · 0.50
push_backMethod · 0.45
findMethod · 0.45
valueMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected