Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Bug: Encapsulate field with changed return type
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

stifu
New Member

9 Posts

Posted - Sep 07 2018 :  04:15:25 AM  Show Profile  Reply with Quote
I usually like to check the validity of a value in the setter, so I have changed the encapsulate field snippet so that the setter returns bool:
$end$$SymbolType$& Get$GeneratedPropertyName$() 
{
	return $SymbolName$;
}
bool Set$GeneratedPropertyName$(const $SymbolType$& val)
{ 
	// TODO: validity check of val
	$SymbolName$ = val; 
	return true; 
}

When I run the snippet, it seems like Visual Assist fails to separate the method names of the getter and setter, as shown on the screenshot.

I then have to place the comma manually at the appropriate position, to separate the getter and setter method names and press ok. However, the produced setter then has the same name as the getter.
double& GetDW_Positive_mm()
{
    return m_dDW_Positive_mm;
}
bool GetDW_Positive_mm(const double& val)
{
    // TODO: validity check of val
    m_dDW_Positive_mm = val;
    return true;
}



Edited by - stifu on Sep 07 2018 04:17:07 AM

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Sep 07 2018 :  09:34:26 AM  Show Profile  Reply with Quote
Thank you for the details, this is a little unexpected. I am seeing the problem with the comma being placed at the end, not in the middle, and have put in a bug report for this:

case=118972

Get and Set being replaced with Get in both cases is really odd, but I am seeing this as well. I have put this down as a separate bug, since while it is happening at the same time, the correct function names are shown in the dialog, but they are not being entered into the code file:

case=118973

Obviously we are not used to anyone returning something from the setter function, although having a check seems perfectly reasonable to me.

zen is the art of being at one with the two'ness
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Jun 17 2020 :  3:03:21 PM  Show Profile  Reply with Quote
case=118972 and case=118973 were fixed last year in build 2341
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000