有没有办法为类生成模板自定义 eclipse CDT 中包含保护的格式?当前格式是<Class Name>_H
,但我想要的是<namespace>_<namespace>_<class name>_H
. 并不是说我希望在我自己的项目中的不同名称空间中有同名的类,但如果出现这种情况,我不想担心它。
问问题
3266 次
3 回答
2
我喜欢斯图尔特的回答:
只需自定义模板。
因此,在 C/C++ -> Code Style -> Code Templates 下的 Preferences 对话框中,您可以修改模板以更接近您的需要,例如,如果您需要后卫中的命名空间,您可以执行类似的操作。
${filecomment}
#ifndef ${namespace_name}_${include_guard_symbol}
#define ${namespace_name}_${include_guard_symbol}
${includes}
${namespace_begin}
${declarations}
${namespace_end}
#endif /* ${namespace_name}_${include_guard_symbol} */
于 2013-03-27T16:39:28.427 回答
1
这是霓虹灯...
打开Window/Preferences
。
下到C/C++/Code Style/Name Style
。
下Code
你会发现Include Guard
。
看起来那里允许进行一些自定义。
这是扩展为${include_guard_symbol}
.
于 2016-11-23T21:53:20.807 回答