C++ Refactoring - Move method to implementation file
Asked Answered
T

4

7

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.

Tentmaker answered 15/6, 2011 at 19:13 Comment(2)
You can easily create a script in some other language (or even use C++ if you want to do that). I am unaware of anything that does that automatically for you though.Inion
@Peter R.: I don't think that creating a script that parses C++ good enough to do this job is done easily!Stow
H
4

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.

Hagerman answered 15/6, 2011 at 19:18 Comment(3)
I know about Visual Assist. It does require me to review all the header files and click a lot... You can't even set a hotkey...Tentmaker
@Tsury: Most Visual Assist commands can be bound to any keybinding you want via Tools | Options | Environment | Keyboard. Show commands containing: VAssistX.RefactorMaines
Visual Studio can also do it without Visual Assist. The feature is marked as experimental though. You can use it by pressing Ctrl + . and then choosing Move definition location.Adjudication
R
2

In Eclipse CDT its combination is Alt+Shift+T

Richey answered 13/3, 2017 at 14:4 Comment(1)
:s Im getting: Cannot work without declarator...Incrustation
R
1

KDevelop has such ability too:

Right click to the method -> Refactoring -> Move to cpp

Richey answered 19/1, 2014 at 19:21 Comment(0)
B
0

There's a free version of DevExpress Refactor! for C++ that has two automatic 'refactorings' that may suit your needs:

  • Move Method to Source File
  • Move Method to Header

Refactorings Reference link

Babylonia answered 17/6, 2011 at 10:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.