MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Hpp / checkStructMemberValueIsValid

Method checkStructMemberValueIsValid

generator/VulkanHppGenerator.cpp:1322–1360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1320}
1321
1322void VulkanHppGenerator::checkStructMemberValueIsValid( std::string const & memberValue,
1323 std::string const & memberType,
1324 std::string const & memberName,
1325 int line,
1326 bool structUsed,
1327 std::string const & structureName,
1328 std::set<std::string> & sTypeValues ) const
1329{
1330 if ( !memberValue.empty() )
1331 {
1332 auto enumIt = m_enums.find( memberType );
1333 if ( enumIt != m_enums.end() )
1334 {
1335 // check that the value exists in the specified enum (if the struct is used at all)
1336 checkForError( !structUsed || containsByNameOrAlias( enumIt->second.values, memberValue ),
1337 line,
1338 "struct member <" + memberName + "> in structure <" + structureName + "> holds value <" + memberValue + "> of enum type <" + memberType +
1339 "> which is not listed" );
1340 // special handling for sType: no value should appear more than once
1341 checkForError(
1342 !structUsed || ( memberName != "sType" ) || sTypeValues.insert( memberValue ).second, line, "sType value <" + memberValue + "> has been used before" );
1343 }
1344 else if ( memberType == "uint32_t" )
1345 {
1346 checkForError( isNumber( memberValue ),
1347 line,
1348 "value <" + memberValue + "> for member <" + memberName + "> in structure <" + structureName + "> of type <" + memberType +
1349 "> is not a number" );
1350 }
1351 else
1352 {
1353 // don't know the type of the value -> error out
1354 checkForError( false,
1355 line,
1356 "member <" + memberName + "> in structure <" + structureName + "> holds value <" + memberValue + "> for an unhandled type <" + memberType +
1357 ">" );
1358 }
1359 }
1360}
1361
1362bool VulkanHppGenerator::containsArray( std::string const & type ) const
1363{

Callers

nothing calls this directly

Calls 3

checkForErrorFunction · 0.85
isNumberFunction · 0.85
containsByNameOrAliasFunction · 0.70

Tested by

no test coverage detected