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
 show classes that implement vfunc
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mnicolella
Junior Member

14 Posts

Posted - Aug 26 2013 :  1:14:17 PM  Show Profile  Reply with Quote
I think this might be a built-in VS feature, but currently if I go to Solution Explorer, expand a header file, right click on a class, I can select "Derived Types" which gives me a tree view of every class that inherits from the selected type.

I'd like this extended so I can select a virtual function and it can show me a tree view of all classes in the hierarchy that override the function.

I'd also like the reverse - show me all classes in the hierarchy that *don't* override a particular virtual function - this can help track down bugs if you have a case that every class 'should' override it.

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Aug 26 2013 :  3:06:22 PM  Show Profile  Reply with Quote
If you run Find References on the function, in the base class, and right click in the Find References Results window and turn On "Inherited and overridden references" then VA will list the derived, overridden functions.

Unfortunately this won't show you functions that have not been overridden, but if you want to enforce this in C++ you can use abstract virtual functions in the base class, and these functions can even be given a default implementation which can be called in the derived class. This way the compiler will catch any functions that were not overridden.

http://stackoverflow.com/questions/2089083/pure-virtual-function-with-implementation

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

mnicolella
Junior Member

14 Posts

Posted - Aug 26 2013 :  3:29:56 PM  Show Profile  Reply with Quote
I understand abstract virtual functions, but that doesn't help dealing with deep hierarchies

Thanks for the tip about Find References - is there a way to include this in the right-click context menu? The 'find all references' that appears there brings me to the VS 'find symbol results', not the VAX version
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Aug 26 2013 :  4:29:02 PM  Show Profile  Reply with Quote
I was hoping you were not using deep hierarchies, but it was a slim hope.

For the right click menu, use "Refactor (VA X) -> Find References", or use the Shift+Right click menu, especially if you are using VC6.

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

mnicolella
Junior Member

14 Posts

Posted - Aug 26 2013 :  5:24:56 PM  Show Profile  Reply with Quote
Cool, found that. BTW I'm using VS2012.

It would be nice if there were more filters on the Find References page. Currently it looks like it just looks for every line of code that mentions the type, but i would like filters to turn on/off:

when looking for references to "Foo"
- member function implementations ie void Foo:Method() {
- #include lines ie "#include "Foo.h""
- variable declarations ie Foo* foo;
- inheritance ie void Bar : public Foo {
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Aug 26 2013 :  10:01:59 PM  Show Profile  Reply with Quote
What are you looking to do with Find References? Looking for all code that mentions the items being searched for is the purpose of Find References, so for a class this does include member function implementations.

You can remove the #include lines by right clicking in the Find References Results window and turning Off "Comment and string references", which should help a bit.

Depending on what you are doing, you could try highlighting the file cpp file that contains the class member implementations and pressing Delete, to remove this file, and all references inside the file from the results list, thus manually filtering it.

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