From 64f5bbf55c07976e7292c6b5742bdd07b5bc8b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Thu, 17 Oct 2024 08:19:47 +0200 Subject: [PATCH] Allow the 's "name" to be a list of members (#1973) --- VulkanHppGenerator.cpp | 22 +++++++++++++--------- VulkanHppGenerator.hpp | 6 +++--- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 067eea251..850ba27c2 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -14792,12 +14792,13 @@ VulkanHppGenerator::RequireFeature VulkanHppGenerator::readRequireFeature( tinyx checkAttributes( line, attributes, { { "name", {} }, { "struct", {} } }, {} ); checkElements( line, getChildElements( element ), {} ); - std::string name, structure; + std::vector 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 }; } diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index 08f9faf2a..0951926ca 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -242,9 +242,9 @@ class VulkanHppGenerator struct RequireFeature { - std::string name = {}; - std::string structure = {}; - int xmlLine = {}; + std::vector name = {}; + std::string structure = {}; + int xmlLine = {}; }; struct RemoveData