I have lots of header files with long method implementation inside.
Is there An automatic way of doing that?
One-by-one can take a lot of time...
Thanks.
Move Method Refactoring (MMR) refers to moving a method from one class to the class in which the method is used the most often. Manually inspecting and analyzing the source code of the system under consideration to determine the methods in need of MMR is a costly and time-consuming process.
Open your class in the editor, place a caret at the static method you want to move and press F6 . In the Move Members dialog specify the following options: In the Members to be moved to another class (static only) field, select the checkboxes next to the methods that you want to move to another class.
If you go to each method and right-click on its name, the menu has a "Refactor" option, which leads to a "Move" option. Select that and follow the instructions. The above is especially easy for static methods. For the non-static ones, you may need to do subclassing, or pass references to the appropriate objects around.
If you are using Visual Studio, there's an add-in called Visual Assist that can help you to do this. I'm using it at work and it is really helpful.
Unfortunately this add-in is not free but you can install the trial to do your stuff and test it.
In Eclipse CDT its combination is Alt+Shift+T
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With