User forums > General (but related to Code::Blocks)
Idea : generate boilerplate code
(1/1)
bugmenot:
Hello,
I really like CodeBlocks and would like to make a suggestion for an improvment.
The class Wizard is nice but it doesn't really speed coding up. I'd love to see a plugin that does the following:
[*]When I create a header it automatically inserts header guards. The macro name should automatically be unique so either it is a mangled version of the file name or a GUID. When that is done positioning the cursor between the include guards would be nice.
[*]A button that auto generates a skeleton cpp based on the header. For example you have the following header:
[/list]
--- Code: ---#ifndef HEADER_HPP
#define HEADER_HPP
class Foo{
void test();
void bar(int, unsigned =3)const;
static int a;
int b;
};
void func();
#endif
--- End code ---
and it generates:
--- Code: ---void Foo::test(){
}
void Foo::bar(int, unsigned)const{
}
int Foo::a;
void func(){
}
--- End code ---
Now that code competition is implemented it should be possible to scan the header file and use that information the generate cpp file.
Kos:
--- Quote from: bugmenot on March 28, 2008, 06:38:38 pm ---[*]When I create a header it automatically inserts header guards. The macro name should automatically be unique so either it is a mangled version of the file name or a GUID. When that is done positioning the cursor between the include guards would be nice.
[*]A button that auto generates a skeleton cpp based on the header.
--- End quote ---
1) I just type "guard" and press ctrl+J, see "Abbreviations" in Editor options for details.
2) Rightclick in the editor, and in the context menu there should be something like "Insert->All class methods without implementation", or something like this (I don't have C::B on this machine, but you will probably find it easily).
Hope that helps :)
Navigation
[0] Message Index
Go to full version