Allow the <feature>'s "name" to be a list of members (#1973)

This commit is contained in:
Andreas Süßenbach 2024-10-17 08:19:47 +02:00 committed by GitHub
parent 8592ed9743
commit 64f5bbf55c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 12 deletions

View File

@ -14792,12 +14792,13 @@ VulkanHppGenerator::RequireFeature VulkanHppGenerator::readRequireFeature( tinyx
checkAttributes( line, attributes, { { "name", {} }, { "struct", {} } }, {} );
checkElements( line, getChildElements( element ), {} );
std::string name, structure;
std::vector<std::string> name;
std::string structure;
for ( auto const & attribute : attributes )
{
if ( attribute.first == "name" )
{
name = attribute.second;
name = tokenize( attribute.second, "," );
}
else if ( attribute.first == "struct" )
{
@ -14826,13 +14827,16 @@ VulkanHppGenerator::RequireFeature VulkanHppGenerator::readRequireFeature( tinyx
structIt = m_structs.find( aliasIt->second.name );
assert( structIt != m_structs.end() );
}
auto memberIt =
std::find_if( structIt->second.members.begin(), structIt->second.members.end(), [&name]( MemberData const & md ) { return md.name == name; } );
checkForError(
memberIt != structIt->second.members.end(), line, "required feature name <" + name + "> not part of the required feature struct <" + structure + ">" );
checkForError( ( memberIt->type.isValue() && ( memberIt->type.type == "VkBool32" ) ),
line,
"required feature name <" + name + "> is not a VkBool32 member of the required feature struct <" + structure + ">" );
for (auto const& n : name)
{
auto memberIt =
std::find_if( structIt->second.members.begin(), structIt->second.members.end(), [&n]( MemberData const & md ) { return md.name == n; } );
checkForError(
memberIt != structIt->second.members.end(), line, "required feature name <" + n + "> not part of the required feature struct <" + structure + ">" );
checkForError( ( memberIt->type.isValue() && ( memberIt->type.type == "VkBool32" ) ),
line,
"required feature name <" + n + "> is not a VkBool32 member of the required feature struct <" + structure + ">" );
}
return { name, structure, line };
}

View File

@ -242,9 +242,9 @@ private:
struct RequireFeature
{
std::string name = {};
std::string structure = {};
int xmlLine = {};
std::vector<std::string> name = {};
std::string structure = {};
int xmlLine = {};
};
struct RemoveData