| 11025 | } |
| 11026 | |
| 11027 | std::string VulkanHppGenerator::generateStructHashSum( std::string const & structName, std::vector<MemberData> const & members ) const |
| 11028 | { |
| 11029 | std::string hashSum; |
| 11030 | for ( auto const & member : members ) |
| 11031 | { |
| 11032 | if ( member.deprecated.empty() ) |
| 11033 | { |
| 11034 | if ( !member.arraySizes.empty() ) |
| 11035 | { |
| 11036 | assert( member.arraySizes.size() < 3 ); |
| 11037 | hashSum += " for ( size_t i = 0; i < " + member.arraySizes[0] + "; ++i )\n"; |
| 11038 | hashSum += " {\n"; |
| 11039 | if ( member.arraySizes.size() == 1 ) |
| 11040 | { |
| 11041 | hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name + "[i] );\n"; |
| 11042 | } |
| 11043 | else |
| 11044 | { |
| 11045 | hashSum += " for ( size_t j=0; j < " + member.arraySizes[1] + "; ++j )\n"; |
| 11046 | hashSum += " {\n"; |
| 11047 | hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name + "[i][j] );\n"; |
| 11048 | hashSum += " }\n"; |
| 11049 | } |
| 11050 | hashSum += " }\n"; |
| 11051 | } |
| 11052 | else if ( member.type.name == "char" && !member.lenExpressions.empty() ) |
| 11053 | { |
| 11054 | assert( member.lenExpressions.size() < 3 ); |
| 11055 | if ( member.lenExpressions.size() == 1 ) |
| 11056 | { |
| 11057 | assert( member.lenExpressions[0] == "null-terminated" ); |
| 11058 | hashSum += " for ( char const * p = " + structName + "." + member.name + "; *p != '\\0'; ++p )\n"; |
| 11059 | hashSum += " {\n"; |
| 11060 | hashSum += " VULKAN_HPP_HASH_COMBINE( seed, *p );\n"; |
| 11061 | hashSum += " }\n"; |
| 11062 | } |
| 11063 | else |
| 11064 | { |
| 11065 | assert( member.lenExpressions[1] == "null-terminated" ); |
| 11066 | hashSum += " for ( size_t i = 0; i < " + structName + "." + member.lenExpressions[0] + "; ++i )\n"; |
| 11067 | hashSum += " {\n"; |
| 11068 | hashSum += " for ( char const * p = " + structName + "." + member.name + "[i]; *p != '\\0'; ++p )\n"; |
| 11069 | hashSum += " {\n"; |
| 11070 | hashSum += " VULKAN_HPP_HASH_COMBINE( seed, *p );\n"; |
| 11071 | hashSum += " }\n"; |
| 11072 | hashSum += " }\n"; |
| 11073 | } |
| 11074 | } |
| 11075 | else |
| 11076 | { |
| 11077 | hashSum += " VULKAN_HPP_HASH_COMBINE( seed, " + structName + "." + member.name + " );\n"; |
| 11078 | } |
| 11079 | } |
| 11080 | } |
| 11081 | assert( !hashSum.empty() ); |
| 11082 | return hashSum.substr( 0, hashSum.size() - 1 ); |
| 11083 | } |
| 11084 |
nothing calls this directly
no outgoing calls
no test coverage detected