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

Function parseStruct

generator/VkXMLParser.cpp:1920–2026  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1918}
1919
1920std::pair<std::string, Struct>
1921 parseStruct( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes, std::string const & api )
1922{
1923 int const line = element->GetLineNum();
1924 checkAttributes( "vk.xml",
1925 line,
1926 attributes,
1927 { { "category", { "struct" } }, { "name", {} } },
1928 { { "allowduplicate", { "false", "true" } },
1929 { "comment", {} },
1930 { "requiredlimittype", { "true" } },
1931 { "returnedonly", { "true" } },
1932 { "structextends", {} } } );
1933 std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
1934 checkElements( "vk.xml", line, children, { { "member", MultipleAllowed::Yes } }, { { "comment", MultipleAllowed::Yes } } );
1935
1936 std::string name;
1937 Struct structure{ .xmlLine = line };
1938 for ( auto const & attribute : attributes )
1939 {
1940 if ( attribute.first == "allowduplicate" )
1941 {
1942 checkNoList( attribute.second, line );
1943 structure.allowDuplicate = attribute.second;
1944 }
1945 else if ( attribute.first == "name" )
1946 {
1947 checkNoList( attribute.second, line );
1948 name = attribute.second;
1949 }
1950 else if ( attribute.first == "requiredlimittype" )
1951 {
1952 checkNoList( attribute.second, line );
1953 structure.requiredLimitType = attribute.second;
1954 }
1955 else if ( attribute.first == "returnedonly" )
1956 {
1957 checkNoList( attribute.second, line );
1958 structure.returnedOnly = attribute.second;
1959 }
1960 else if ( attribute.first == "structextends" )
1961 {
1962 structure.structExtends = tokenize( attribute.second, "," );
1963 }
1964 }
1965 assert( !name.empty() );
1966
1967 for ( auto child : children )
1968 {
1969 std::string value = child->Value();
1970 if ( value == "member" )
1971 {
1972 StructMember member = parseStructMember( child );
1973
1974 // `VkDeviceCreateInfo::ppEnabledLayerNames` needs to be special-cased with old attributes to maintain API compatibility
1975 // See https://github.com/KhronosGroup/Vulkan-Hpp/issues/2531
1976 if ( ( name == "VkDeviceCreateInfo" ) && ( member.name == "ppEnabledLayerNames" ) )
1977 {

Callers 1

parseTypesTypeFunction · 0.85

Calls 8

checkAttributesFunction · 0.85
getChildElementsFunction · 0.85
checkElementsFunction · 0.85
checkNoListFunction · 0.85
tokenizeFunction · 0.85
parseStructMemberFunction · 0.85
checkForErrorFunction · 0.85
containsByNameFunction · 0.85

Tested by

no test coverage detected