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
 Technical Support
 Move Implementation to Source File problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mnd
Senior Member

42 Posts

Posted - Jul 24 2006 :  06:24:00 AM  Show Profile  Reply with Quote
Hello,

I'm using the latest beta 1530, I've a problem with the "Move Implementation to Source File" refactor method.

We have this class:

class CFoo
{
public:
CFoo() {}

void ApplyBar() {
fInt = 10;
}

protected:
int fInt;
};


in a .cpp file already and selecting the ApplyBar method, couldn't get the move implementation refactor menu entry.

What I want to achieve is:

class CFoo
{
public:
CFoo() {}

void ApplyBar();

protected:
int fInt;
};

void CFoo::ApplyBar() {
fInt = 10;
}


I can't remember well but one of the earliest beta was working well.

Kindest Regards,

- mn


VA_X.dll file version 10.3.1530.0 built 2006.07.08
Licensed to:
VA X: [email protected] (1-user license) Support ends 2007.01.13
VAOpsWin.dll version 1.3.3.4
VATE.dll version 1.0.5.7
DevEnv.exe version 7.10.3077.0
msenv.dll version 7.10.3077.0
Font: ProFontWindows 15(Pixels)
Comctl32.dll version 5.82.2900.2180
Windows XP 5.1 Build 2600 Service Pack 2
Single processor

Platform: Custom
Stable Includes:
c:\\program files\\microsoft visual studio .net 2003\\vc7\\include;
c:\\program files\\microsoft visual studio .net 2003\\vc7\\atlmfc\\include;
c:\\program files\\microsoft visual studio .net 2003\\vc7\\PlatformSDK\\include\\prerelease;
c:\\program files\\microsoft visual studio .net 2003\\vc7\\PlatformSDK\\include;
c:\\program files\\microsoft visual studio .net 2003\\sdk\\v1.1\\include;
%ADOBESDK402%\\source\\public\\includes;
%ADOBESDK402%\\source\\public\\interfaces\\architecture;
%ADOBESDK402%\\source\\public\\interfaces\\cjk;
%ADOBESDK402%\\source\\public\\interfaces\\colormgmt;
%ADOBESDK402%\\source\\public\\interfaces\\graphics;
%ADOBESDK402%\\source\\public\\interfaces\\incopy;
%ADOBESDK402%\\source\\public\\interfaces\\interactive;
%ADOBESDK402%\\source\\public\\interfaces\\interactive\\ui;
%ADOBESDK402%\\source\\public\\interfaces\\layout;
%ADOBESDK402%\\source\\public\\interfaces\\tables;
%ADOBESDK402%\\source\\public\\interfaces\\text;
%ADOBESDK402%\\source\\public\\interfaces\\ui;
%ADOBESDK402%\\source\\public\\interfaces\\utils;
%ADOBESDK402%\\source\\public\\interfaces\\workgroup;
%ADOBESDK402%\\source\\public\\interfaces\\xmedia;
%ADOBESDK402%\\source\\public\\widgets\\includes;
C:\\build\\main103\\src\\contrib\\jace\\1.1\\release\\include;

Library Includes:
c:\\program files\\microsoft visual studio .net 2003\\vc7\\atlmfc\\src\\mfc;
c:\\program files\\microsoft visual studio .net 2003\\vc7\\atlmfc\\src\\atl;
c:\\program files\\microsoft visual studio .net 2003\\vc7\\crt\\src;

Other Includes:

support
Whole Tomato Software

5566 Posts

Posted - Jul 24 2006 :  6:02:25 PM  Show Profile  Reply with Quote
Is CFoo declared in a header or does it exist only in a cpp?

Move Implementation is available only when you are in a header.
Go to Top of Page

mnd
Senior Member

42 Posts

Posted - Jul 25 2006 :  02:16:27 AM  Show Profile  Reply with Quote
CFoo is declared only in the cpp.
If would be better if the Move Implementation is available in the cpp file too, the implementation will be moved in the same source file.
What do you think?

regards,
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jul 25 2006 :  7:37:07 PM  Show Profile  Reply with Quote
interesting. i have just placed your sample class into a cpp file, using both VS2003 and VS2005 with VA 1530, and in both IDE's Move Implementation to Source File was available, and worked as you wanted, placing the body after the class.

so why does this not work for you.

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

nodet
New Member

8 Posts

Posted - Mar 08 2007 :  09:18:38 AM  Show Profile  Reply with Quote
I had the same problem as the OP, and came out with the following example. I added the code below at the end of a CPP file of a project that has many H and CPP files (actally, it seems 'Move Implementation to Source File' is not available for me if I have only one file in the MSVC project -- I am using Visual Studio 2005 with build 1548 of VAssistX).

class L {
  //void a();
  void method(){}
};
//void L::a() {}

When trying to move the 'method' out of the class definition, I got this:

class L {
  //void a();
  void method();

  void method() {

  }
};
//void L::a() {}

When uncommenting both the declaration and the definition of the 'a' method, I got the correct result:

class L {
  void a();
  void method();
};
void L::a() {}

void L::method() {

}

Hope this helps...

Xavier Nodet
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." - Benjamin Franklin, 1759.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Mar 08 2007 :  12:43:34 PM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description. The effect is the same, but in this case the trigger seems to be different.

case=5411

quote:
Originally posted by nodet

it seems 'Move Implementation to Source File' is not available for me if I have only one file in the MSVC project


do you only have a cpp file in this case? This does not really surprise me, since Move Implementation to Source File is mainly aimed at moving the Implementation from the .H file into the .CPP file, so it cannot function if there is no file to move the Implementation into.

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

nodet
New Member

8 Posts

Posted - Mar 08 2007 :  4:42:51 PM  Show Profile  Reply with Quote
quote:
Originally posted by feline

[...] Move Implementation to Source File is mainly aimed at moving the Implementation from the .H file into the .CPP file, so it cannot function if there is no file to move the Implementation into.


I had to choose a non-trivial project to do my tests since, as you mention, this does not work when there is only one CPP file in the project. But...

As it actually is able to extract a method from the class definition to put it below into the same CPP file (as my example shows), may I suggest to remove this limitation. We could then have a Move Implementation to Source File that works this way:

  • When the class is in a H file, the corresponding CPP file should exist. If not, the move is not available

  • When the class is in a CPP file, the move is always available and moves the method somewhere below the class.


Does that sound reasonable?

Thanks.

Xavier Nodet
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." - Benjamin Franklin, 1759.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Mar 09 2007 :  10:45:05 AM  Show Profile  Reply with Quote
Sounds reasonable to me.

case=5429

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

support
Whole Tomato Software

5566 Posts

Posted - Mar 17 2007 :  4:08:01 PM  Show Profile  Reply with Quote
Cases 5411 and 5429 are fixed in build 1549.

Edited by - support on Mar 17 2007 4:09:01 PM
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