Merge pull request #770 from asuessenbach/refactor

Refactor functions returning a vector of handles, that might as well …
This commit is contained in:
Andreas Süßenbach 2020-10-12 22:51:36 +02:00 committed by GitHub
commit c3f83db9d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1337 additions and 1370 deletions

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,7 @@ private:
struct TypeInfo struct TypeInfo
{ {
std::string compose() const; std::string compose( bool inNamespace = true) const;
bool operator==( TypeInfo const & rhs ) const bool operator==( TypeInfo const & rhs ) const
{ {
@ -280,7 +280,6 @@ private:
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep, bool twoStep,
bool firstCall, bool firstCall,
bool singular,
size_t from, size_t from,
size_t to ) const; size_t to ) const;
void appendArgumentVector( std::string & str, void appendArgumentVector( std::string & str,
@ -289,9 +288,8 @@ private:
size_t returnParamIndex, size_t returnParamIndex,
size_t templateParamIndex, size_t templateParamIndex,
bool twoStep, bool twoStep,
bool firstCall, bool firstCall ) const;
bool singular ) const; void appendArgumentVulkanType( std::string & str, ParamData const & paramData ) const;
void appendArgumentVulkanType( std::string & str, ParamData const & paramData, bool isLocalVariable ) const;
void appendBitmask( std::string & os, void appendBitmask( std::string & os,
std::string const & bitmaskName, std::string const & bitmaskName,
std::string const & bitmaskType, std::string const & bitmaskType,
@ -309,8 +307,7 @@ private:
size_t templateParamIndex, size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep, bool twoStep,
bool firstCall, bool firstCall ) const;
bool singular ) const;
void appendCommand( std::string & str, void appendCommand( std::string & str,
std::string const & indentation, std::string const & indentation,
std::string const & name, std::string const & name,
@ -339,12 +336,20 @@ private:
void appendCommandGetVector( std::string & str, void appendCommandGetVector( std::string & str,
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const; bool definition ) const;
void appendCommandGetVectorOfHandles( std::string & str, void appendCommandGetVectorOfHandles( std::string & str,
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const;
void appendCommandGetVectorOfHandlesIndirect( std::string & str,
std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const; bool definition ) const;
void appendCommandSimple( std::string & str, void appendCommandSimple( std::string & str,
std::string const & name, std::string const & name,
@ -393,8 +398,6 @@ private:
std::string const & enhancedReturnType, std::string const & enhancedReturnType,
bool definition, bool definition,
bool enhanced, bool enhanced,
bool singular,
bool unique,
bool isStructureChain, bool isStructureChain,
bool withAllocatorArgument ) const; bool withAllocatorArgument ) const;
std::string appendFunctionBodyEnhancedLocalReturnVariable( std::string & str, std::string appendFunctionBodyEnhancedLocalReturnVariable( std::string & str,
@ -402,16 +405,9 @@ private:
CommandData const & commandData, CommandData const & commandData,
size_t returnParamIndex, size_t returnParamIndex,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep,
std::string const & enhancedReturnType, std::string const & enhancedReturnType,
bool singular,
bool isStructureChain, bool isStructureChain,
bool withAllocator ) const; bool withAllocator ) const;
void appendFunctionBodyEnhancedLocalReturnVariableVectorSize( std::string & str,
std::vector<ParamData> const & params,
std::pair<size_t, size_t> const & vectorParamIndex,
std::map<size_t, size_t> const & vectorParamIndices,
bool withAllocator ) const;
void appendFunctionBodyEnhancedMultiVectorSizeCheck( std::string & str, void appendFunctionBodyEnhancedMultiVectorSizeCheck( std::string & str,
std::string const & indentation, std::string const & indentation,
std::string const & name, std::string const & name,
@ -424,9 +420,7 @@ private:
std::string const & name, std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t returnParamIndex, size_t returnParamIndex,
bool twoStep, bool twoStep ) const;
bool singular,
bool unique ) const;
void appendFunctionBodyEnhancedTwoStep( std::string & str, void appendFunctionBodyEnhancedTwoStep( std::string & str,
std::string const & indentation, std::string const & indentation,
std::string const & name, std::string const & name,
@ -434,7 +428,6 @@ private:
size_t returnParamIndex, size_t returnParamIndex,
size_t templateParamIndex, size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool singular,
std::string const & returnName ) const; std::string const & returnName ) const;
void appendFunctionBodyEnhancedVectorOfStructureChain( std::string & str, void appendFunctionBodyEnhancedVectorOfStructureChain( std::string & str,
std::string const & indentation, std::string const & indentation,
@ -443,16 +436,6 @@ private:
size_t returnParamIndex, size_t returnParamIndex,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool withAllocator ) const; bool withAllocator ) const;
void appendFunctionBodyEnhancedVectorOfUniqueHandles( std::string & str,
std::string const & indentation,
std::string const & name,
CommandData const & commandData,
size_t returnParamIndex,
size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep,
bool singular,
bool withAllocator ) const;
void appendFunctionBodyStandardArgument( std::string & str, void appendFunctionBodyStandardArgument( std::string & str,
TypeInfo const & typeData, TypeInfo const & typeData,
std::string const & name, std::string const & name,
@ -464,20 +447,16 @@ private:
bool skip, bool skip,
bool argEncountered, bool argEncountered,
bool isTemplateParam, bool isTemplateParam,
bool singular,
bool withDefaults, bool withDefaults,
bool withAllocator ) const; bool withAllocator ) const;
void appendFunctionHeaderArgumentEnhancedPointer( std::string & str, void appendFunctionHeaderArgumentEnhancedPointer( std::string & str,
ParamData const & param, ParamData const & param,
std::string const & strippedParameterName, std::string const & strippedParameterName ) const;
bool withDefaults,
bool withAllocator ) const;
void appendFunctionHeaderArgumentEnhancedVector( std::string & str, void appendFunctionHeaderArgumentEnhancedVector( std::string & str,
ParamData const & param, ParamData const & param,
std::string const & strippedParameterName, std::string const & strippedParameterName,
bool hasSizeParam, bool hasSizeParam,
bool isTemplateParam, bool isTemplateParam,
bool singular,
bool withDefaults, bool withDefaults,
bool withAllocator ) const; bool withAllocator ) const;
void appendFunctionHeaderArguments( std::string & str, void appendFunctionHeaderArguments( std::string & str,
@ -486,19 +465,15 @@ private:
size_t templateParamIndex, size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool enhanced, bool enhanced,
bool singular,
bool withDefaults, bool withDefaults,
bool withAllocator ) const; bool withAllocator ) const;
bool appendFunctionHeaderArgumentStandard( std::string & str, ParamData const & param, bool argEncountered ) const; bool appendFunctionHeaderArgumentStandard( std::string & str, ParamData const & param, bool argEncountered ) const;
void appendFunctionHeaderReturnType( std::string & str, void appendFunctionHeaderReturnType( std::string & str,
CommandData const & commandData, CommandData const & commandData,
size_t returnParamIndex, size_t returnParamIndex,
std::map<size_t, size_t> const & vectorParamIndices,
std::string const & enhancedReturnType, std::string const & enhancedReturnType,
bool enhanced, bool enhanced,
bool twoStep, bool twoStep,
bool singular,
bool unique,
bool isStructureChain ) const; bool isStructureChain ) const;
void appendFunctionHeaderTemplate( std::string & str, void appendFunctionHeaderTemplate( std::string & str,
std::string const & indentation, std::string const & indentation,
@ -506,8 +481,6 @@ private:
size_t templateParamIndex, size_t templateParamIndex,
std::string const & enhancedReturnType, std::string const & enhancedReturnType,
bool enhanced, bool enhanced,
bool singular,
bool unique,
bool withDefault, bool withDefault,
bool isStructureChain, bool isStructureChain,
bool withAllocatorArgument ) const; bool withAllocatorArgument ) const;
@ -545,6 +518,7 @@ private:
std::set<std::string> const & childrenTypes ) const; std::set<std::string> const & childrenTypes ) const;
std::string constructArgumentListEnhanced( std::vector<ParamData> const & params, std::string constructArgumentListEnhanced( std::vector<ParamData> const & params,
std::set<size_t> const & skippedParams, std::set<size_t> const & skippedParams,
size_t singularParam,
bool definition, bool definition,
bool withAllocators ) const; bool withAllocators ) const;
std::string constructArgumentListStandard( std::vector<ParamData> const & params, std::string constructArgumentListStandard( std::vector<ParamData> const & params,
@ -558,7 +532,8 @@ private:
std::vector<ParamData> const & params, std::vector<ParamData> const & params,
size_t skippedParams ) const; size_t skippedParams ) const;
std::string constructCallArgumentsGetVector( std::vector<ParamData> const & params, std::string constructCallArgumentsGetVector( std::vector<ParamData> const & params,
std::pair<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool singular ) const; bool singular ) const;
std::string constructCallArgumentsStandard( std::string const & handle, std::vector<ParamData> const & params ) const; std::string constructCallArgumentsStandard( std::string const & handle, std::vector<ParamData> const & params ) const;
std::string constructCallArgumentsVectors( std::vector<ParamData> const & params, std::string constructCallArgumentsVectors( std::vector<ParamData> const & params,
@ -588,30 +563,40 @@ private:
bool definition ) const; bool definition ) const;
std::string constructCommandGetVector( std::string const & name, std::string constructCommandGetVector( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const; bool definition ) const;
std::string constructCommandGetVectorDeprecated( std::string const & name, std::string constructCommandGetVectorDeprecated( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const; bool definition ) const;
std::string constructCommandGetVectorOfHandles( std::string const & name, std::string constructCommandGetVectorOfHandles( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition, bool definition,
bool withAllocator ) const; bool withAllocator ) const;
std::string constructCommandGetVectorOfHandlesSingular( std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const;
std::string constructCommandGetVectorOfUniqueHandles( std::string const & name, std::string constructCommandGetVectorOfUniqueHandles( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition, bool definition,
bool withAllocator ) const; bool withAllocator ) const;
std::string std::string constructCommandGetVectorOfUniqueHandlesSingular( std::string const & name,
constructCommandGetVectorOfUniqueHandlesWithAllocator( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const; bool definition ) const;
std::string constructCommandGetVectorSingular( std::string const & name, std::string constructCommandGetVectorSingular( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
std::pair<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const; bool definition ) const;
std::string constructCommandSimple( std::string const & name, std::string constructCommandSimple( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
@ -638,8 +623,6 @@ private:
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep, bool twoStep,
std::string const & enhancedReturnType, std::string const & enhancedReturnType,
bool singular,
bool unique,
bool isStructureChain, bool isStructureChain,
bool withAllocator ) const; bool withAllocator ) const;
std::string constructFunctionBodyEnhancedSingleStep( std::string const & indentation, std::string constructFunctionBodyEnhancedSingleStep( std::string const & indentation,
@ -647,8 +630,7 @@ private:
CommandData const & commandData, CommandData const & commandData,
size_t returnParamIndex, size_t returnParamIndex,
size_t templateParamIndex, size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices ) const;
bool singular ) const;
std::string constructFunctionBodyStandard( std::string const & indentation, std::string constructFunctionBodyStandard( std::string const & indentation,
std::string const & commandName, std::string const & commandName,
CommandData const & commandData ) const; CommandData const & commandData ) const;
@ -656,13 +638,13 @@ private:
size_t returnParamIndex, size_t returnParamIndex,
size_t templateParamIndex, size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool singular,
bool withDefaults, bool withDefaults,
bool withAllocator ) const; bool withAllocator ) const;
std::string constructFunctionHeaderArgumentsStandard( CommandData const & commandData, bool withDefaults ) const; std::string constructFunctionHeaderArgumentsStandard( CommandData const & commandData, bool withDefaults ) const;
std::string constructNoDiscardEnhanced( CommandData const & commandData ) const; std::string constructNoDiscardEnhanced( CommandData const & commandData ) const;
std::string constructNoDiscardStandard( CommandData const & commandData ) const; std::string constructNoDiscardStandard( CommandData const & commandData ) const;
std::string constructReturnType( CommandData const & commandData, std::string const & baseType ) const; std::string constructReturnType( CommandData const & commandData, std::string const & baseType ) const;
std::string constructSuccessCheck( std::vector<std::string> const & successCodes ) const;
std::string constructSuccessCodeList( std::vector<std::string> const & successCodes ) const; std::string constructSuccessCodeList( std::vector<std::string> const & successCodes ) const;
std::string constructVectorSizeCheck( std::string const & name, std::string constructVectorSizeCheck( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
@ -680,6 +662,10 @@ private:
size_t determineReturnParamIndex( CommandData const & commandData, size_t determineReturnParamIndex( CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep ) const; bool twoStep ) const;
std::set<size_t> determineSkippedParams( std::string const & handleType,
std::vector<ParamData> const & params,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
std::string determineSubStruct( std::pair<std::string, StructureData> const & structure ) const; std::string determineSubStruct( std::pair<std::string, StructureData> const & structure ) const;
size_t determineTemplateParamIndex( std::vector<ParamData> const & params, size_t determineTemplateParamIndex( std::vector<ParamData> const & params,
std::map<size_t, size_t> const & vectorParamIndices ) const; std::map<size_t, size_t> const & vectorParamIndices ) const;
@ -699,6 +685,9 @@ private:
std::string const & prefix ) const; std::string const & prefix ) const;
std::set<std::string> getPlatforms( std::set<std::string> const & extensions ) const; std::set<std::string> getPlatforms( std::set<std::string> const & extensions ) const;
std::pair<std::string, std::string> getPoolTypeAndName( std::string const & type ) const; std::pair<std::string, std::string> getPoolTypeAndName( std::string const & type ) const;
std::string getVectorSize( std::vector<ParamData> const & params,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
bool isChainableStructure( std::string const & type ) const; bool isChainableStructure( std::string const & type ) const;
bool isHandleType( std::string const & type ) const; bool isHandleType( std::string const & type ) const;
bool isParam( std::string const & name, std::vector<ParamData> const & params ) const; bool isParam( std::string const & name, std::vector<ParamData> const & params ) const;

File diff suppressed because it is too large Load Diff