Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the state of C++ refactor support in Eclipse?

Tags:

Is it at the state where it is actually useful and can do more than rename classes?

like image 598
Carl Avatar asked Sep 25 '08 01:09

Carl


People also ask

What is refactor in Eclipse?

The refactor menu shows all the possible changes that are supported on the selected Java element. To rename a class, select the Rename menu item.

How do I refactor a name in Eclipse?

We can rename variables and methods by following these simple steps: Select the element. Right-click the element. Click the Refactor > Rename option.

How do I undo refactoring in Eclipse?

Normally you can achieve this by just pressing undo. If this is not possible for any reason Eclipse will warn you. In case of emergency: Revert by using your VCS :-) D.R.

How do I move a method to another class in Eclipse?

To move this method to the new class, highlight the method's name and select Refactor→ Move, or right-click and select Refactor→ Move, opening the Move Static Member(s) dialog shown in Figure 4-5. In Eclipse, you can move a static method, static field, or instance method using refactoring.


2 Answers

CDT (C/C++ Development Tools - eclipse project) 5.0 has a bunch of new refactorings

* Declare Method
* Extract Baseclass
* Extract Constant
* Extract Method
* Extract Subclass
* Hide Method
* Implement Method
* Move Field / Method
* Replace Number
* Separate Class
* Generate Getters and Setters

There is a CDT refactoring wiki

like image 139
Benoit Avatar answered Sep 23 '22 22:09

Benoit


There have been numerous efforts to provide refactoring tools for C++, most of them failed pretty early, because the creation of such tools requires the full ability to process C++ source code, i.e. you need a working and full c++ compiler in the first place to implement even the most basic forms of automated source to source transformations.

Fortunately, with the introduction of plugins into gcc, it it's finally becoming foreseeable that related efforts may actually be able to leverage an existing C++ compiler for this purpose, instead of having to resort to their own implementations of a C++ compiler.

For a more in depth discussion, you may want to check out this.

For the time being, the most promising candidate to provide widely automated C++ refactoring support, is certainly the Mozilla pork project, along with its related companion project Dehydra.

like image 2
none Avatar answered Sep 23 '22 22:09

none