自动生成C ++源和标头(并在更改时更新)

时间:2021-12-10 15:05:13

Is there some tool (hopefully emacs) that can update and add the correct function definitions and other things to keep the source (.cpp) and the header (.h) files synchronized.

是否有一些工具(希望是emacs)可以更新和添加正确的函数定义和其他东西,以保持源(.cpp)和标题(.h)文件同步。

For example if I start doing this:

例如,如果我开始这样做:

file: aaa.h

Class AAA {
   int b;
public:
   void func();
};

something that will automatically create and add:

会自动创建和添加的内容:

file: aaa.cpp

void AAA:func() {

}

And any changes will appear on both?

两者都会出现任何变化吗?

Am I just dreaming too much?

我只是梦想太多了?

3 个解决方案

#1


An almost duplicate question was asked here and my answer describes the tool that we use to go from a single file to separate header and source files: lzz.

这里提出了一个几乎重复的问题,我的答案描述了我们用来从单个文件分离标题和源文件的工具:lzz。

I don't know of any tool that can do the reverse translation.

我不知道任何可以进行反向翻译的工具。

#2


Visual Studio + Visual Assist X does it (see Refactoring features).

Visual Studio + Visual Assist X执行此操作(请参阅重构功能)。

But indeed, it's not emacs based :/

但实际上,它不是基于emacs的:/

#3


Xrefactory (fairly expensive tool) might be able to do what you are looking for. I haven't used it (I use Visual Studio + Visual Assist myself) but it shows up on a google search for 'emacs refactoring tools'.

Xrefactory(相当昂贵的工具)可能能够满足您的需求。我没有使用它(我自己使用Visual Studio + Visual Assist),但它出现在谷歌搜索'emacs重构工具'。

#1


An almost duplicate question was asked here and my answer describes the tool that we use to go from a single file to separate header and source files: lzz.

这里提出了一个几乎重复的问题,我的答案描述了我们用来从单个文件分离标题和源文件的工具:lzz。

I don't know of any tool that can do the reverse translation.

我不知道任何可以进行反向翻译的工具。

#2


Visual Studio + Visual Assist X does it (see Refactoring features).

Visual Studio + Visual Assist X执行此操作(请参阅重构功能)。

But indeed, it's not emacs based :/

但实际上,它不是基于emacs的:/

#3


Xrefactory (fairly expensive tool) might be able to do what you are looking for. I haven't used it (I use Visual Studio + Visual Assist myself) but it shows up on a google search for 'emacs refactoring tools'.

Xrefactory(相当昂贵的工具)可能能够满足您的需求。我没有使用它(我自己使用Visual Studio + Visual Assist),但它出现在谷歌搜索'emacs重构工具'。