mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Add support of struct member attribute <values> to specify a default.
This commit is contained in:
parent
ad7cbb2c77
commit
6bcd2759b0
@ -3770,6 +3770,10 @@ bool VulkanHppGenerator::appendStructConstructorArgument( std::string & str
|
||||
{
|
||||
appendEnumInitializer( str, memberData.type, memberData.arraySizes, enumIt->second.values );
|
||||
}
|
||||
else if ( !memberData.values.empty() )
|
||||
{
|
||||
str += memberData.values;
|
||||
}
|
||||
else
|
||||
{
|
||||
// all the rest can be initialized with just {}
|
||||
@ -3850,6 +3854,10 @@ std::string VulkanHppGenerator::appendStructMembers( std::string &
|
||||
{
|
||||
appendEnumInitializer( str, member.type, member.arraySizes, enumIt->second.values );
|
||||
}
|
||||
else if ( !member.values.empty() )
|
||||
{
|
||||
str += member.values;
|
||||
}
|
||||
else
|
||||
{
|
||||
str += "{}";
|
||||
@ -4508,9 +4516,8 @@ void VulkanHppGenerator::checkCorrectness()
|
||||
member.xmlLine,
|
||||
"struct member array size uses unknown constant <" + member.usedConstant + ">" );
|
||||
}
|
||||
if ( !member.values.empty() )
|
||||
if ( !member.values.empty() && ( member.name == "sType" ) )
|
||||
{
|
||||
assert( member.name == "sType" );
|
||||
check( std::find_if( structureTypeIt->second.values.begin(),
|
||||
structureTypeIt->second.values.end(),
|
||||
[&member]( auto const & evd ) { return member.values == evd.vulkanValue; } ) !=
|
||||
@ -6780,12 +6787,15 @@ void VulkanHppGenerator::readStructMember( tinyxml2::XMLElement const * element,
|
||||
}
|
||||
else if ( attribute.first == "values" )
|
||||
{
|
||||
check( memberData.name == "sType",
|
||||
check( tokenize( attribute.second, "," ).size() == 1,
|
||||
line,
|
||||
"Structure member named differently than <sType> with attribute <values> encountered: " );
|
||||
"struct member <" + memberData.name + "> holds mulitple values <" + attribute.second + ">" );
|
||||
if ( memberData.name == "sType" )
|
||||
{
|
||||
check( m_sTypeValues.insert( attribute.second ).second,
|
||||
line,
|
||||
"<" + attribute.second + "> already encountered as values for the sType member of a struct" );
|
||||
}
|
||||
memberData.values = attribute.second;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user