I'm working on a C++ project in which there are a lot of classes that have classes, methods and includes all in a single file. This is a big problem, because frequently the method implementations require #include statements, and any file that wants to use a class inherits these #includes transitively. I was just thinking that it would be nice to have a tool that did the following operation on a C++ header file:
- Parse a C++ header file into two pieces: a header file that declares a class, its data and the methods of that class and a separate file that implements the methods.
- Removes unnecessary includes from the header file.
- Adds the necessary includes to the implementation file.
I understand that parsing C++ is very difficult, but even something that worked imperfectly would be an improvement over the repetitive text editing that I'm doing right now. Is there anything that does anything like this? Or am I stuck with the decision between rolling my own solution or hammering through this with my text editor?