从头自动生成C ++文件? [英] Automatically generate C++ file from header?
问题描述
我有一堆C ++头文件与各种类和函数声明。到目前为止,当我编写已声明的类和函数的C ++源文件实现时,我已经手动:
I have a bunch of C++ header files with various class and function declarations. So far, when I've been writing the C++ source file implementations of the declared classes and functions, I've been manually:
- 复制
- 删除class classname {和匹配的};
- 添加classname
- 用{}替换函数声明后的分号。
- 删除关键字virtualandstatic。
- Copying the declarations from the header file to the corresponding source file.
- Deleting "class classname {" and the matching "};"
- Adding "classname::" onto the names of all the class functions.
- Replacing the semicolons after the function declarations with "{}".
- Deleting the keywords "virtual" and "static".
只有在所有工作完成后,实现功能。我想知道是否有一个工具,在某处可以自动从.h文件生成一个.cpp文件,其中生成的.cpp包含在.h文件中声明的函数的空存根(并且没有给出内联定义)。一个UNIX友好的命令行工具将是首选。谢谢。
Only after all that work, which doesn't really do anything, can I actually go about implementing the functions. I am wondering if there is a tool out there somewhere that can automatically generate a ".cpp" file from a ".h" file, where the resulting ".cpp" contains empty stubs for the functions declared in the ".h" file (and for which an inline definition hasn't been given). A UNIX-friendly commandline tool would be preferred. Thanks.
更新:跨平台工具将是理想的。如果没有,我正在使用Mac OS X 10.6。
UPDATE: A cross-platform tool would be ideal. If not, I am working on Mac OS X 10.6.
推荐答案
Lazy C++ appears to be designed to address precisely that problem.
这篇关于从头自动生成C ++文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!