用于将实现与 .h 文件中的标头分开的脚本 [英] Script for separating implementation from headers in a .h file

查看:16
本文介绍了用于将实现与 .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 文件中的标头分开的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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