User forums > Using Code::Blocks

new plugin idea

(1/2) > >>

msk4web:
Class completion code
A class completion code is a plugin designed to complete your class that you create in a header ("header.h") file in the source code file (.cpp). It generate header.cpp and implement the lcode. It will help to save a lot of time
For example lets:
header.h
==========
#ifndef HEADER_H
#define HEADER_H

class Header{
public:
   void function1();
   void function2();
   void function3();
private:
};
#endif

the plugin generate the header.cpp file and the class implementation:

#include "header.h"
void Header::function1(){
}
void Header::function2(){
}
void Header::function3(){
}

Ceniza:
Since the idea is to redisign/remake the current code-completion plugin that feature could be included in it instead of writing another plugin, but writing another plugin that uses the parser just for that could also be possible :)

I suggest you to add it as a feature request in berliOS so we don't forget about it.

iw2nhl:
The idea is interesting, could there be a window that shows the class content (class browser) with different colored icons or text for implemented and not implemented functions, giving a way (button, right click or other) to create an empty implementation (in file .cpp).
Moreover it could do the reverse work: for implemented functions still not in the class add the declaration in the header (in file .h).
It would be nice if we could also change the parameters of the function (or other things like renaming it) using the same window and get .cpp and .h files automatically updated.
Can I add more? :-)
We could do the same with member variables: renaming a variable in all the class (both in the declaration and in all the implemented functions that use it), this would be VERY useful.

If the parser of the code-completion is well featured and is easily reusable, theese things should not be too difficult to implement.
Is someone interested?
I don't know code::blocks code, but I could help implementing this if someone could address me in the code...

kidmosey:

--- Quote from: iw2nhl on July 12, 2006, 09:59:51 pm ---The idea is interesting, could there be a window that shows the class content (class browser) with different colored icons or text for implemented and not implemented functions, giving a way (button, right click or other) to create an empty implementation (in file .cpp).
Moreover it could do the reverse work: for implemented functions still not in the class add the declaration in the header (in file .h).

--- End quote ---

Why stop there?  Why not also include the option to export a method's implementation to the .cpp file?

That feature alone could save me A LOT of time when writing and testing new classes.  I tend to save the export step for the very end (design-wise) of the class development.

However, the reverse method you suggest may be a bit difficult to implement.  What if you want the method declared private or protected?  Or in a different place than after previous function foo()?

iw2nhl:
Sorry, but I don't understand the export you are talking about: can yoy explain it better, please?
(May be you are talking about a C++ feature that I don't know).

For the reverse work: yes, I thought about the problems you mentioned and my solution was
1) when it is asked to add the declaration, show a little window with a combobox where you can choose between public, private, ecc.
2) add it to the first (or last) good line, then you can move it with your mouse (better a drag-drop than writing it yourself)
Do you agree?

Navigation

[0] Message Index

[#] Next page

Go to full version