Bug 79406 - switching between header and implemntation in C/C++
Summary: switching between header and implemntation in C/C++
Status: RESOLVED DUPLICATE of bug 72845
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: 3.0.2
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-10 19:45 UTC by Florian Goth
Modified: 2004-07-19 22:38 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Goth 2004-04-10 19:45:56 UTC
Version:           3.0.2 (using KDE 3.2.1, SuSE)
Compiler:          gcc version 3.3.3
OS:          Linux (i686) release 2.6.5

When you have written the header and are trying to switch to the implementation although there's none available, a short messagebox saying that no implementation has been written, would be nice
Comment 1 Jens Dagerbo 2004-04-10 19:59:56 UTC
This is impossible to know. At best it could display a messagebox telling the user that it couldn't find a matching header/source file. 

The whole feature is actually quite basic, it only looks for a similarly named file in the same directory. If you use an unexpected name or keep headers and implementation files in different directories, the switch feature won't work.
Comment 2 F Fracassi 2004-04-11 14:04:33 UTC
I don't think it would be impossible, it's just not trivial to implement. An easy solution would be to store the coresponding header/implementation filenames (or a key thereof) in a map. The user would probably have to help recognizing the pairs in not so trivial generic cases (i.e. when Kdevelop didn't create the files itself).

The greater Problem with such an aproach is that it would itroduce aditional data which needs to be saved with the project, a thing which KDevelop has avoided so far (and rightly so, for various valid reasons).

In a long term view such an additional storage should be thought about, since there are several features which require or could at least make use of such a thing, which would greatly enhance KDevelop. 
I'm thinking about better editing aids, and refactoring support. Examples that spring to mind: 
- improvement of the "F2-feature"  when editing the signature of a method in the header, the corresponding implementation gets changed upon demand. 
- changing the name of a local variable/method changes all usages to.
- changing an ABC changes all depending classes, too.

Much of this data could probably be also aquired with the help of the class parser, so no additional storage would be needed.

What I want to say with this slightly overstreched comment is that a wish to make the KDevelop editing features smarter would be a great benefit. They could lay the foundation for much greater features in the long run (think round trip engenieering with umbrello for example), and thus shouldn't be disregarded
Comment 3 Sascha Herrmann 2004-04-12 16:04:49 UTC
Hmm,

maybe it's possible to solve this problem by parsing the implementation files (*.cpp, *_impl.h, ...) for the 

#include <me.h>

section. So as far as i can think in "plain and correct" C++ there should only be the ONE include file mentioned that is the corresponding one for the implementation file. As a conclusion no additional data needs to be stored within the project files, as the structure is completly deriveable from the implementation files.

what do you think about that idea???
bye fox
Comment 4 Amilcar do Carmo Lucas 2004-07-19 22:38:56 UTC
The BR #72845 is "more powerfull" and has bettert text :)

*** This bug has been marked as a duplicate of 72845 ***