mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Add prefix and postfix support for basetype.
This commit is contained in:
parent
5002a06691
commit
5c3e410592
@ -766,7 +766,7 @@ std::string VulkanHppGenerator::generateBaseTypes() const
|
||||
// filter out VkFlags and VkFlags64, as they are mapped to our own Flags class
|
||||
if ( ( baseType.first != "VkFlags" ) && ( baseType.first != "VkFlags64" ) )
|
||||
{
|
||||
str += " using " + stripPrefix( baseType.first, "Vk" ) + " = " + baseType.second.type + ";\n";
|
||||
str += " using " + stripPrefix( baseType.first, "Vk" ) + " = " + baseType.second.typeInfo.compose() + ";\n";
|
||||
}
|
||||
}
|
||||
return str;
|
||||
@ -9600,9 +9600,9 @@ void VulkanHppGenerator::checkCorrectness()
|
||||
// baseType checks
|
||||
for ( auto const & baseType : m_baseTypes )
|
||||
{
|
||||
check( m_types.find( baseType.second.type ) != m_types.end(),
|
||||
check( m_types.find( baseType.second.typeInfo.type ) != m_types.end(),
|
||||
baseType.second.xmlLine,
|
||||
"basetype type <" + baseType.second.type + "> not specified" );
|
||||
"basetype type <" + baseType.second.typeInfo.type + "> not specified" );
|
||||
}
|
||||
|
||||
// bitmask checks
|
||||
@ -12303,18 +12303,21 @@ void VulkanHppGenerator::readBaseType( tinyxml2::XMLElement const *
|
||||
TypeInfo typeInfo;
|
||||
std::tie( nameData, typeInfo ) = readNameAndType( element );
|
||||
|
||||
if ( typeInfo.prefix == "typedef" )
|
||||
{
|
||||
// remove redundant typeInfo.prefix "typedef"
|
||||
typeInfo.prefix.clear();
|
||||
}
|
||||
|
||||
check( nameData.arraySizes.empty(), line, "name <" + nameData.name + "> with unsupported arraySizes" );
|
||||
check( typeInfo.type.empty() || ( typeInfo.prefix == "typedef" ),
|
||||
check( typeInfo.prefix.empty(), line, "unexpected type prefix <" + typeInfo.prefix + ">" );
|
||||
check( typeInfo.postfix.empty() || ( typeInfo.postfix == "*" ),
|
||||
line,
|
||||
"unexpected type prefix <" + typeInfo.prefix + ">" );
|
||||
check( typeInfo.prefix.empty() || ( typeInfo.prefix == "typedef" ),
|
||||
line,
|
||||
"unexpected type prefix <" + typeInfo.prefix + ">" );
|
||||
check( typeInfo.postfix.empty(), line, "unexpected type postfix <" + typeInfo.postfix + ">" );
|
||||
"unexpected type postfix <" + typeInfo.postfix + ">" );
|
||||
|
||||
if ( !typeInfo.type.empty() )
|
||||
{
|
||||
check( m_baseTypes.insert( std::make_pair( nameData.name, BaseTypeData( typeInfo.type, line ) ) ).second,
|
||||
check( m_baseTypes.insert( std::make_pair( nameData.name, BaseTypeData( typeInfo, line ) ) ).second,
|
||||
line,
|
||||
"basetype <" + nameData.name + "> already specified" );
|
||||
}
|
||||
|
@ -47,32 +47,6 @@ public:
|
||||
std::string const & getVulkanLicenseHeader() const;
|
||||
|
||||
private:
|
||||
struct BaseTypeData
|
||||
{
|
||||
BaseTypeData( std::string const & type_, int line ) : type( type_ ), xmlLine( line ) {}
|
||||
|
||||
std::string type;
|
||||
int xmlLine;
|
||||
};
|
||||
|
||||
struct BitmaskData
|
||||
{
|
||||
BitmaskData( std::string const & r, std::string const & t, int line )
|
||||
: requirements( r ), type( t ), xmlLine( line )
|
||||
{}
|
||||
|
||||
std::string requirements;
|
||||
std::string type;
|
||||
std::string alias;
|
||||
int xmlLine;
|
||||
};
|
||||
|
||||
struct NameData
|
||||
{
|
||||
std::string name;
|
||||
std::vector<std::string> arraySizes;
|
||||
};
|
||||
|
||||
struct TypeInfo
|
||||
{
|
||||
std::string compose( bool inNamespace = true ) const;
|
||||
@ -102,6 +76,32 @@ private:
|
||||
std::string postfix;
|
||||
};
|
||||
|
||||
struct BaseTypeData
|
||||
{
|
||||
BaseTypeData( TypeInfo const & typeInfo_, int line ) : typeInfo( typeInfo_ ), xmlLine( line ) {}
|
||||
|
||||
TypeInfo typeInfo;
|
||||
int xmlLine;
|
||||
};
|
||||
|
||||
struct BitmaskData
|
||||
{
|
||||
BitmaskData( std::string const & r, std::string const & t, int line )
|
||||
: requirements( r ), type( t ), xmlLine( line )
|
||||
{}
|
||||
|
||||
std::string requirements;
|
||||
std::string type;
|
||||
std::string alias;
|
||||
int xmlLine;
|
||||
};
|
||||
|
||||
struct NameData
|
||||
{
|
||||
std::string name;
|
||||
std::vector<std::string> arraySizes;
|
||||
};
|
||||
|
||||
struct ParamData
|
||||
{
|
||||
ParamData( int line ) : optional( false ), xmlLine( line ) {}
|
||||
|
Loading…
Reference in New Issue
Block a user