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

Method generateStructure

generator/VulkanHppGenerator.cpp:11108–11291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11106}
11107
11108std::string VulkanHppGenerator::generateStructure( std::pair<std::string, StructData> const & structure ) const
11109{
11110 auto const [enter, leave] = generateProtection( getProtectFromType( structure.first ) );
11111
11112 std::string str = "\n" + enter;
11113
11114 std::string constructorsAndSetters;
11115 static std::string const constructorsTemplate = R"(
11116#if !defined( VULKAN_HPP_NO_CONSTRUCTORS ) && !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
11117${pushIgnored}${constructors}
11118${subConstructors}
11119${deprecatedConstructors}
11120 ${structName} & operator=( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT = default;${popIgnored}
11121#endif /*VULKAN_HPP_NO_CONSTRUCTORS*/
11122
11123 ${structName} & operator=( Vk${structName} const & rhs ) VULKAN_HPP_NOEXCEPT
11124 {
11125 ${castAssignments}
11126 return *this;
11127 }
11128)";
11129
11130 std::string pushIgnored, popIgnored;
11131 if ( containsDeprecated( structure.second.members ) )
11132 {
11133 pushIgnored = R"(
11134#if defined( _MSC_VER )
11135# pragma warning( push )
11136# pragma warning( disable : 4996 ) // 'function': was declared deprecated
11137#elif defined( __clang__ )
11138# pragma clang diagnostic push
11139# pragma clang diagnostic ignored "-Wdeprecated-declarations"
11140#elif defined( __GNUC__ )
11141# pragma GCC diagnostic push
11142# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
11143#else
11144// unknown compiler... just ignore the warnings for yourselves ;)
11145#endif
11146
11147)";
11148 popIgnored = R"(
11149
11150#if defined( _MSC_VER )
11151# pragma warning( pop )
11152#elif defined( __clang__ )
11153# pragma clang diagnostic pop
11154#elif defined( __GNUC__ )
11155# pragma GCC diagnostic pop
11156#else
11157// unknown compiler... just ignore the warnings for yourselves ;)
11158#endif
11159)";
11160 }
11161
11162 constructorsAndSetters = replaceWithMap( constructorsTemplate,
11163 { { "castAssignments", generateStructCastAssignments( structure ) },
11164 { "constructors", generateStructConstructors( structure ) },
11165 { "deprecatedConstructors", generateDeprecatedConstructors( structure.first ) },

Callers

nothing calls this directly

Calls 2

replaceWithMapFunction · 0.85
stripPrefixFunction · 0.85

Tested by

no test coverage detected