更改 Visual Studio 默认类设置
我想更改 Visual Studios 'add->class...' 为 C 和 C++ 生成的默认代码。
目前它看起来像,
#pragma once
class GlWindow
{
public:
GlWindow(void);
~GlWindow(void);
};
而我想使用适当的包含防护,没有预制的构造函数/析构函数,并且在类名旁边有大括号。
自从我适应了自己的编码风格以来,我一直对此感到恼火。到目前为止,我一直在使用自己的脚本,但是在 Visual Studio 打开时将我的类文件添加到项目中将节省大量时间。
非常感谢朋友们。希望这是可能的。
I want to change the default code generated by visual studios 'add->class...' for C and C++.
Currently it looks like
#pragma once
class GlWindow
{
public:
GlWindow(void);
~GlWindow(void);
};
Whereas I would like to use proper include guards, no premade constructor/destructor, and have the curly brace up next to the class name.
I've been annoyed by this ever since I've adapted my own coding style. I've been using my own script for it thus far, but having it add my class files to the project while visual studio is open would be a huge time saver.
Thanks a lot friends. Hopefully this is possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在以下位置找到生成通用 C++ 类背后的代码
INSTALLED_FOLDER\VC\VCWizards\CodeWiz\Generic\Class\Scripts\1033\default.js。其中 INSTALLED_FOLDER 表示“C:\Program Files (x86)\Microsoft Visual Studio 10.0\”
您可以编写自定义模板或向导来生成符合您自己的标准的代码。希望此链接将带您创建自定义 VS 模板的详细信息。
You can find the code behind generating a generic C++ class in
INSTALLED_FOLDER\VC\VCWizards\CodeWiz\Generic\Class\Scripts\1033\default.js.Where INSTALLED_FOLDER represents "C:\Program Files (x86)\Microsoft Visual Studio 10.0\"
You can write a custom template or wizard to generate code which meets your own standards. Hope this link will take you to the details to create a custom VS template.