Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Create member functions in the Class Definition

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
Kram Posted - Oct 08 2021 : 12:42:37 PM
Is there an option to tell the Create Method feature to create the new member function within the class definition and not outside the class using the scope resolution operator?
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Oct 08 2021 : 1:54:46 PM
OK, first issue first. I think I am seeing the same behaviour, and there is a simple "fix".

I have a class, declared in "test_simple.h", with the implementations in "test_simple.cpp", class called "simpleTestClass"

In a different file I have the function:

void usingSimpleClass()
{
	simpleTestClass localFoo;
	localFoo.NewMember(34, 23);
}

triggering "Create Method" on "NewMember" gives me the create method dialog. When I use this the declaration goes into the header file and the implementation into the cpp file. In the cpp file I can now place the caret into the method name and trigger "Move Implementation to Class Declaration", which does exactly that.

The idea behind VA's refactoring commands is to have fairly simple and well defined actions that can be chained together to achieve your final result. So this is done in two steps rather than asking, during the creation, where you want the implementation to be placed.

I am not seeing any obvious problems renaming the new function in this example.

I used undo to get rid of the created method, created it again, and renamed it to be "NewMemberOrange" in the dialog. This created valid code, confirmed by compiling it successfully. The unknown method call failed, but that was expected.

Can you reproduce the invalid code easily and on demand?
Kram Posted - Oct 08 2021 : 1:30:41 PM
There are three files: class header, class implementation and an other source file.

The other source file uses a variable that is a class from the header.

If I try to call a member function that does not exist there is a red squiggle and I have the Create Method <name method> option available from Alt-Shift-Q. This creates the implementation outside of the class.

As a second issue, I have just notice that invalid code is created if I try to change the name of the new member function from within the dialog.
feline Posted - Oct 08 2021 : 12:49:48 PM
I am going to need to know what you are doing to be able to answer properly.

Sitting in a header file, with a simple class, I placed the caret into the class name, at the top of the class declaration, and use Alt-Shift-Q to open VA's refactoring context menu. From here I selected "Add Member..." and added a new member function to the class.

VA inserted this into the class declaration, complete with its empty body. Which seems to be what you are after, but I assume not what you are getting.

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