C++ 中的默认文件布局 生成器(和德尔福)

发布于 2024-07-20 07:03:49 字数 903 浏览 7 评论 0原文

一段时间以来,我对 C++ Builder IDE 感到非常烦恼。 当我编码时,我总是使用代码文件的标准布局。 我有一个使用的标准标头,包括,即。 文件的许可证、文件名、日期等。

但我无法找到任何地方可以插入此文件,因此当我(例如)创建一个新单元时,会自动插入此标头。 当然,我每次都可以将其粘贴进去,但是花时间这样做会有点烦人。

所以我的问题是 - 是否可以为默认 C++ 文件创建文件模板或修改现有文件,以便它们始终以我预定义的布局开始。 我担心的是,就像 C++ Builder IDE 中的大多数其他内容一样,这是硬编码到其中的。

当前创建一个新单元会创建一个 .cpp 文件,其中包含:

//---------------------------------------------------------------------------


#pragma hdrstop

#include "Unit1.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

以及相应的头文件:

//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#endif

这是我希望更改为我自己定义的布局的内容。

我正在使用 Codegear C++ Builder 2007。

I've had a major annoyance with the C++ Builder IDE for some time now. When I code I always use a standard layout for the code files. I have a standard header that I use, including, ie. the License of the file, filename, date, etc.

But I haven't been able to find anywhere to insert this, so that when I - for instance - create a new unit, get this header inserted automatically. Of course I can just paste it in, every time, but it gets a bit irritating to use time doing this.

So my question is - is it possible to create a file template for default C++ files or modify the existing ones so that they always start with my predefined layout. My fear is that just as with most other things in the C++ Builder IDE, this is hardcoded into it.

Currently creating a new unit creates a .cpp file with:

//---------------------------------------------------------------------------


#pragma hdrstop

#include "Unit1.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

and a corresponding header file with:

//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#endif

This is what I wish to alter to my own defined layout.

I'm using Codegear C++ Builder 2007.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

把人绕傻吧 2024-07-27 07:03:49

请参阅帮助文件中的“将项目添加到对象存储库”。

基本上,
1. 根据需要创建单元文件
2. 进入项目-> 添加到存储库
3. 添加信息。
4. 可以从文件 -> 中找到它。 新...区域

还有共享和编辑存储库项目的方法。 默认的分发项目不太灵活,但是创建您自己的分发项目应该可以满足您的需要。

See "Adding Items to the Object Repository" in the help file.

Basically,
1. Create the unit file(s) as you wish
2. Go to Project -> Add to Repository
3. Add information.
4. It will be available from the File -> New... area

There are also ways to share and edit repository items. The default distribution items are not quite as flexible, but creating your own should do just what you need.

狼性发作 2024-07-27 07:03:49

对于默认值,请参阅减少“使用“子句样板也位于堆栈溢出。 这需要同样的改变。

For the defaults, see the answers to the question on reducing the "uses" clause boilerplate also located on stack overflow. This would require the same changes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文