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