Merge pull request #1062 from asuessenbach/refactor

Refactor commands generation.
This commit is contained in:
Andreas Süßenbach 2021-09-07 08:49:37 +02:00 committed by GitHub
commit b93f44ca92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1286 additions and 1475 deletions

File diff suppressed because it is too large Load Diff

View File

@ -438,14 +438,162 @@ private:
CommandData const & commandData, CommandData const & commandData,
size_t initialSkipCount, size_t initialSkipCount,
bool definition ) const; bool definition ) const;
std::string generateCommandResult( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandResultMultiSuccess( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandResultMultiSuccessWithoutErrors( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandResultMultiSuccessWithErrors( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandResultMultiSuccessWithErrors0Vector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string
generateCommandResultMultiSuccessWithErrors1Vector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex ) const;
std::string
generateCommandResultMultiSuccessWithErrors2Vector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices ) const;
std::string generateCommandResultSingleSuccess( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandResultSingleSuccessWithoutErrors( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandResultSingleSuccessWithoutErrors0Vector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string
generateCommandResultSingleSuccessWithoutErrors1Vector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex ) const;
std::string generateCommandResultSingleSuccessWithErrors( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandResultSingleSuccessWithErrors0Vector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string
generateCommandResultSingleSuccessWithErrors1Vector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex ) const;
std::string
generateCommandResultSingleSuccessWithErrors2Vector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::map<size_t, size_t> const & vectorParamIndex ) const;
std::string generateCommandStandard( std::string const & standard ) const;
std::string generateCommandStandardEnhanced( bool definition,
std::string const & standard,
std::string const & enhanced ) const;
std::string generateCommandStandardEnhancedChained( bool definition,
std::string const & standard,
std::string const & enhanced,
std::string const & enhancedChained ) const;
std::string generateCommandStandardEnhancedSingularDeprecated( bool definition,
std::string const & standard,
std::string const & enhancedDeprecated,
std::string const & enhanced,
std::string const & enhancedSingular ) const;
std::string generateCommandStandardEnhancedUnique( bool definition,
std::string const & standard,
std::string const & enhanced,
std::string const & enhancedUnique ) const;
std::string generateCommandStandardEnhancedWithAllocator( bool definition,
std::string const & standard,
std::string const & enhanced,
std::string const & enhancedWithAllocator ) const;
std::string
generateCommandStandardEnhancedWithAllocatorChained( bool definition,
std::string const & standard,
std::string const & enhanced,
std::string const & enhancedWithAllocator,
std::string const & enhancedChained,
std::string const & enhancedChainedWithAllocator ) const;
std::string generateCommandStandardEnhancedWithAllocatorDeprecated( bool definition,
std::string const & standard,
std::string const & enhancedDeprecated,
std::string const & enhanced,
std::string const & enhancedWithAllocator ) const;
std::string
generateCommandStandardEnhancedWithAllocatorDeprecated2( bool definition,
std::string const & standard,
std::string const & enhancedDeprecated,
std::string const & enhancedWithAllocatorDeprecated,
std::string const & enhanced,
std::string const & enhancedWithAllocator ) const;
std::string
generateCommandStandardEnhancedWithAllocatorSingularUnique( bool definition,
std::string const & standard,
std::string const & enhanced,
std::string const & enhancedWithAllocator,
std::string const & enhancedSingular,
std::string const & enhancedUnique,
std::string const & enhancedUniqueWithAllocator,
std::string const & enhancedUniqueSingular ) const;
std::string
generateCommandStandardEnhancedWithAllocatorUnique( bool definition,
std::string const & standard,
std::string const & enhanced,
std::string const & enhancedWithAllocator,
std::string const & enhancedUnique,
std::string const & enhancedUniqueWithAllocator ) const;
std::string generateCommandStandardOrEnhanced( std::string const & standard, std::string const & enhanced ) const;
std::string generateCommandValue( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandValue0Vector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandVoid( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandVoid0Vector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandVoid1Vector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex ) const;
std::string generateCommandVoidNVector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices ) const;
std::string generateStructForwardDeclarations( std::vector<RequireData> const & requireData, std::string generateStructForwardDeclarations( std::vector<RequireData> const & requireData,
std::string const & title ) const; std::string const & title ) const;
std::string generateCommandBoolGetValue( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
size_t nonConstPointerIndex ) const;
std::string generateCommandDefinitions( std::vector<RequireData> const & requireData, std::string generateCommandDefinitions( std::vector<RequireData> const & requireData,
std::set<std::string> & listedCommands, std::set<std::string> & listedCommands,
std::string const & title ) const; std::string const & title ) const;
@ -454,47 +602,17 @@ private:
std::vector<ParamData> const & params, std::vector<ParamData> const & params,
size_t initialSkipCount, size_t initialSkipCount,
std::set<std::string> const & tags ) const; std::set<std::string> const & tags ) const;
std::string generateCommandResult( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandResult( std::string const & name, std::string generateCommandResult( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t initialSkipCount, size_t initialSkipCount,
bool definition, bool definition,
std::map<size_t, size_t> const & vectorParamIndices ) const; std::map<size_t, size_t> const & vectorParamIndices ) const;
std::string generateCommandResult0Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandResult1Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
size_t returnParamIndex ) const;
std::string generateCommandResult2Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::vector<size_t> const & returnParamIndices ) const;
std::string generateCommandResult3Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::vector<size_t> const & returnParamIndices ) const;
std::string generateCommandResultEnumerate( std::string const & name, std::string generateCommandResultEnumerate( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t initialSkipCount, size_t initialSkipCount,
bool definition, bool definition,
std::pair<size_t, size_t> const & vectorParamIndices, std::pair<size_t, size_t> const & vectorParamIndices,
bool withAllocators ) const; bool withAllocators ) const;
std::string generateCommandResultEnumerateChained( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex,
std::vector<size_t> const & returnParamIndices,
bool withAllocator ) const;
std::string generateCommandResultEnumerateTwoVectors( std::string const & name, std::string generateCommandResultEnumerateTwoVectors( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t initialSkipCount, size_t initialSkipCount,
@ -518,11 +636,6 @@ private:
size_t initialSkipCount, size_t initialSkipCount,
bool definition, bool definition,
size_t nonConstPointerIndex ) const; size_t nonConstPointerIndex ) const;
std::string generateCommandResultGetTwoValues( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::vector<size_t> const & nonConstPointerParamIndices ) const;
std::string generateCommandResultGetTwoVectors( std::string const & name, std::string generateCommandResultGetTwoVectors( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t initialSkipCount, size_t initialSkipCount,
@ -598,125 +711,19 @@ private:
bool definition, bool definition,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const; size_t returnParamIndex ) const;
std::string generateCommandResultGetVectorSingular( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
std::string generateCommandSetStandard( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandSetStandardAndEnhanced( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices ) const;
std::string generateCommandSetStandardEnhancedDeprecatedAllocator(
std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices ) const;
std::string generateCommandSetStandardOrEnhanced( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandSetUnique( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
size_t nonConstPointerIndex,
bool definition ) const;
std::string generateCommandSetVector( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex,
std::vector<size_t> const & returnParamIndices ) const;
std::string generateCommandSetVectorChained( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & returnParamIndices ) const;
std::string generateCommandSetVectorDeprecated( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & returnParamIndices,
bool definition ) const;
std::string generateCommandSetVectorSingular( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const;
std::string generateCommandSetVectorSingularUnique( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const;
std::string generateCommandSetVectorSingularVoid( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const;
std::string generateCommandSetVectorUnique( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const;
std::string generateCommandStandard( std::string const & name, std::string generateCommandStandard( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t initialSkipCount, size_t initialSkipCount,
bool definition ) const; bool definition ) const;
std::string generateCommandsStandardEnhancedChained( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t nonConstPointerIndex ) const;
std::string generateCommandType( std::string const & name, std::string generateCommandType( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t initialSkipCount, size_t initialSkipCount,
bool definition ) const; bool definition ) const;
std::string generateCommandValue( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandValue0Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandVoid( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandVoid( std::string const & name, std::string generateCommandVoid( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t initialSkipCount, size_t initialSkipCount,
bool definition, bool definition,
std::map<size_t, size_t> const & vectorParamIndices ) const; std::map<size_t, size_t> const & vectorParamIndices ) const;
std::string generateCommandVoid0Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition ) const;
std::string generateCommandVoid1Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
size_t returnParamIndex ) const;
std::string generateCommandVoid2Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::vector<size_t> const & returnParamIndices ) const;
std::string generateCommandVoidEnumerate( std::string const & name, std::string generateCommandVoidEnumerate( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t initialSkipCount, size_t initialSkipCount,
@ -849,10 +856,10 @@ private:
std::set<std::string> & listedHandles, std::set<std::string> & listedHandles,
std::set<std::string> const & specialFunctions ) const; std::set<std::string> const & specialFunctions ) const;
std::pair<std::string, std::string> std::pair<std::string, std::string>
generateRAIIHandleConstructor( std::pair<std::string, HandleData> const & handle, generateRAIIHandleConstructor( std::pair<std::string, HandleData> const & handle,
std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator constructorIt, std::map<std::string, CommandData>::const_iterator constructorIt,
std::string const & enter, std::string const & enter,
std::string const & leave ) const; std::string const & leave ) const;
std::pair<std::string, std::string> std::pair<std::string, std::string>
generateRAIIHandleConstructors( std::pair<std::string, HandleData> const & handle ) const; generateRAIIHandleConstructors( std::pair<std::string, HandleData> const & handle ) const;
std::string generateRAIIHandleConstructorArguments( std::string const & handleType, std::string generateRAIIHandleConstructorArguments( std::string const & handleType,
@ -865,41 +872,37 @@ private:
std::set<size_t> const & singularParams, std::set<size_t> const & singularParams,
std::vector<size_t> const & returnParamIndices, std::vector<size_t> const & returnParamIndices,
bool allocatorIsMemberVariable ) const; bool allocatorIsMemberVariable ) const;
std::string generateRAIIHandleConstructorEnumerate( std::string generateRAIIHandleConstructorEnumerate( std::pair<std::string, HandleData> const & handle,
std::pair<std::string, HandleData> const & handle, std::map<std::string, CommandData>::const_iterator constructorIt,
std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator constructorIt, std::vector<ParamData>::const_iterator handleParamIt,
std::vector<ParamData>::const_iterator handleParamIt, std::vector<ParamData>::const_iterator lenParamIt,
std::vector<ParamData>::const_iterator lenParamIt, std::string const & enter,
std::string const & enter, std::string const & leave ) const;
std::string const & leave ) const; std::string
std::string generateRAIIHandleConstructorInitializationList( generateRAIIHandleConstructorInitializationList( std::string const & handleType,
std::string const & handleType, std::map<std::string, CommandData>::const_iterator constructorIt,
std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator constructorIt, std::map<std::string, CommandData>::const_iterator destructorIt,
std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator destructorIt, bool hasSecondLevelCommands ) const;
bool hasSecondLevelCommands ) const; std::string generateRAIIHandleConstructorResult( std::pair<std::string, HandleData> const & handle,
std::string generateRAIIHandleConstructorResult( std::map<std::string, CommandData>::const_iterator constructorIt,
std::pair<std::string, HandleData> const & handle, std::string const & enter,
std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator constructorIt, std::string const & leave ) const;
std::string const & enter,
std::string const & leave ) const;
std::string generateRAIIHandleConstructorTakeOwnership( std::pair<std::string, HandleData> const & handle ) const; std::string generateRAIIHandleConstructorTakeOwnership( std::pair<std::string, HandleData> const & handle ) const;
std::string generateRAIIHandleConstructorVector( std::string generateRAIIHandleConstructorVector( std::pair<std::string, HandleData> const & handle,
std::pair<std::string, HandleData> const & handle, std::map<std::string, CommandData>::const_iterator constructorIt,
std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator constructorIt, std::vector<ParamData>::const_iterator handleParamIt,
std::vector<ParamData>::const_iterator handleParamIt, std::string const & enter,
std::string const & enter, std::string const & leave ) const;
std::string const & leave ) const; std::string
std::string generateRAIIHandleConstructorVectorSingular( generateRAIIHandleConstructorVectorSingular( std::pair<std::string, HandleData> const & handle,
std::pair<std::string, HandleData> const & handle, std::map<std::string, CommandData>::const_iterator constructorIt,
std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator constructorIt, std::vector<ParamData>::const_iterator handleParamIt,
std::vector<ParamData>::const_iterator handleParamIt, std::string const & enter,
std::string const & enter, std::string const & leave ) const;
std::string const & leave ) const; std::string generateRAIIHandleConstructorVoid( std::pair<std::string, HandleData> const & handle,
std::string generateRAIIHandleConstructorVoid( std::map<std::string, CommandData>::const_iterator constructorIt,
std::pair<std::string, HandleData> const & handle, std::string const & enter,
std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator constructorIt, std::string const & leave ) const;
std::string const & enter,
std::string const & leave ) const;
std::string generateRAIIHandleContext( std::pair<std::string, HandleData> const & handle, std::string generateRAIIHandleContext( std::pair<std::string, HandleData> const & handle,
std::set<std::string> const & specialFunctions ) const; std::set<std::string> const & specialFunctions ) const;
std::pair<std::string, std::string> std::pair<std::string, std::string>
@ -949,11 +952,6 @@ private:
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices, std::vector<size_t> const & nonConstPointerParamIndices,
bool definition ) const; bool definition ) const;
std::pair<std::string, std::string>
generateRAIIHandleMemberFunctionResultGetTwoValues( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices ) const;
std::string generateRAIIHandleMemberFunctionResultMulti( std::map<std::string, CommandData>::const_iterator commandIt, std::string generateRAIIHandleMemberFunctionResultMulti( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,