Sanitize identifier names before substituting them in C++ template files

This commit is contained in:
amzn-sj
2021-06-10 11:01:23 -07:00
parent 39d207095a
commit 2ee4d8ff6b
14 changed files with 114 additions and 87 deletions
@@ -17,21 +17,21 @@
#include <${Name}SystemComponent.h>
namespace ${Name}
namespace ${SanitizedCppName}
{
class ${Name}Module
class ${SanitizedCppName}Module
: public AZ::Module
{
public:
AZ_RTTI(${Name}Module, "${ModuleClassId}", AZ::Module);
AZ_CLASS_ALLOCATOR(${Name}Module, AZ::SystemAllocator, 0);
AZ_RTTI(${SanitizedCppName}Module, "${ModuleClassId}", AZ::Module);
AZ_CLASS_ALLOCATOR(${SanitizedCppName}Module, AZ::SystemAllocator, 0);
${Name}Module()
${SanitizedCppName}Module()
: AZ::Module()
{
// Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
m_descriptors.insert(m_descriptors.end(), {
${Name}SystemComponent::CreateDescriptor(),
${SanitizedCppName}SystemComponent::CreateDescriptor(),
});
}
@@ -41,10 +41,10 @@ namespace ${Name}
AZ::ComponentTypeList GetRequiredSystemComponents() const override
{
return AZ::ComponentTypeList {
azrtti_typeid<${Name}SystemComponent>(),
azrtti_typeid<${SanitizedCppName}SystemComponent>(),
};
}
};
}// namespace ${Name}
}// namespace ${SanitizedCppName}
AZ_DECLARE_MODULE_CLASS(Gem_${Name}, ${Name}::${Name}Module)
AZ_DECLARE_MODULE_CLASS(Gem_${SanitizedCppName}, ${SanitizedCppName}::${SanitizedCppName}Module)