mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2025-09-12 13:27:58 -04:00
Introduce helper function toHexString used in to_string functions on invalid values.
This commit is contained in:
parent
65b7cdd5e3
commit
244a096d77
@ -2196,6 +2196,16 @@ void VulkanHppGenerator::appendEnum( std::string & str, std::pair<std::string, E
|
|||||||
|
|
||||||
void VulkanHppGenerator::appendEnums( std::string & str ) const
|
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 )
|
for ( auto const & e : m_enums )
|
||||||
{
|
{
|
||||||
std::string enter, leave;
|
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 += " case " + enumName + "::" + value.vkValue + " : return \"" + value.vkValue.substr( 1 ) + "\";\n";
|
||||||
}
|
}
|
||||||
str +=
|
str +=
|
||||||
" default: return \"invalid\";\n"
|
" default: return \"invalid ( \" + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + \" )\";\n"
|
||||||
" }\n";
|
" }\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10741,6 +10751,7 @@ int main( int argc, char ** argv )
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user