Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1538: Refactoring: Rename

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
khb Posted - Oct 09 2006 : 07:57:55 AM
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.
8   L A T E S T    R E P L I E S    (Newest First)
khb Posted - Oct 12 2006 : 02:03:34 AM
Much better now! Works at least for my problem.

Regards,
Marcus.
feline Posted - Oct 11 2006 : 12:52:17 PM
*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 <
khb Posted - Oct 11 2006 : 02:23:09 AM
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.
feline Posted - Oct 10 2006 : 2:46:42 PM
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*
khb Posted - Oct 10 2006 : 10:55:20 AM
Yeah, but it might still conflict with the << operator.

Regards,
Marcus.
feline Posted - Oct 10 2006 : 08:35:22 AM
*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
khb Posted - Oct 09 2006 : 3:49:56 PM
So, we have a workaround:

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



Regards,
Marcus.
feline Posted - Oct 09 2006 : 1:44:04 PM
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.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000