Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 == enum

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

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

Forum code is on.
Html is off.

Check to subscribe to this topic.

T O P I C    R E V I E W
sitnduck Posted - Jan 18 2007 : 12:53:52 PM
It would be great if whenever == is typed against en "enum" variable (or in a SWITCH statement, etc), we could autocomplete with the members of the enum.

Did that make sense??! :)

Thank you so much for a great product!!!
15   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Apr 18 2012 : 5:20:06 PM
Thank you for the update, it is good to know this is working well for you
lac Posted - Apr 18 2012 : 08:55:01 AM
Fantastic! Works great so far
support Posted - Apr 11 2012 : 12:43:35 AM
case=65011 is fixed in build 1903
feline Posted - Feb 28 2012 : 11:09:37 PM
Sorry for the slow reply. You make some good points here, and the scoped suggestions not working in the switch case here is definitely a bug. I have put a single bug report in for all of this, since it all appears to be connected:

lac Posted - Feb 24 2012 : 03:38:12 AM
Thanks for the reply. I am currently using 1849, and I can see that what you say does work, i.e. completion on the enum name. It's still not quite as elegant and convenient as I perhaps naively thought it could be.

1. Unqualified completion is still available, but is meaningless. If I press S in your example, I get the option to complete on "SQUARE", which is great, except that the _required_ scope qualifier (QFelineVaShape::) is not inserted, hence the resulting completion does not compile.

2. If I complete on "QFelineVaShape::Shape" as in your example, I can continue adding "::" and then complete on the enum members. However, using the enum name as a scope qualifier is not permitted by the C++ standard and is really only an extension implemented by some compilers (our code, while developed in Visual Studio, are required to be portable).

3. If I add

switch (shapeTest.m_shape)

and press SPACE after 'case', I don't get any completion suggestions at all.

4. If I add

if (shapeTest.m_shape == )

and press space before the ')', I get the same invalid completions as in (1) and (2).

My wishes:

a) Automatically insert the required scope qualifier (or make it a part of the completion), when you type in "SQ" and chose "SQUARE".

b) I'd love to have a two-staged completion, where you first select "QFelineVaShape::" with "Shape" as the indicated target enum. Then "QFelineVaShape::" should be inserted, and a new completion on only the Shape enum members pops up. Currently all members are listed, which is OK for the general case.

c) Make it work in case statements also :-)
feline Posted - Dec 24 2011 : 7:50:27 PM
Which version of VA are you using?


is marked as being fixed in VA 1837, apologies for this thread not being updated to mark this as fixed, it must have been overlooked.

Using VS2010 and VA 1862 I have set up the following C++ test, to try and emulate the problem you are seeing with Qt and the enum inside the Shape class. I have this code in a header file:

namespace QtFelineVA
	class QFelineVaShape
		enum Shape { SQUARE, TRIANGLE, CIRCLE };
		Shape m_shape;
		Shape getShape() const			{ return m_shape; }
		void setShape(Shape newShape)	{ m_shape = newShape; }

and this code in the matching cpp file:

using namespace QtFelineVA;

static void testQtLikeEnum()
	QFelineVaShape shapeTest;
	// type " = " or " == " at the end of these two lines
	// one of the VA suggestions is always "QFelineVaShape::Shape" for me
	// type SPACE inside the round brackets on this line
	// one of the VA suggestions is always "QFelineVaShape::Shape" for me

Not a very clever example, but it shows that VA is trying to do something helpful in these situations. Are you seeing something similar on your system?

As a sanity check, to make sure I have not overlooked something obvious, if I accept the suggestion "QFelineVaShape::Shape" and add an actual enum item to each of these three lines, the resulting code compiles quite happily for me.
lac Posted - Dec 22 2011 : 04:30:11 AM
Completion on enum values with their scoping namespace & class, where they are expected, is a feature I sorely miss on a daily basis. Any chance for this feature?

I seems like VAX is already aware of the enum type, as it suggests the enum values, but it never suggests the *required* scope of the enum value (namespace and/or class name(s)). Shouldn't be too hard to fix?
sean Posted - Jul 02 2010 : 11:02:47 AM
Thanks for the followup.
lac Posted - Jul 02 2010 : 02:26:29 AM
Due to the API I'm currently using, its 100% from outside the namespace (The API even has nested namespaces, e.g. Ns1::Ns2::Ns3::Class1::Enum). I use 'using namespace' statements to reduce the amount of qualifiers needed, but the class qualifier is still required. However, in headers and some source files, the full namespace qualifiers are required.

The QT API is good example of this style. It has everything wrapped in the 'Qt' namespace, and commonly has public enum types inside classes, e.g. QFrame::Shape.

Since any enum type may require a scope qualifier to access its members, and the required qualifier is given from the context (considering 'using namespace' statements would be extra cool).

sean Posted - Jul 01 2010 : 6:40:30 PM
@lac: given that namespace/class/enum defintion, can you please give an example where you are seeing this problem most? That is, are you using the enums in global functions, free functions in namespace Foo or methods in class Bar?
feline Posted - Jun 29 2010 : 12:12:40 PM
I am getting VA suggestions for the enum on its own, and the enum inside the class, but not when the class is inside the namespace. I have put in a feature request for this situation:

lac Posted - Jun 25 2010 : 06:27:04 AM
Better completion on enum qualifiers and members is something I sorely miss in VAX; both in expressions and case statements. For example, this is very common for me:
namespace Foo {
  class Bar {
    enum Baz {

It's very tedious to type out the qualifier and enum prefix. VAX is not much help... it doesn't suggest anything relevant after the 'case' keyword or after comparison operators with the enum type.
feline Posted - Jan 19 2007 : 07:12:22 AM
I have put in a feature request for this, but it is unlikely to be something we will try any time soon.


personally I always used to type the enum name, which would then produce a list of the enum value's. This is how it works in C#, but for some reason the C++ specification suggests you should not do this, and VS2005 produces a warning *sigh*
sitnduck Posted - Jan 18 2007 : 2:33:07 PM
Yes thank you, I am using it with namespace, but use it w/o namespaces quite a bit... :)

For "switch" I meant the "case" statements if that helps...
feline Posted - Jan 18 2007 : 2:14:58 PM
Doing something line this for "=" or "==" on an enum variable is an interesting idea, but I am a little wary about doing it on a switch statement, given some of the code examples I have seen here.

If you are referencing the enum via a class or namespace are you aware you can filter the completion listbox to only show enum items?

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