Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: polisbul on December 23, 2012, 12:40:43 pm

Title: create getter and setter automatically
Post by: polisbul on December 23, 2012, 12:40:43 pm
is possible in codeblocks to write a script that generates getter and setter methods for a given class field?
abbreviations can't take any input (if i'm right!).
any other suggested way to do this would be very appreciated :)
thank you
Title: Re: create getter and setter automatically
Post by: MortenMacFly on December 23, 2012, 03:16:42 pm
is possible in codeblocks to write a script that generates getter and setter methods for a given class field?
abbreviations can't take any input (if i'm right!).
any other suggested way to do this would be very appreciated :)
thank you
You can do this in advance with the class builder (File -> New -> Class) or simply declare the setters / getters minimally in the header file and then in the source code, right-click at the place you want them to be, and select -> Insert -> All class methods w/o implementation, which will create all methods stubs for you.
Title: Re: create getter and setter automatically
Post by: polisbul on December 23, 2012, 04:23:52 pm
I don't have the menu (File -> New -> Class), i'm running on code::blocks 8.02 on ubuntu 10.04.
Do I have to create the Class template?
Title: Re: create getter and setter automatically
Post by: MortenMacFly on December 23, 2012, 04:54:20 pm
i'm running on code::blocks 8.02 on ubuntu 10.04.
Do I have to create the Class template?
Sorry, but in this very old version is wasn't supported I'm afraid (alltough I don't recall exactly). I suggest you do an update. Out of curiosity: Why do you use such an old version anyways...?!
Title: Re: create getter and setter automatically
Post by: polisbul on December 23, 2012, 10:08:54 pm
ok done it. thank you