Author Topic: create getter and setter automatically  (Read 40088 times)

Offline polisbul

  • Multiple posting newcomer
  • *
  • Posts: 17
create getter and setter automatically
« 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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: create getter and setter automatically
« Reply #1 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline polisbul

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: create getter and setter automatically
« Reply #2 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?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: create getter and setter automatically
« Reply #3 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...?!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline polisbul

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: create getter and setter automatically
« Reply #4 on: December 23, 2012, 10:08:54 pm »
ok done it. thank you
« Last Edit: December 24, 2012, 03:06:24 pm by polisbul »