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
 Feature Requests
 Support namespaced c++ enums
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

oysteinkrag
Starting Member

Norway
1 Posts

Posted - Sep 12 2013 :  04:41:06 AM  Show Profile  Reply with Quote
I find it handy to put enums in namespaces, so that I don't get naming conflicts between different enums.
It seems like VisualAssist X does not support this scheme.
When I do "Create from usage" or just select an enum from the suggestion list, Visual Assist does not prepend the name space for me.

Possible to fix in next version?

-+?ystein

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 14 2013 :  1:19:39 PM  Show Profile  Reply with Quote
Good idea. But
1. Do you think that the "suggestion should put namespace as well" idea should also be applied to other symbols (e.g. variables and function)?
2. You said that "I find it handy to put enums in namespaces, so that I don't get naming conflicts between different enums."
What about Visual Assist? You may have a variable in 2 namespaces simultaneously. I mean, two different one, with the same name
What do you think?
If say VA would provide a second listbox to select a namespace it would be kind of "obstructive" in a way.

One idea is to list the symbol name twice for both namespaces, with a name like
NamespaceOne::Symbol1
NamespaceTwo::Symbol1

But you can still have a loads of stuff with simple names like Update() for a methods or ENABLE for an enum item.

Regarding Create from usage, can you give me an example?
Go to Top of Page

Alek86
Junior Member

Canada
20 Posts

Posted - Oct 03 2013 :  10:40:56 AM  Show Profile  Reply with Quote
In C++03 I love to create enums this way:



namespace Color { enum Value
{
 Red,
 Green,
 Blue
}}

// using

Color::Value color = Color::Red;

int Function(Color::Value d);



it would be perfect if VA suggested to create enums in this way also.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Oct 03 2013 :  7:16:14 PM  Show Profile  Reply with Quote
What do you mean by "VA suggested to create enums"? Can you please give me an example from what VA could create an enum?
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Oct 03 2013 :  8:11:52 PM  Show Profile  Reply with Quote
I like that pattern. You could create a snippet for the namespace and enum having VA prompt you in this example for Color and Value.

Something like:
namespace $Namespace$ { enum $Enum$
{
$end$
} }
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Oct 04 2013 :  6:08:40 PM  Show Profile  Reply with Quote
I have lost in the details but Sean is right. You can learn more about VA snippets here:
http://www.wholetomato.com/products/features/vasnippets.asp
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