本文作者原创,首发在本博客;CSDN 上的同名文章已标注为转载并回链到本页:https://blog.csdn.net/qq_30220519/article/details/140897991
关键代码
1 | QStringList multis = templateStr.split('\n'); |
模板配置
[config]
camealCase = true
[var]
scopeName = Test
funcName = genetate
returnType = std::string
defaultReturn = “”
[template]
${returnType} ${scopeName}::get${funcName}() const
{
auto node = getNode();
if (!node)
return ${defaultReturn};
${returnType} ${funcName} = node->${funcName}(); // 修改属性名
return ${funcName};
}
生成后
1 | std::string Test::getGenetate() const |
创作不易,小小的支持一下吧!

