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

Method generateReturnVariable

generator/VulkanHppGenerator.cpp:10224–10285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10222}
10223
10224std::string VulkanHppGenerator::generateReturnVariable( CommandData const & commandData,
10225 std::vector<size_t> const & returnParams,
10226 std::map<size_t, VectorParamData> const & vectorParams,
10227 CommandFlavourFlags flavourFlags ) const
10228{
10229 bool const chained = flavourFlags & CommandFlavourFlagBits::chained;
10230 bool const singular = flavourFlags & CommandFlavourFlagBits::singular;
10231
10232 std::string returnVariable;
10233 switch ( returnParams.size() )
10234 {
10235 case 0: break; // no return variable
10236 case 1:
10237 if ( chained )
10238 {
10239 returnVariable = "structureChain";
10240 }
10241 else
10242 {
10243 auto vectorParamIt = vectorParams.find( returnParams[0] );
10244 if ( ( vectorParamIt != vectorParams.end() ) && vectorParamIt->second.byStructure )
10245 {
10246 returnVariable = startLowerCase( stripPrefix( vectorMemberByStructure( commandData.params[returnParams[0]].type.name ).name, "p" ) );
10247 }
10248 else
10249 {
10250 returnVariable = startLowerCase( stripPrefix( commandData.params[returnParams[0]].name, "p" ) );
10251 }
10252 if ( singular )
10253 {
10254 returnVariable = stripPluralS( returnVariable );
10255 }
10256 }
10257 break;
10258 case 2:
10259 if ( chained )
10260 {
10261 returnVariable = "structureChains";
10262 }
10263 else
10264 {
10265 auto vectorParamIt = vectorParams.find( returnParams[1] );
10266 if ( vectorParamIt == vectorParams.end() )
10267 { // the return variable is simply named "data_", and holds the multi-return value stuff
10268 returnVariable = "data_";
10269 }
10270 else
10271 {
10272 assert( vectorParamIt->second.lenParam == returnParams[0] );
10273 assert( !singular );
10274 returnVariable = startLowerCase( stripPrefix( commandData.params[returnParams[1]].name, "p" ) );
10275 }
10276 }
10277 break;
10278 case 3:
10279 assert( !singular );
10280 returnVariable = "data_";
10281 break;

Callers

nothing calls this directly

Calls 2

startLowerCaseFunction · 0.85
stripPrefixFunction · 0.85

Tested by

no test coverage detected