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
 Refactoring: Create Implementation for class
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Sasa
Tomato Guru

272 Posts

Posted - Apr 29 2007 :  12:42:52 PM  Show Profile  Reply with Quote
It would be really nice if VAX could create a whole implementation for a class declaration.

So you create the definition in a header file, then you click on the class name for refactoring and voila, the .cpp is created with the same name as the .h file, and all the methods are implemented in a compilable state, example for methods with return signatue, return null...

It would really be a time saver instead of doing it one at a time.

C++
Visual Studio 2008 Pro
Windows 7 x64

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Apr 30 2007 :  07:53:19 AM  Show Profile  Reply with Quote
We are considering allowing Create Implementation to operate on several functions at once. Assuming this works by selecting several declarations (several lines of code) then you could simply select the class and then trigger Create Implementation on all of the declarations in one go.

case=1092

I am not so sure about creating the file automatically. I can see possible problems with this, especially when people have specific directory structures. This is likely to open the door to all sorts of feature requests and bug reports about VA not understanding and respecting how they have organised their code files.

This bit is probably best done by hand.

If you want to get clever you could write a macro to trigger Create Implementation, then alt-g back to the header, then move down the file to the next declaration:

http://docs.wholetomato.com?W382

Not quite the same, but quite a good time saver.

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

support
Whole Tomato Software

5566 Posts

Posted - Aug 09 2012 :  01:44:46 AM  Show Profile  Reply with Quote
case=49162 replaces case=1092 and is implemented in build 1912

Whole Tomato Software, Inc.
Go to Top of Page

AjayV
Junior Member

India
23 Posts

Posted - Aug 14 2012 :  1:30:25 PM  Show Profile  Reply with Quote
Don't know where exactly is 'case 49162', so reporting the bug.

class Test
{
  int get();
};
And it implements it like:

int Test::get()
{

}

And everyone knows what the problem is.

Also, it doesn't implement it in CPP file, it always pastes the implementation in header file.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Aug 20 2012 :  4:52:14 PM  Show Profile  Reply with Quote
I am not sure what you mean by "everyone knows what the problem is". The new implementation does not return anything, but if VA inserted a default return value, how could we be sure we were using a sensible default? Also, what about more complex return types?

This is how Create Implementation is designed to work, it helps, but it cannot write the code for you.

The implementation should be placed into the cpp file though. If you sit in the .h file and press Alt-O what happens? Are you working with a template class, or a normal class as shown here?

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

AjayV
Junior Member

India
23 Posts

Posted - Aug 23 2012 :  2:14:32 PM  Show Profile  Reply with Quote
Yes, I understood that return value cannot be deduced (like 1, -1, 0, 500 or false/true), and I got that complex types cannot be determined. It is good that it is up to the programmer (the compiler would complain!).

I was using it on a simple class, as shown above, no template stuff. I believe this is due to fact that I created .H and .CPP file and then tried to do it. VAX might not have got the time to parse the XXX.h with XXX.cpp. In actual larger project, where files were already there, Create Implementation perfectly placed the implementations in CPP file!

Great work!

Edited by - AjayV on Aug 23 2012 2:16:21 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Aug 24 2012 :  11:36:40 AM  Show Profile  Reply with Quote
It can take VA a few moments to detect new files, and sometimes you have to save your solution before VA is able to see and read the changes, so this might be a factor with your newly added files.

I am glad this is now working well for you, and if you have any further problems or questions please let us know, and I will do what I can to help

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