mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-12-02 00:20:07 +00:00
Improve interpretation of type postfixes.
This commit is contained in:
parent
ac3e6be81b
commit
c1a769dba9
@ -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