| 744 | } |
| 745 | |
| 746 | Feature parseFeature( tinyxml2::XMLElement const * element ) |
| 747 | { |
| 748 | int const line = element->GetLineNum(); |
| 749 | std::map<std::string, std::string> attributes = getAttributes( element ); |
| 750 | checkAttributes( "vk.xml", |
| 751 | line, |
| 752 | attributes, |
| 753 | { { "api", { "vulkan", "vulkanbase", "vulkansc" } }, { "comment", {} }, { "name", {} }, { "number", {} } }, |
| 754 | { { "apitype", { "internal" } }, { "depends", {} } } ); |
| 755 | |
| 756 | std::vector<tinyxml2::XMLElement const *> children = getChildElements( element ); |
| 757 | checkElements( |
| 758 | "vk.xml", line, children, { { "require", MultipleAllowed::Yes } }, { { "deprecate", MultipleAllowed::Yes }, { "remove", MultipleAllowed::Yes } } ); |
| 759 | |
| 760 | Feature feature{ .xmlLine = line }; |
| 761 | for ( auto const & attribute : attributes ) |
| 762 | { |
| 763 | if ( attribute.first == "api" ) |
| 764 | { |
| 765 | feature.api = tokenize( attribute.second, "," ); |
| 766 | } |
| 767 | else if ( attribute.first == "apitype" ) |
| 768 | { |
| 769 | checkNoList( attribute.second, line ); |
| 770 | feature.apiType = attribute.second; |
| 771 | } |
| 772 | else if ( attribute.first == "comment" ) |
| 773 | { |
| 774 | feature.comment = attribute.second; |
| 775 | } |
| 776 | else if ( attribute.first == "depends" ) |
| 777 | { |
| 778 | feature.depends = tokenize( attribute.second, "," ); |
| 779 | } |
| 780 | else if ( attribute.first == "name" ) |
| 781 | { |
| 782 | checkNoList( attribute.second, line ); |
| 783 | feature.name = attribute.second; |
| 784 | } |
| 785 | else if ( attribute.first == "number " ) |
| 786 | { |
| 787 | checkNoList( attribute.second, line ); |
| 788 | checkForError( "vk.xml", |
| 789 | ( attribute.second.length() == 3 ) && std::isdigit( attribute.second[0] ) && ( attribute.second[1] == '.' ) && |
| 790 | std::isdigit( attribute.second[2] ), |
| 791 | line, |
| 792 | "feature <" + feature.name + "> has ill-formatted attribute number = \"" + attribute.second + "\"" ); |
| 793 | std::string nameEnd = attribute.second; |
| 794 | nameEnd[1] = '_'; |
| 795 | checkForError( |
| 796 | "vk.xml", feature.name.ends_with( nameEnd ), line, "feature <" + feature.name + "> does not end with the expected number <" + nameEnd + ">" ); |
| 797 | feature.number = attribute.second; |
| 798 | } |
| 799 | } |
| 800 | |
| 801 | for ( auto child : children ) |
| 802 | { |
| 803 | std::string value = child->Value(); |
no test coverage detected