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
 1538: Refactoring: Rename
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

khb
Tomato Guru

Germany
337 Posts

Posted - Oct 09 2006 :  07:57:55 AM  Show Profile  Reply with Quote
I used the rename functionality on a template class in order to rename it from Array to HArray. It didn't work correctly for functions that take the class as parameter:
template <class T>
class HArray {
  HArray(const Array<T>&);
  HArray<T>& operator = (const Array<T>&);
  ...
}
As you can see, the parameter types are still Array and not HArray.

VC6, Win XP, no further add-ins.

Regards,
Marcus.

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Oct 09 2006 :  1:44:04 PM  Show Profile  Reply with Quote
confirmed

case=2911

interestingly, if you put spaces in the parameter types, changing from "Array<T>" to "Array <T>" VA finds and renames Array in the parameter list.

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

khb
Tomato Guru

Germany
337 Posts

Posted - Oct 09 2006 :  3:49:56 PM  Show Profile  Reply with Quote
So, we have a workaround:

1.) Rename all "<" to " <"
2.) Use refactoring as usual



Regards,
Marcus.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Oct 10 2006 :  08:35:22 AM  Show Profile  Reply with Quote
*experiments* if you want to be clever about it, then use the following regular expression search and replace. I have done a couple of basic tests in VC6 and it seems to work correctly:

find = \\([^ ]\\)<
replace with = \\1 <

this should only insert the space before < if there is no space there already

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

khb
Tomato Guru

Germany
337 Posts

Posted - Oct 10 2006 :  10:55:20 AM  Show Profile  Reply with Quote
Yeah, but it might still conflict with the << operator.

Regards,
Marcus.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Oct 10 2006 :  2:46:42 PM  Show Profile  Reply with Quote
I have just tried it here and it was "safe" on the line:

T operator<<(const Array<T>&);


simply inserting two spaces. I do agree though, any form of search and replace can have unexpected side effects.

for some reason VC6 disables the "Find next" button on the find and replace dialog when doing a replace only on the selected code, so that removes the one really safe method, to use the dialog to step through the code considering each change before making it *sigh*

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

khb
Tomato Guru

Germany
337 Posts

Posted - Oct 11 2006 :  02:23:09 AM  Show Profile  Reply with Quote
Yes, here are some side effects:
  T operator <<(const Array<T>&);
  cerr << "Error!" << endl;
is converted to
  T operator < <(const Array <T>&);
  cerr < < "Error!" < < endl;
And, yes, search and replace sometimes sucks...

Regards,
Marcus.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Oct 11 2006 :  12:52:17 PM  Show Profile  Reply with Quote
*oops* a small tweak to the regular expression fixes this specific problem. however a "trial and error" approach is not brilliant:

find = \\([^ <]\\)<
replace with = \\1 <

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

khb
Tomato Guru

Germany
337 Posts

Posted - Oct 12 2006 :  02:03:34 AM  Show Profile  Reply with Quote
Much better now! Works at least for my problem.

Regards,
Marcus.
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