Introduce missing non-const cast-operator on structs and unions. (#250)

This commit is contained in:
Andreas Süßenbach 2018-09-18 15:03:17 +02:00 committed by Markus Tavenrath
parent e48f8f99a3
commit 77ff84f711
2 changed files with 2072 additions and 347 deletions

View File

@ -4710,11 +4710,16 @@ void VulkanHppGenerator::writeTypeStruct(std::ostream & os, DependencyData const
} }
} }
// the cast-operator to the wrapped struct // the implicit cast-operators to the native type
os << " operator const Vk" << dependencyData.name << "&() const" << std::endl os << " operator Vk" << dependencyData.name << " const&() const" << std::endl
<< " {" << std::endl << " {" << std::endl
<< " return *reinterpret_cast<const Vk" << dependencyData.name << "*>(this);" << std::endl << " return *reinterpret_cast<const Vk" << dependencyData.name << "*>(this);" << std::endl
<< " }" << std::endl << " }" << std::endl
<< std::endl
<< " operator Vk" << dependencyData.name << " &()" << std::endl
<< " {" << std::endl
<< " return *reinterpret_cast<Vk" << dependencyData.name << "*>(this);" << std::endl
<< " }" << std::endl
<< std::endl; << std::endl;
// operator==() and operator!=() // operator==() and operator!=()
@ -4879,11 +4884,16 @@ void VulkanHppGenerator::writeTypeUnion(std::ostream & os, DependencyData const&
writeStructSetter(os, dependencyData.name, it->second.members[i]); writeStructSetter(os, dependencyData.name, it->second.members[i]);
} }
// the implicit cast operator to the native type // the implicit cast operators to the native type
os << " operator Vk" << dependencyData.name << " const& () const" << std::endl os << " operator Vk" << dependencyData.name << " const&() const" << std::endl
<< " {" << std::endl << " {" << std::endl
<< " return *reinterpret_cast<const Vk" << dependencyData.name << "*>(this);" << std::endl << " return *reinterpret_cast<const Vk" << dependencyData.name << "*>(this);" << std::endl
<< " }" << std::endl << " }" << std::endl
<< std::endl
<< " operator Vk" << dependencyData.name << " &()" << std::endl
<< " {" << std::endl
<< " return *reinterpret_cast<Vk" << dependencyData.name << "*>(this);" << std::endl
<< " }" << std::endl
<< std::endl; << std::endl;
// the union member variables // the union member variables

File diff suppressed because it is too large Load Diff