mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
issue #25: Change error checking asserts to std::runtime_error exceptions for invalid enums tags. (#26)
This commit is contained in:
parent
f1ade1b3ed
commit
33071cd7a3
@ -1075,7 +1075,11 @@ void readComment(tinyxml2::XMLElement * element, std::string & header)
|
|||||||
|
|
||||||
void readEnums( tinyxml2::XMLElement * element, VkData & vkData )
|
void readEnums( tinyxml2::XMLElement * element, VkData & vkData )
|
||||||
{
|
{
|
||||||
assert( element->Attribute( "name" ) );
|
if (!element->Attribute("name"))
|
||||||
|
{
|
||||||
|
throw std::runtime_error(std::string("spec error: enums element is missing the name attribute"));
|
||||||
|
}
|
||||||
|
|
||||||
std::string name = getEnumName(element->Attribute("name"));
|
std::string name = getEnumName(element->Attribute("name"));
|
||||||
if ( name != "API Constants" )
|
if ( name != "API Constants" )
|
||||||
{
|
{
|
||||||
@ -1090,9 +1094,18 @@ void readEnums( tinyxml2::XMLElement * element, VkData & vkData )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(element->Attribute("type"));
|
if (!element->Attribute("type"))
|
||||||
|
{
|
||||||
|
throw std::runtime_error(std::string("spec error: enums name=\"" + name + "\" is missing the type attribute"));
|
||||||
|
}
|
||||||
|
|
||||||
std::string type = element->Attribute("type");
|
std::string type = element->Attribute("type");
|
||||||
assert((type == "bitmask") || (type == "enum"));
|
|
||||||
|
if (type != "bitmask" && type != "enum")
|
||||||
|
{
|
||||||
|
throw std::runtime_error(std::string("spec error: enums name=\"" + name + "\" has unknown type " + type));
|
||||||
|
}
|
||||||
|
|
||||||
it->second.bitmask = (type == "bitmask");
|
it->second.bitmask = (type == "bitmask");
|
||||||
std::string prefix, postfix;
|
std::string prefix, postfix;
|
||||||
if (it->second.bitmask)
|
if (it->second.bitmask)
|
||||||
|
Loading…
Reference in New Issue
Block a user