MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Hpp / parseCommand

Function parseCommand

generator/VkXMLParser.cpp:218–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218void parseCommand( tinyxml2::XMLElement const * element, std::vector<Command> & commands )
219{
220 int const line = element->GetLineNum();
221 std::map<std::string, std::string> attributes = getAttributes( element );
222
223 if ( attributes.contains( "alias" ) )
224 {
225 checkAttributes( "vk.xml", line, attributes, { { "alias", {} }, { "name", {} } }, {} );
226 checkElements( "vk.xml", line, getChildElements( element ), {} );
227
228 std::string alias, name;
229 for ( auto const & attribute : attributes )
230 {
231 if ( attribute.first == "alias" )
232 {
233 checkNoList( attribute.second, line );
234 alias = attribute.second;
235 }
236 else if ( attribute.first == "name" )
237 {
238 checkNoList( attribute.second, line );
239 name = attribute.second;
240 }
241 }
242
243 auto commandIt = findByName( commands, alias );
244 checkForError( "vk.xml", commandIt != commands.end(), line, "command <" + name + "> is aliased to unknown command <" + alias + ">" );
245 checkForError( "vk.xml",
246 std::find_if( std::next( commandIt ), commands.end(), [&alias]( Command const & c ) { return c.name == alias; } ) == commands.end(),
247 line,
248 "command <" + name + "> is aliased to multiply specfied command <" + alias + ">" );
249 checkForError(
250 "vk.xml", commandIt->aliases.insert( { name, line } ).second, line, "command <" + name + "> is already listed as alias for command <" + alias + ">" );
251 }
252 else
253 {
254 checkAttributes( "vk.xml",
255 line,
256 attributes,
257 {},
258 { { "allownoqueues", { "true" } },
259 { "api", { "vulkan", "vulkanbase", "vulkansc" } },
260 { "cmdbufferlevel", { "primary", "secondary" } },
261 { "comment", {} },
262 { "conditionalrendering", { "false", "true" } },
263 { "errorcodes", {} },
264 { "export", { "vulkan", "vulkansc" } },
265 { "queues", {} },
266 { "renderpass", { "both", "inside", "outside" } },
267 { "successcodes", {} },
268 { "tasks", { "action", "indirection", "state", "synchronization" } },
269 { "videocoding", { "both", "inside", "outside" } } } );
270
271 std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
272 checkElements( "vk.xml",
273 line,
274 children,
275 { { "param", MultipleAllowed::Yes }, { "proto", MultipleAllowed::No } },

Callers 1

parseCommandsFunction · 0.85

Calls 13

getAttributesFunction · 0.85
checkAttributesFunction · 0.85
checkElementsFunction · 0.85
getChildElementsFunction · 0.85
checkNoListFunction · 0.85
findByNameFunction · 0.85
checkForErrorFunction · 0.85
tokenizeFunction · 0.85
parseParamFunction · 0.85
containsByNameFunction · 0.85
parseProtoFunction · 0.85

Tested by

no test coverage detected