Introduce helper function toHexString used in to_string functions on invalid values.

This commit is contained in:
asuessenbach 2020-10-26 10:58:50 +01:00
parent 65b7cdd5e3
commit 244a096d77
2 changed files with 186 additions and 167 deletions

View File

@ -2196,6 +2196,16 @@ void VulkanHppGenerator::appendEnum( std::string & str, std::pair<std::string, E
void VulkanHppGenerator::appendEnums( std::string & str ) const
{
// start with toHexString, which is used in all the to_string functions here!
str += R"(
VULKAN_HPP_INLINE std::string toHexString( uint32_t value )
{
std::stringstream stream;
stream << std::hex << value;
return stream.str();
}
)";
for ( auto const & e : m_enums )
{
std::string enter, leave;
@ -2271,7 +2281,7 @@ void VulkanHppGenerator::appendEnumToString( std::string &
str += " case " + enumName + "::" + value.vkValue + " : return \"" + value.vkValue.substr( 1 ) + "\";\n";
}
str +=
" default: return \"invalid\";\n"
" default: return \"invalid ( \" + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + \" )\";\n"
" }\n";
}
@ -10741,6 +10751,7 @@ int main( int argc, char ** argv )
#include <cstring>
#include <functional>
#include <initializer_list>
#include <sstream>
#include <string>
#include <system_error>
#include <tuple>

File diff suppressed because it is too large Load Diff