Book a Demo

Author Topic: How to make Getters, Setters create implementation  (Read 3464 times)

Jeb.Beasley

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
How to make Getters, Setters create implementation
« on: February 23, 2005, 04:32:46 am »
Lang C++
can I tweak the language templates to have the generated getters and setters provide the actual implementaions

I add an attribute, and specify that it is a property...
EA generates
Code: [Select]
COleDateTime CMyData::GetLast_Mod(){

}
void CMyData::SetLast_Mod(COleDateTime newVal){

}

How can I make it do

Code: [Select]
COleDateTime CMyData::GetLast_Mod(){
   return m_Last_Mod;
}
void CMyData::SetLast_Mod(COleDateTime newVal){
   m_Last_Mod = newVal;
}


Thanks

Jeb
« Last Edit: February 23, 2005, 04:34:10 am by Jeb.Beasley »

Tryst

  • EA User
  • **
  • Posts: 41
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How to make Getters, Setters create implementa
« Reply #1 on: February 23, 2005, 04:49:25 am »
You should check the boxes labelled, 'Read' and 'Write' in the 'Create Property Implementation' window.

Tryst
Tryst

Jeb.Beasley

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How to make Getters, Setters create implementa
« Reply #2 on: February 23, 2005, 05:03:23 am »
Yes, they are checked, it creates the function prototypes and implementation stubs, but does not create the internal assignment on the setter,  nor the return statement on the getter.

See the code above

tnx jeb

TrtnJohn

  • EA User
  • **
  • Posts: 176
  • Karma: +0/-0
    • View Profile
Re: How to make Getters, Setters create implementa
« Reply #3 on: February 23, 2005, 01:14:57 pm »
Does the code file already exist?  If so, I don't think the implementation will be changed if the method already exists in the file.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to make Getters, Setters create implementa
« Reply #4 on: February 23, 2005, 02:32:12 pm »
For an initial generation (it won't be synchronised) you can put the code for a method into EA under the behaviour tab of the operations dialog (initial code in recent builds).

Simon