简体   繁体   English

更改Visual Studio默认类设置

[英]Changing the Visual Studio Default Class Setup

I want to change the default code generated by visual studios 'add->class...' for C and C++. 我想更改visual studio的add-> class ...'为C和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. 到目前为止,我一直在使用自己的脚本,但在Visual Studio打开时将它的类文件添加到项目中将节省大量时间。

Thanks a lot friends. 非常感谢朋友们。 Hopefully this is possible. 希望这是可能的。

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. 您可以在INSTALLED_FOLDER \\ VC \\ VCWizards \\ CodeWiz \\ Generic \\ Class \\ Scripts \\ 1033 \\ default.js中找到生成通用C ++类的代码。其中INSTALLED_FOLDER表示“C:\\ Program Files(x86)\\ Microsoft Visual Studio 10.0 \\ “您可以编写自定义模板或向导来生成符合您自己标准的代码。 Hope this link will take you to the details to create a custom VS template. 希望此链接将带您进入创建自定义VS模板的详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM