Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Bug: Encapsulate field with changed return type

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
stifu Posted - Sep 07 2018 : 04:15:25 AM
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;
}


2   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Jun 17 2020 : 3:03:21 PM
case=118972 and case=118973 were fixed last year in build 2341
feline Posted - Sep 07 2018 : 09:34:26 AM
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.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000