Added support of Attribute "bitpos" for extends of an enum; made generator survive an "usage" element in an extension.

This commit is contained in:
Andreas Süßenbach 2016-03-30 17:41:29 +02:00
parent 6163c6e8ca
commit 30ad5085ef

View File

@ -958,10 +958,10 @@ void readExtensionRequire(tinyxml2::XMLElement * element, VkData & vkData, std::
do
{
std::string value = child->Value();
assert( child->Attribute( "name" ) );
if ( value == "command" )
{
assert(child->Attribute("name"));
std::string name = stripCommand(child->Attribute("name"));
std::map<std::string, CommandData>::iterator cit = vkData.commands.find(name);
assert(cit != vkData.commands.end());
@ -969,6 +969,7 @@ void readExtensionRequire(tinyxml2::XMLElement * element, VkData & vkData, std::
}
else if (value == "type")
{
assert(child->Attribute("name"));
std::string name = strip(child->Attribute("name"), "Vk");
std::map<std::string, EnumData>::iterator eit = vkData.enums.find(name);
if (eit != vkData.enums.end())
@ -1012,14 +1013,15 @@ void readExtensionRequire(tinyxml2::XMLElement * element, VkData & vkData, std::
// TODO process enums which don't extend existing enums
if (child->Attribute("extends"))
{
assert(child->Attribute("name"));
assert(vkData.enums.find(getEnumName(child->Attribute("extends"))) != vkData.enums.end());
assert(!!child->Attribute("offset") ^ !!child->Attribute("value")); // either offset or value has to be defined; no both of them!
assert(!!child->Attribute("bitpos") + !!child->Attribute("offset") + !!child->Attribute("value") == 1);
vkData.enums[getEnumName(child->Attribute("extends"))].addEnum(child->Attribute("name"), child->Attribute("offset") ? tag : "" );
}
}
else
{
assert("unknown attribute, check me");
assert(value=="usage");
}
} while ( child = child->NextSiblingElement() );
}