mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Add constructors for readonly structures (#153)
This commit is contained in:
parent
509a3df5bb
commit
1a32a6c072
@ -3604,6 +3604,8 @@ void writeStructConstructor( std::ostream & os, std::string const& name, StructD
|
||||
// the constructor with all the elements as arguments, with defaults
|
||||
os << " " << name << "( ";
|
||||
bool listedArgument = false;
|
||||
if (!structData.returnedOnly)
|
||||
{
|
||||
for (size_t i = 0; i < structData.members.size(); i++)
|
||||
{
|
||||
if (listedArgument)
|
||||
@ -3640,6 +3642,7 @@ void writeStructConstructor( std::ostream & os, std::string const& name, StructD
|
||||
listedArgument = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
os << " )" << std::endl;
|
||||
|
||||
// copy over the simple arguments
|
||||
@ -3667,10 +3670,17 @@ void writeStructConstructor( std::ostream & os, std::string const& name, StructD
|
||||
value = nameIt->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!structData.returnedOnly)
|
||||
{
|
||||
// the other elements are initialized by the corresponding argument (with trailing '_', as mentioned above)
|
||||
value = structData.members[i].name + "_";
|
||||
}
|
||||
else
|
||||
{
|
||||
templateString = "";
|
||||
}
|
||||
}
|
||||
os << replaceWithMap(templateString, { {"sep", sep}, {"member", member}, {"value", value} });
|
||||
firstArgument = false;
|
||||
}
|
||||
@ -3678,6 +3688,8 @@ void writeStructConstructor( std::ostream & os, std::string const& name, StructD
|
||||
|
||||
// the body of the constructor, copying over data from argument list into wrapped struct
|
||||
os << " {" << std::endl;
|
||||
if (!structData.returnedOnly)
|
||||
{
|
||||
for (size_t i = 0; i < structData.members.size(); i++)
|
||||
{
|
||||
if (!structData.members[i].arraySize.empty())
|
||||
@ -3691,8 +3703,8 @@ void writeStructConstructor( std::ostream & os, std::string const& name, StructD
|
||||
{ {"member", member}, {"arraySize", arraySize }, {"type", type} });
|
||||
}
|
||||
}
|
||||
os << " }" << std::endl
|
||||
<< std::endl;
|
||||
}
|
||||
os << " }\n\n";
|
||||
|
||||
std::string templateString =
|
||||
R"( ${name}( Vk${name} const & rhs )
|
||||
@ -4344,11 +4356,7 @@ void writeTypeStruct( std::ostream & os, VkData const& vkData, DependencyData co
|
||||
os << " struct " << dependencyData.name << std::endl
|
||||
<< " {" << std::endl;
|
||||
|
||||
// only structs that are not returnedOnly get a constructor!
|
||||
if ( !it->second.returnedOnly )
|
||||
{
|
||||
writeStructConstructor( os, dependencyData.name, it->second, vkData.vkTypes, vkData.nameMap, defaultValues );
|
||||
}
|
||||
|
||||
// create the setters
|
||||
if (!it->second.returnedOnly)
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user