Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 switch statement from enum

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
peterchen Posted - Aug 06 2009 : 06:07:12 AM
Can the autotext (or anything else) be bent to create an appropriate switch statement over all enums in an definition?

i.e. going from

quote:
enum EFoo
{
fooA = 17
fooB = 20,
fooC
};

to

quote:
switch (foo)
{
case fooA: break;
case fooB: break;
case fooC: break;
default: break;
}


2   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Aug 21 2015 : 12:26:50 AM
case=19137 is implemented in build 2073 as the command "Add Missing Case Statements"
feline Posted - Aug 06 2009 : 3:32:02 PM
I believe you can do this with IDE Snippets in C#, but I am not sure of the exact details off hand. The IDE does not offer this feature in C++.

We are considering adding this ability to VA:

case=19137

For now you might be able to do something with an IDE macro, or perhaps something with a regular expression search and replace to turn the enum items into a switch statement. I know this is not ideal, but it might be worth looking at if you do this a lot.

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