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

Function parseTypesType

generator/VkXMLParser.cpp:2710–2881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2708}
2709
2710void parseTypesType( tinyxml2::XMLElement const * element, Types & types, std::string const & api )
2711{
2712 int const line = element->GetLineNum();
2713 std::map<std::string, std::string> attributes = getAttributes( element );
2714
2715 auto categoryIt = attributes.find( "category" );
2716 if ( categoryIt != attributes.end() )
2717 {
2718 if ( categoryIt->second == "basetype" )
2719 {
2720 std::pair<std::string, BaseType> baseType = parseBaseType( element, attributes );
2721
2722 checkForError(
2723 "vk.xml", types.types.insert( baseType.first ).second, baseType.second.xmlLine, "base type <" + baseType.first + "> already specified as a type" );
2724 checkForError( "vk.xml", types.baseTypes.insert( baseType ).second, baseType.second.xmlLine, "basetype <" + baseType.first + "> already specified" );
2725 }
2726 else if ( categoryIt->second == "bitmask" )
2727 {
2728 if ( attributes.contains( "alias" ) )
2729 {
2730 CategoryAlias alias = parseCategoryAlias( element, attributes, "bitmask" );
2731
2732 checkForError( "vk.xml", types.types.insert( alias.name ).second, alias.xmlLine, "bitmask alias <" + alias.name + "> already specified as a type" );
2733 auto bitmaskIt = types.bitmasks.find( alias.alias );
2734 checkForError(
2735 "vk.xml", bitmaskIt != types.bitmasks.end(), alias.xmlLine, "bitmask <" + alias.name + "> is an alias of an unknown bitmask <" + alias.alias + ">." );
2736 checkForError( "vk.xml",
2737 bitmaskIt->second.aliases.insert( { alias.name, alias.xmlLine } ).second,
2738 alias.xmlLine,
2739 "bitmask alias <" + alias.name + "> is already listed as an alias for bitmask <" + alias.alias + ">" );
2740 }
2741 else
2742 {
2743 auto [bitmaskApi, bitmask] = parseBitmask( element, attributes );
2744
2745 if ( std::ranges::any_of( bitmaskApi, [&api]( auto const & a ) { return a == api; } ) )
2746 {
2747 checkForError(
2748 "vk.xml", types.types.insert( bitmask.first ).second, bitmask.second.xmlLine, "bitmask <" + bitmask.first + "> already specified as a type" );
2749 checkForError( "vk.xml", types.bitmasks.insert( bitmask ).second, bitmask.second.xmlLine, "bitmask <" + bitmask.first + "> already specified" );
2750 }
2751 }
2752 }
2753 else if ( categoryIt->second == "define" )
2754 {
2755 auto [defineApi, define] = parseDefine( element, attributes );
2756 if ( std::ranges::any_of( defineApi, [&api]( auto const & a ) { return a == api; } ) )
2757 {
2758 checkForError(
2759 "vk.xml", types.types.insert( define.first ).second, define.second.xmlLine, "define <" + define.first + "> already specified as a type" );
2760 checkForError( "vk.xml", types.defines.insert( define ).second, define.second.xmlLine, "define <" + define.first + "> already specified" );
2761 }
2762 }
2763 else if ( categoryIt->second == "enum" )
2764 {
2765 if ( attributes.contains( "alias" ) )
2766 {
2767 CategoryAlias alias = parseCategoryAlias( element, attributes, "enum" );

Callers 1

parseTypesFunction · 0.85

Calls 14

getAttributesFunction · 0.85
parseBaseTypeFunction · 0.85
checkForErrorFunction · 0.85
parseCategoryAliasFunction · 0.85
parseBitmaskFunction · 0.85
parseDefineFunction · 0.85
parseEnumFunction · 0.85
parseHandleFunction · 0.85
parseIncludeFunction · 0.85
parseFuncPointerFunction · 0.85
containsByNameFunction · 0.85
parseStructFunction · 0.85

Tested by

no test coverage detected