This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 213811 - C++ Generate method definition stub from declaration
Summary: C++ Generate method definition stub from declaration
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Completion (show other bugs)
Version: 7.1.1
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-08 10:24 UTC by Kedyn
Modified: 2013-11-13 14:22 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kedyn 2012-06-08 10:24:53 UTC
The method definition stub (signature, return type, stub for method body) in a .cpp-file should be generated automatically from the declaration in a .h-file.

Example: I create a new class "Test" in Netbeans and get a Test.h and Test.cpp file.
I then add the following two methods to Test.h:

<Code>
double computeSomething(double x, int y);
void doSomething(std::string str) const;
</Code>

Because the actual implementation of these methods goes in the .cpp-file i then have to manually add the following to Test.cpp:

<Code>
double Test::computeSomething(double x, int y) {

}
void Test::doSomething(std::string str) const {

}
</Code>

There is already a bit of code-completion offered (in the .cpp-file type "Test::", press CTRL+SPACE and choose the desired method), but this does not add the return type and the brackets for the function body (and does not place the cursor there). Also if i have declared 4 new methods in the .h-file i have to repeat this for every of these methos.

I would be cool if you could use the code generator (ALT+INSERT) for this purpose like you can use it in header files to generate getter and setters.
It should show a dialog for all the methods in the .h-file that are not yet defined in the .cpp-file, and should the create the definition stubs for the selected methods.
Comment 1 Alexander Simon 2013-09-25 14:00:51 UTC
fixed, change sets:
91e43a9e3244
250dd278da7e
Comment 2 Quality Engineering 2013-09-27 02:11:03 UTC
Integrated into 'main-silver', will be available in build *201309270002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/9b6a04b6a0ec
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixing Bug #213811 C++ Generate method definition stub from declaration
- scratch
(transplanted from 91e43a9e3244c1abda29d09152bbf6737bfa6d68)
Comment 3 Alexander Simon 2013-09-27 06:29:10 UTC
additional fix:
0e8c61204c95
Comment 4 Alexander Simon 2013-09-27 09:52:27 UTC
additional fix:
3609ba3906e2
see bug 236451
and:
- decorate icon
- fix destructor
Comment 5 Alexander Simon 2013-09-27 13:35:26 UTC
additional fix:
7b707ae316e2
- replace selection
Comment 6 Alexander Simon 2013-11-13 14:20:32 UTC
Note:
Implemented CTRL+SPACE.
IDE suggest implementing of class method if CTRL+SPACE was pressed:
- inside file that already has at least one method definition
- between method declarations
Comment 7 soldatov 2013-11-13 14:22:55 UTC
verified in NetBeans 7.4 patch1 build