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
 Encapsulate field and C++/CLI Properties
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Alban
New Member

2 Posts

Posted - Feb 20 2015 :  04:54:54 AM  Show Profile  Reply with Quote
Hi,

I'm using Native C++ and C++/CLI classes.

I love the Encapsulate Field Refactor command, that works as a charm by generating methods for Native classes, but on C++/CLI I would like to generate Properties.

I tried to add a "Refactor Encapsulate Field as Property" snippet, but it doesn't show in refactor menu.
Replacing the "Refactor Encapsulate Field" snippet by my code however works.

If I only used C++/CLI classes, that would do the job, but since I'm always switching from native and managed, I'm searching for a mean to have access to both features.

Is there any way to do that ?
- Add a new VA Snippet to Refactor menu ?
- Add a keyboard or quick menu shortcut to trigger this new refactor snippet on a selection ?

Any idea ?

Thanks !

feline
Whole Tomato Software

United Kingdom
19008 Posts

Posted - Feb 20 2015 :  2:36:14 PM  Show Profile  Reply with Quote
Unfortunately you cannot create new commands by adding a snippet, as you have found. The refactoring snippets are there to help you control the refactoring commands, but extra work has to go on in the background to enable the reactoring to work.

Here you either need to swap between two different sets of code for the Encapsulate Field snippet, as you move between C++ and C++/CLI, or use a separate snippet for one of these two languages. Perhaps starting with:

void Set$AccessorName=$clipboard$$($dataType$ data) { $clipboard$ = data; }
$dataType$ Get$AccessorName=$clipboard$$() { return $clipboard$; }


something similar would help here. Here the thinking is that the member variable is in the clipboard, and you can then use this as the start point for the function names. You still need to enter the variable type, but you can use the clipboard history menu to help here, if you copy this before copying the variable name.

We are considering adding the ability for normal snippets to work out and insert the type of a variable, but I don't currently have an estimate for when this might be done:

case=5472

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

Alban
New Member

2 Posts

Posted - Feb 23 2015 :  02:01:31 AM  Show Profile  Reply with Quote
Hi,

Thanks for your help. I'll try your suggestion.

I hope this feature will be available soon.

Regards

Alban
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19008 Posts

Posted - Feb 23 2015 :  1:39:07 PM  Show Profile  Reply with Quote
I don't have any estimate yet for when this might be done, but this thread should be updated if and when this is done. It should be quite helpful, but its one of several enhancements we are considering, and things have to be done one at a time.

zen is the art of being at one with the two'ness
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