| 10951 | } |
| 10952 | |
| 10953 | std::string VulkanHppGenerator::generateStructHashStructure( std::pair<std::string, StructData> const & structure, std::set<std::string> & listedStructs ) const |
| 10954 | { |
| 10955 | assert( !listedStructs.contains( structure.first ) ); |
| 10956 | |
| 10957 | std::string str; |
| 10958 | for ( auto const & member : structure.second.members ) |
| 10959 | { |
| 10960 | auto structIt = findByNameOrAlias( m_structs, member.type.name ); |
| 10961 | if ( ( structIt != m_structs.end() ) && ( structure.first != member.type.name ) && !listedStructs.contains( structIt->first ) ) |
| 10962 | { |
| 10963 | str += generateStructHashStructure( *structIt, listedStructs ); |
| 10964 | } |
| 10965 | } |
| 10966 | |
| 10967 | if ( !containsUnion( structure.first ) ) |
| 10968 | { |
| 10969 | static std::string const hashTemplate = R"( |
| 10970 | ${enter}template <> struct hash<VULKAN_HPP_NAMESPACE::${structureType}> |
| 10971 | { |
| 10972 | std::size_t operator()(VULKAN_HPP_NAMESPACE::${structureType} const & ${structureName}) const VULKAN_HPP_NOEXCEPT |
| 10973 | { |
| 10974 | std::size_t seed = 0; |
| 10975 | ${hashSum} |
| 10976 | return seed; |
| 10977 | } |
| 10978 | }; |
| 10979 | ${leave})"; |
| 10980 | |
| 10981 | auto [enter, leave] = generateProtection( getProtectFromType( structure.first ) ); |
| 10982 | |
| 10983 | std::string structureType = stripPrefix( structure.first, "Vk" ); |
| 10984 | std::string structureName = startLowerCase( structureType ); |
| 10985 | str += replaceWithMap( hashTemplate, |
| 10986 | { { "enter", enter }, |
| 10987 | { "hashSum", generateStructHashSum( structureName, structure.second.members ) }, |
| 10988 | { "leave", leave }, |
| 10989 | { "structureName", structureName }, |
| 10990 | { "structureType", structureType } } ); |
| 10991 | } |
| 10992 | |
| 10993 | listedStructs.insert( structure.first ); |
| 10994 | return str; |
| 10995 | } |
| 10996 | |
| 10997 | std::string VulkanHppGenerator::generateStructHashStructures() const |
| 10998 | { |
nothing calls this directly
no test coverage detected