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::string trim( 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 );
|
||||
|
||||
const std::set<std::string> nonConstSTypeStructs = { "VkBaseInStructure", "VkBaseOutStructure" };
|
||||
@ -577,7 +578,7 @@ std::string readTypePostfix( tinyxml2::XMLNode const * node )
|
||||
std::string postfix;
|
||||
if ( node && node->ToText() )
|
||||
{
|
||||
postfix = trimEnd( node->Value() );
|
||||
postfix = trimStars( trimEnd( node->Value() ) );
|
||||
}
|
||||
return postfix;
|
||||
}
|
||||
@ -751,6 +752,26 @@ std::string trimEnd( std::string const & input )
|
||||
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 )
|
||||
{
|
||||
if ( !condition )
|
||||
|
Loading…
Reference in New Issue
Block a user