|T O P I C R E V I E W
||Posted - Apr 12 2011 : 05:05:56 AM
It should be helpful to have an action named "Implement virtuals", available on a right click on a class inheritance declaration ( class A : public B, public C ) that allow to implement virtual methods of inherited classes. This feature should open a checklistbox to ask which method to override, then implements them in the class.
|11 L A T E S T R E P L I E S (Newest First)
||Posted - Aug 09 2012 : 01:49:17 AM
case=52138 is implemented in build 1912
||Posted - Aug 05 2011 : 2:08:56 PM
Some of the refactoring snippets are re-used for a few different commands, so it is often worth having a look at the snippets, to see if any of them are being used
||Posted - Aug 05 2011 : 1:46:31 PM
Originally posted by feline
The method body comes from the VA Snippet "Refactor Create From Usage Method Body".
Ahh, I didn't make that connection when I was looking for the snippet, so I thought it was internally defined.
||Posted - Aug 05 2011 : 1:42:51 PM
The method body comes from the VA Snippet "Refactor Create From Usage Method Body". So just edit this snippet to change the exception string:
||Posted - Aug 05 2011 : 11:21:25 AM
One suggestion: right now, the body of the function looks like this:
throw std::exception("The method or operation is not implemented.");
When doing TDD or other incremental development, it's not uncommon for this exception to actually get thrown in a test run (until the method actually gets implemented). It would be more useful if the body looked like this:
throw std::exception(__FUNCTION__ " is not implemented.");
Most unit test libraries will print the what() of the exception thrown, which helps when a method that you didn't think should be getting called yet really is.
||Posted - Jul 20 2011 : 02:06:27 AM
Maintaining declaration order in Implement Interface is case=58301, and is fixed in build 1854.
||Posted - May 13 2011 : 5:25:29 PM
Are you seeing this ordering problem when using system / library classes as your base class, or only when using your own classes as the base class?
I have tried the following, very simple, test here, and the ordering of the implemented functions is the same as the ordering in the two base classes:
virtual void BaseOneMember1();
virtual void BaseOneMember2();
virtual void BaseOneMember3();
virtual void BaseOneMember4();
virtual void BaseTwoMember1();
virtual void BaseTwoMember2();
virtual void BaseTwoMember3();
virtual void BaseTwoMember4();
class testInterfaceOrderCreated : public testInterfaceBaseOrderOne, testInterfaceBaseOrderTwo
So I am wondering what is triggering this random ordering of new functions. Does the order of the functions in the dialog seem to be related to the order of the functions as implemented in the header file?
The documentation for VA Outline is here, in case you are interested:
||Posted - May 13 2011 : 07:20:03 AM
thanks for your answer. I'd expect the order to be the same as in the header file of the interface I'm implementing. If a class implements several interfaces, you could add comments to separate the methods, e.g.
// Methods from Interface1.h
// Methods from Interface2.h
and so on.
I was not aware of this VA outline functionality. I will try this, thanks!
||Posted - May 12 2011 : 2:23:39 PM
Point 2, we are working to enhance this command so that it will scan more than one base class deep:
This has always been the plan, but it brings its own set of edge cases with it.
Point 1, for the header file, do you have a preference / expectation of the ordering of items? It is complicated by the need to try and respect the visibility of each of the virtual methods.
For the placement into the cpp file, this is something we are looking at, but since the .h and cpp files are often very differently ordered to begin with, it is a little tricky.
Are you aware you can use VA Outline to drag and drop items, to reorder both the .h and the cpp file?
||Posted - May 12 2011 : 08:08:32 AM
unfortunately this "Implement Interface" command has some drawbacks IMHO:
1. The order of the methods is totally random G?? in the header and the cpp file. It's neither the original order from the interface header nor is it any observable order at all (e.g. alphabetical).
2. It only implements methods from a direct base interface.
You have an interface IThing. You have another interface IMoreSpecificThing which implements IThing. If you now write a class that implements IMoreSpecificThing and use the "Implement Interface" command, it only implements the methods from IMoreSpecificThing, not the ones from IThing.
Will this command be improved in later releases?
||Posted - Apr 12 2011 : 10:54:42 AM
Are you aware of the new Implement Interface refactoring command? This is designed to help in exactly this type of situation.