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

查看:158
本文介绍了用于将实现与.h文件中的头文件分离的脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,当使用小类时,在一个.cpp文件中分离实现是件麻烦的事,所以我把所有的代码放在头文件中(孩子,不要这样做)。



但是,最终这些类会增加大的时间,我必须分开,我一开始没有做。



<事实是,这是一个机械过程,可以完美地通过脚本或类似的东西,我&确定有人已经想到这一点。



所以,你知道任何脚本可以得到一个.h文件,所有的函数体实现,然后返回一个剥离的.h文件和一个很好填充的.cpp文件? / p>

解决方案

我也犯了这个错误 - 虽然我从来没有考虑过自动化拆分,因为通常相关项目和测试文件。



自动化这个想法很有趣。我看到的最有前途的工具是这个:



http://os.inf.tu-dresden.de/~hohmuth/prj/preprocess/


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.

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天全站免登陆