Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 want a $PreviousClassName$

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
mnicolella Posted - Aug 22 2013 : 5:08:32 PM
I'd like to refer to the most-recent class name definition, so I can auto-generate free functions just below the class definition.

For example:

struct Foo
{
};

void Serialize( Serializer& s, Foo& obj );

I'd like to make a snippet to generate that Serialize() signature, like this:
void Serialize( Serializer& s, $PreviousClassName$& obj );
6   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Aug 26 2013 : 4:25:32 PM
mnicolella this makes sense, and you have made a good case for this. I have put in a feature request to see what our developers make of this:

case=76425

As a temporary work around, the following VA Snippet works:

void Serialize( Serializer& s, $ClassName=$clipboard$ $& obj );

This will prompt you for the class name to use, but it will pre-fill the prompt dialog with the content of the clipboard. So you could type in the class name if not already in the clipboard history, and then copy it to be used on the next function. I know its not the same, but it might help a little bit.
feline Posted - Aug 26 2013 : 3:46:46 PM
Jay, you can do simple moves like this via VA Outline, by selecting and cutting the functions or classes you want to move, and then simply pasting them into a different file. Or via drag and drop if you are just moving them around in the current file.

The problem is going to be updating all of the calls to the moved methods, which VA Snippets are not going to be able to help you with. We don't currently have a refactoring command to do this, but we are considering adding features in this area.
mnicolella Posted - Aug 26 2013 : 3:23:22 PM
I meant "the most recently defined class name in this file"

Including the struct definition is fine, but doesn't help when retrofitting existing code
jay.carlton Posted - Aug 26 2013 : 2:18:47 PM
Hi,

I'm interested in a snippet or snippets to move methods
* from an existing class to a nested class within it
* from an existing class to a free (static) function
* from a free function into a separate class

So maybe a more generic version of what mnicolella wants would be some thing like $targetClass$?

Either way, you'd be introducing a time-dependence, or an assignment that outlives an individual snippet expansion.

@mnicolella, would it be perhaps simpler to include the free functions associated with all your structs in a snippet that also gives you the struct declaration? That would remove some of the context dependence I'd think:


struct $PrevClassName$
{
};

void Serialize( Serializer& s, $PrevClassName$& obj );


Or do you mean previous as in, "the most recently defined class name in this file" as opposed to "the class name most recently used by VA X"?

HTH,

Jay
mnicolella Posted - Aug 26 2013 : 1:08:57 PM
Yes, I'm aware that I can do this with $clipboard$, and that's more flexible, but it's more clicks and keypresses - if I had $PrevClassName$ it would make this use case a lot slicker
feline Posted - Aug 23 2013 : 9:43:41 PM
Is this something you often do?

Are you aware of the $clipboard$ token that you can use in VA Snippets? You could copy the class name, and then use this token, which would give you more flexibility when generating these function signatures.

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