Script for separating implementation from headers in a .h file(用于将实现与 .h 文件中的标头分开的脚本)
问题描述
有时,在处理小类时,将实现分离在 .cpp 文件中是一件很痛苦的事情,所以我将所有代码放在头文件中(孩子们,不要这样做).
Sometimes, when working with small classes, it's a pain in the ass to separate the implementation in a .cpp file, so I put all the code in the header file (kids, don't do this).
但是,最终这些课程变得越来越大,我必须进行我一开始没有做的分离.
However, eventually these classes grow big time and I have to make the separation that I didn't do in the beginning.
事实上,这是一个机械过程,可以通过脚本或类似的东西完美地完成,我确定有人已经想到了这一点.
The fact is that this is a mechanic process that could be perfectly done by a script or something like that, and I'm sure someone out there has already thought of this.
那么,你知道有什么脚本可以获取一个 .h 文件,实现所有函数体,然后返回一个剥离的 .h 文件和一个填充良好的 .cpp 文件吗?
So, do you know of any script that could get a .h file, with all the function bodies implemented, and then return a stripped .h file and a nicely filled .cpp file?
推荐答案
我也为此感到内疚 - 虽然我以前从未真正考虑过自动拆分,因为通常有相关的项目和测试文件需要接触.
I'm guilty of this as well - although I've never really thought about automating the split before, as there are usually related project and test files to touch.
不过,将其自动化的想法很有趣.我看到的最有前途的工具是这个:
The idea of automating this is interesting, though. The most promising tool I see out there is this one:
http://os.inf.tu-dresden.de/~hohmuth/prj/preprocess/
这篇关于用于将实现与 .h 文件中的标头分开的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:用于将实现与 .h 文件中的标头分开的脚本


基础教程推荐
- 我有静态或动态 boost 库吗? 2021-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 常量变量在标题中不起作用 2021-01-01