News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Idea : generate boilerplate code

Started by bugmenot, March 28, 2008, 06:38:38 PM

Previous topic - Next topic

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:
#ifndef HEADER_HPP
#define HEADER_HPP
class Foo{
  void test();
  void bar(int, unsigned =3)const;
  static int a;
  int b;
};
void func();
#endif

and it generates:
void Foo::test(){

}

void Foo::bar(int, unsigned)const{

}

int Foo::a;

void func(){

}

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.
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 :)