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

Method generateStructCastAssignments

generator/VulkanHppGenerator.cpp:10448–10482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10446}
10447
10448std::string VulkanHppGenerator::generateStructCastAssignments( std::pair<std::string, StructData> const & structData ) const
10449{
10450 std::string castAssignments;
10451 if ( containsDeprecated( structData.second.members ) )
10452 {
10453 for ( auto const & member : structData.second.members )
10454 {
10455 if ( member.deprecated.empty() && ( member.type.name != "VkStructureType" ) )
10456 {
10457 if ( member.type.name.starts_with( "Vk" ) )
10458 {
10459 if ( member.type.isValue() )
10460 {
10461 castAssignments += member.name + " = static_cast<" + stripPrefix( member.type.name, "Vk" ) + ">( rhs." + member.name + " );\n";
10462 }
10463 else
10464 {
10465 castAssignments += member.name + " = reinterpret_cast<" + member.type.compose( "Vk" ) + ">( rhs." + member.name + " );\n";
10466 }
10467 }
10468 else
10469 {
10470 castAssignments += member.name + " = rhs." + member.name + ";\n";
10471 }
10472 }
10473 }
10474 }
10475 else
10476 {
10477 castAssignments = "*this = *reinterpret_cast<" + stripPrefix( structData.first, "Vk" ) + " const *>( &rhs );\n";
10478 }
10479 assert( castAssignments.ends_with( "\n" ) );
10480 castAssignments.pop_back();
10481 return castAssignments;
10482}
10483
10484std::string VulkanHppGenerator::generateStructCompareOperators( std::pair<std::string, StructData> const & structData ) const
10485{

Callers

nothing calls this directly

Calls 3

stripPrefixFunction · 0.85
isValueMethod · 0.80
composeMethod · 0.80

Tested by

no test coverage detected