Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Improvements for "Implement Virtual Methods..."

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
Vertexwahn Posted - Feb 08 2014 : 3:19:37 PM

class Base
{
public:
  virtual void foo() = 0;
};


"Implement Virtual Methods..." generates this code:


class Derived
{
  virtual void foo()
  {
    throw std::exception("The method or operation is not implemented.");
  }
};


From http://stackoverflow.com/questions/1569726/difference-stdruntime-error-vs-stdexception:
"std::exception is the class whose only purpose is to serve as the base class in the exception hierarchy. It has no other uses. In other words, conceptually it is an abstract class"

Throw std::runtime_error instead of std::exception!

Otherwise gcc generates errors like "std::exception" is abstract...

Add a checkbox that adds the override keyword to an overwritten virtual method

Example:

class Derived2
{
  virtual void foo() override
  {
    throw std::runtime_error("The method or operation is not implemented.");
  }
};
4   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Apr 15 2014 : 9:24:35 PM
To try and keep our options dialog fairly manageable, some less frequently used settings are exposed via registry keys. We keep an eye on this, and settings that get a lot of interest tend to be moved into the options dialog over time. This is not a setting that a lot of people ask about. Not the perfect way of judging its interest level, but its a start.
jschroedl Posted - Apr 15 2014 : 12:37:23 PM
Wow, pretty obscure. I added this but feel it should not require a regedit to turn this on.
feline Posted - Feb 11 2014 : 4:25:40 PM
The generated function body has been fixed in VA 1940 and above, the new default function body for C++ is now:

throw std::logic_error("The method or operation is not implemented.");

but we are not replacing your existing VA Snippet, so for now you will need to edit the VA Snippet "Refactor Create From Usage Method Body" as Dusan says.


To automatically add the override keyword simply set a simple registry value, as explained here:

https://wholetomato.fogbugz.com/default.asp?W346
Dusan Posted - Feb 10 2014 : 03:48:42 AM
quote:
Originally posted by Vertexwahn
Example:

class Derived2
{
  virtual void foo() override
  {
    throw std::runtime_error("The method or operation is not implemented.");
  }
};




You can change the behavior of refactoring by editing VA Snippets:
http://docs.wholetomato.com/default.asp?W258

You may want to use refactoring reserved strings.
http://docs.wholetomato.com/default.asp?W262

HTH

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