mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #651 from asuessenbach/trimStars
Improve interpretation of type postfixes.
This commit is contained in:
commit
5cce0f8380
@ -87,6 +87,7 @@ std::string toUpperCase( std::string const & name );
|
|||||||
std::vector<std::string> tokenize( std::string const & tokenString, std::string const & separator );
|
std::vector<std::string> tokenize( std::string const & tokenString, std::string const & separator );
|
||||||
std::string trim( std::string const & input );
|
std::string trim( std::string const & input );
|
||||||
std::string trimEnd( std::string const & input );
|
std::string trimEnd( std::string const & input );
|
||||||
|
std::string trimStars( std::string const & input );
|
||||||
void warn( bool condition, int line, std::string const & message );
|
void warn( bool condition, int line, std::string const & message );
|
||||||
|
|
||||||
const std::set<std::string> nonConstSTypeStructs = { "VkBaseInStructure", "VkBaseOutStructure" };
|
const std::set<std::string> nonConstSTypeStructs = { "VkBaseInStructure", "VkBaseOutStructure" };
|
||||||
@ -577,7 +578,7 @@ std::string readTypePostfix( tinyxml2::XMLNode const * node )
|
|||||||
std::string postfix;
|
std::string postfix;
|
||||||
if ( node && node->ToText() )
|
if ( node && node->ToText() )
|
||||||
{
|
{
|
||||||
postfix = trimEnd( node->Value() );
|
postfix = trimStars( trimEnd( node->Value() ) );
|
||||||
}
|
}
|
||||||
return postfix;
|
return postfix;
|
||||||
}
|
}
|
||||||
@ -751,6 +752,26 @@ std::string trimEnd( std::string const & input )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string trimStars( std::string const & input )
|
||||||
|
{
|
||||||
|
std::string result = input;
|
||||||
|
size_t pos = result.find( '*' );
|
||||||
|
while ( pos != std::string::npos )
|
||||||
|
{
|
||||||
|
if ( ( 0 < pos ) && ( result[pos - 1] != ' ' ) && ( result[pos - 1] != '*' ) )
|
||||||
|
{
|
||||||
|
result.insert( pos, 1, ' ' );
|
||||||
|
++pos;
|
||||||
|
}
|
||||||
|
else if ( ( pos < result.length() - 1 ) && ( result[pos + 1] != ' ' ) && ( result[pos + 1] != '*' ) )
|
||||||
|
{
|
||||||
|
result.insert( pos + 1, 1, ' ' );
|
||||||
|
}
|
||||||
|
pos = result.find( '*', pos+1 );
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void warn( bool condition, int line, std::string const & message )
|
void warn( bool condition, int line, std::string const & message )
|
||||||
{
|
{
|
||||||
if ( !condition )
|
if ( !condition )
|
||||||
@ -5057,7 +5078,7 @@ VulkanHppGenerator::ParamData VulkanHppGenerator::readCommandParam( tinyxml2::XM
|
|||||||
line,
|
line,
|
||||||
"unexpected type prefix <" + paramData.type.prefix + ">" );
|
"unexpected type prefix <" + paramData.type.prefix + ">" );
|
||||||
check( paramData.type.postfix.empty() || ( paramData.type.postfix == "*" ) || ( paramData.type.postfix == "**" ) ||
|
check( paramData.type.postfix.empty() || ( paramData.type.postfix == "*" ) || ( paramData.type.postfix == "**" ) ||
|
||||||
( paramData.type.postfix == "* const*" ),
|
( paramData.type.postfix == "* const *" ),
|
||||||
line,
|
line,
|
||||||
"unexpected type postfix <" + paramData.type.postfix + ">" );
|
"unexpected type postfix <" + paramData.type.postfix + ">" );
|
||||||
check( std::find_if( params.begin(),
|
check( std::find_if( params.begin(),
|
||||||
|
Loading…
Reference in New Issue
Block a user