自动生成头文件。 [英] Automatic generation of header file.

查看:180
本文介绍了自动生成头文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



维护C ++头文件可能很痛苦。我想要一种方法来
自动从实现文件生成头文件。

是否有人知道这样做的程序?


如果没有,我想尝试写一个。输入文件将包含

函数定义和类定义(所有方法定义为

inline)。该程序将提取所有签名并将它们放在

头文件中。我可以看到一些与命名空间相关的小问题和

包含但是有没有任何show-stoppers?


- Kannan


Maintaining a C++ header file can be painful. I want a way to
automatically generate header files from the implementation file. Does
anybody know of a program that does this?

If not, I''d like to try writing one. The input file would consist of
function definitions and class definitions (with all methods defined
inline). The program would extract all the signatures and place them in a
header file. I can see some small problems related to namespaces and
includes, but are there any show-stoppers?

- Kannan

推荐答案

Kannan Goundan写道:
Kannan Goundan wrote:
维护一个C ++头文件可能很痛苦。我想要一种从实现文件中自动生成头文件的方法。
是否有人知道这样做的程序?

如果没有,我想尝试一下写一个。输入文件将包含
函数定义和类定义(所有方法都定义为内联)。该程序将提取所有签名并将它们放在头文件中。我可以看到一些与
名称空间有关的小问题,包括但是有没有任何show-stoppers?
Maintaining a C++ header file can be painful. I want a way to
automatically generate header files from the implementation file.
Does anybody know of a program that does this?

If not, I''d like to try writing one. The input file would consist of
function definitions and class definitions (with all methods defined
inline). The program would extract all the signatures and place them
in a header file. I can see some small problems related to
namespaces and includes, but are there any show-stoppers?




Show-stoppers我不确定,但要考虑你的班级是否需要有一两个基础班级。怎么会自动生成?


V



Show-stoppers I ain''t sure of, but consider if your class needs to have
a base class or two. How is that going to be automatically generated?

V


Victor Bazarov写道:
Victor Bazarov wrote:
Kannan Goundan写道:
Kannan Goundan wrote:
维护一个C ++头文件可能很痛苦。我想要一种从实现文件中自动生成头文件的方法。
是否有人知道这样做的程序?

如果没有,我想尝试一下写一个。输入文件将包含
函数定义和类定义(所有方法都定义为内联)。该程序将提取所有签名并将它们放在头文件中。我可以看到一些与
名称空间有关的小问题,包括但是有没有show-stoppers?
Maintaining a C++ header file can be painful. I want a way to
automatically generate header files from the implementation file.
Does anybody know of a program that does this?

If not, I''d like to try writing one. The input file would consist of
function definitions and class definitions (with all methods defined
inline). The program would extract all the signatures and place them
in a header file. I can see some small problems related to
namespaces and includes, but are there any show-stoppers?



Show-stoppers我不确定,但考虑一下你的班级需要有一两个基础班。怎么会自动生成?

V


Show-stoppers I ain''t sure of, but consider if your class needs to have
a base class or two. How is that going to be automatically generated?

V




为什么?他可以从公共BC获得它的名字。孩子的一部分

班级定义(如果我得到那个可以在源文件中找到

吧)。

那么你可以(鉴于文件名与类

名称相同)在生成的头文件中生成一个include指令,

包含基类定义(#include BC.hpp)。 br />

-

Matthias Kaeppler



Why? He can obtain its name from the ": public BC " part of the child
class definition (which can be found in the source file if I got that
right).
You could then (given that the filenames are identical to the class
names) produce an include directive in the generated header which
includes the base class definition (#include BC.hpp).

--
Matthias Kaeppler


2005年4月8日星期五23:45:34 - 0700,Kannan Goundan< ca ***** @ yahoo.com>写道:
On Fri, 08 Apr 2005 23:45:34 -0700, Kannan Goundan <ca*****@yahoo.com> wrote:

维护一个C ++头文件可能会很痛苦。我想要一种方法来自动生成实现文件中的头文件。有没有人知道这样做的程序?

如果没有,我想尝试写一个。输入文件将包含
函数定义和类定义(所有方法都定义为内联)。该程序将提取所有签名并将它们放在一个
头文件中。我可以看到一些与命名空间相关的小问题和
包含但是有没有show-stoppers?

Maintaining a C++ header file can be painful. I want a way to
automatically generate header files from the implementation file. Does
anybody know of a program that does this?

If not, I''d like to try writing one. The input file would consist of
function definitions and class definitions (with all methods defined
inline). The program would extract all the signatures and place them in a
header file. I can see some small problems related to namespaces and
includes, but are there any show-stoppers?




由于头文件定义了api,所以使用超过

只是执行,我想你会希望它不容易改变
。也许你还没有做过api改变的短暂结果

经常足以欣赏它。 :)


-

Joe Seigh



Being that the header file defines the api which is used by more than
just the implementation, I''d think you''d want it to not be easily
changed. Maybe you haven''t been on the short end of an api change
often enough to appreciate that. :)

--
Joe Seigh


这篇关于自动生成头文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆