Adding ifdefs for NO_STRUCT_SETTERS

This commit is contained in:
Hannes Harnisch 2021-07-03 00:29:48 +02:00
parent a90db8ad9b
commit 9df9d582f5

View File

@ -9190,10 +9190,12 @@ void VulkanHppGenerator::appendStructure( std::string &
if ( !structure.second.returnedOnly )
{
// only structs that are not returnedOnly get setters!
constructorAndSetters += "\n#if !defined( VULKAN_HPP_NO_STRUCT_SETTERS )";
for ( size_t i = 0; i < structure.second.members.size(); i++ )
{
appendStructSetter( constructorAndSetters, stripPrefix( structure.first, "Vk" ), structure.second.members, i );
}
constructorAndSetters += "#endif /*VULKAN_HPP_NO_STRUCT_SETTERS*/\n";
}
// operator==() and operator!=()
@ -9427,8 +9429,8 @@ void VulkanHppGenerator::appendUnion( std::string & str, std::pair<std::string,
str += " union " + unionName +
"\n"
" {\n"
" " +
unionName + "( VULKAN_HPP_NAMESPACE::" + unionName +
"#if !defined( VULKAN_HPP_NO_UNION_CONSTRUCTORS )\n"
" " + unionName + "( VULKAN_HPP_NAMESPACE::" + unionName +
" const & rhs ) VULKAN_HPP_NOEXCEPT\n"
" {\n"
" memcpy( static_cast<void*>( this ), &rhs, sizeof( VULKAN_HPP_NAMESPACE::" +
@ -9470,12 +9472,15 @@ void VulkanHppGenerator::appendUnion( std::string & str, std::pair<std::string,
{ "unionName", stripPrefix( structure.first, "Vk" ) } } );
firstMember = false;
}
str += "#endif /*VULKAN_HPP_NO_UNION_CONSTRUCTORS*/\n";
str += "\n#if !defined( VULKAN_HPP_NO_UNION_SETTERS )";
// one setter per union element
for ( size_t i = 0; i < structure.second.members.size(); i++ )
{
appendStructSetter( str, stripPrefix( structure.first, "Vk" ), structure.second.members, i );
}
str += "#endif /*VULKAN_HPP_NO_UNION_SETTERS*/\n";
// assignment operator
static const std::string operatorsTemplate = R"(
@ -16279,6 +16284,24 @@ int main( int argc, char ** argv )
# include <vector>
#endif
#if defined( VULKAN_HPP_NO_CONSTRUCTORS )
# if !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
# define VULKAN_HPP_NO_STRUCT_CONSTRUCTORS
# endif
# if !defined( VULKAN_HPP_NO_UNION_CONSTRUCTORS )
# define VULKAN_HPP_NO_UNION_CONSTRUCTORS
# endif
#endif
#if defined( VULKAN_HPP_NO_SETTERS )
# if !defined( VULKAN_HPP_NO_STRUCT_SETTERS )
# define VULKAN_HPP_NO_STRUCT_SETTERS
# endif
# if !defined( VULKAN_HPP_NO_UNION_SETTERS )
# define VULKAN_HPP_NO_UNION_SETTERS
# endif
#endif
#if !defined( VULKAN_HPP_ASSERT )
# include <cassert>
# define VULKAN_HPP_ASSERT assert