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
 Create from Usage with Singleton Pattern
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Vertexwahn
Senior Member

35 Posts

Posted - Nov 14 2010 :  5:29:01 PM  Show Profile  Reply with Quote
The "Create from Usage" feature doesn't work with a singletons - see here for an example:


int bar = 5;
MySingleton::getInstance().foobar(5);


Now right click on foobar and try to choose "Create from Usage" -> not possible

It would be great to have this feature some day in VisualAssistX

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Nov 15 2010 :  3:21:48 PM  Show Profile  Reply with Quote
I've tried a very simple snippet and it is working for me using 1833 or 1836:

class singleton 
{
	//[...]
	static singleton* gObject;
	static singleton* Get() {return gObject;}
	//[...]
};

void func()
{
	singleton::Get()->CreateNewMethod();
}


What Visual Assist and Visual Studio version are you using?
Can you please try if you can reproduce the problem with 1836?
http://www.wholetomato.com/downloads/default.asp
We have fixed some Create From Usage related issues like "Create from Usage offers the correct options when invoked on a method with whitespace before the opening parenthesis." (from history page: http://www.wholetomato.com/support/history.asp)
If you are still seeing the problem with the latest version, can you please post a simple example where Create From Usage fails? You may use singletons differently.
Go to Top of Page

Vertexwahn
Senior Member

35 Posts

Posted - Nov 15 2010 :  6:32:37 PM  Show Profile  Reply with Quote
I am currently using Version 10.6.1830.0 with Visual Studio 2010 Ultimate

your example is working in my environment

but it fails if you put the singleton in a namespace, like this:


namespace Foobar 
{
	class singleton 
	{
	public:
		static singleton* gObject;
		static singleton* Get() {return gObject;}
	};
}

void func()
{
	Foobar::singleton::Get()->CreateNewMethod();
}


Now "Create from Usage" doesn't working. Sorry I forgot to mention, that the singleton resides in a namespace.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Nov 16 2010 :  03:50:38 AM  Show Profile  Reply with Quote
I am seeing the same effect now, thank you for the example. I have put in a bug report for this:

case=52335
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Nov 22 2010 :  3:36:55 PM  Show Profile  Reply with Quote
case=52335 is fixed in build 1837

Whole Tomato Software, Inc.
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