Automatically generate C++ file from header?

↘锁芯ラ 提交于 2019-11-28 17:53:12

Lazy C++ appears to be designed to address precisely that problem.

I found myself in your situation lately and manned up to write my own tool -- impl_me. It's a small Ruby script that uses SWIG as a parser backend. It writes to stdout so you can combine with your favorite nix toolset find/grep/sed/awk to tweak for your own preferences.

Because it's written in Ruby, it should be cross platform. SWIG is also cross platform so everything should be OK.

It's quite primitive at this stage and isn't as robust as Lazy C++ in terms of parsing strange templates and stuffs. Contributions are welcome :)

The eclipse CDT has an "Implement method" feature which does just that (one method at a time). There is also a "Generate Getters and Setters" feature which also generates the appropriate code in the function bodies.

I tried Lazy C++ but it seems to be out of date and not maintained anymore. It doesn't support the latest C++14 standard either.

That's why I decided to write my own tool in Java using ANTLR4. It's called Score and you can find it here: https://github.com/underrated/Score

At the moment it's in its infancy and might be full of bugs but I plan to improve it. So give it a try if you want and report any bugs on the project's github page. I'll try to fix them as fast as possible.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!