Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Create wrapper

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
Dusan Posted - Jun 07 2012 : 06:34:06 AM
Lets say I have a class foo and I need its wrapper.

foo looks as follows:

class foo
{
  public foo (int arg1, long arg2)
  {
    // constructor code
  }

  public int GetInt()
  {
    return 0;
  }

  public void DoSomething(bool useful)
  {
    useSomehow(useful);
  }
  
  double m_doubleProperty = 0;
  public double DoubleProperty 
  { 
    get { return m_doubleProperty; } 
    set { m_doubleProperty = value; } 
  }
}


If I rightClick on 'foo' and choose Create wrapper, VAX should do:

class fooWrapper
{
  private foo;
  public fooWrapper(int arg1, long arg2)
  {
    this.foo = new foo(arg1, arg2);
  }

  public int GetInt()
  {
    return foo.GetInt();
  }

  public void DoSomething(bool useful)
  {
    foo.DoSomething(useful);
  }

  public double DoubleProperty 
  { 
    get { return foo.DoubleProperty; } 
    set { foo.DoubleProperty = value; } 
  }
}

Dusan
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jun 08 2012 : 9:12:54 PM
Doing this when working with sealed classes makes sense. I have put in a feature request to see what our developers make of this:

case=67156
Dusan Posted - Jun 08 2012 : 01:49:31 AM
I use this usually when I need to call some code before any method is called in original class and class is sealed (not inheritable). As a good example is Console class usable in Windows Vista Service, where Write function is better to check if environment is interactive.
For example:

ServiceConsole
{
  public void Write(string value)
  { 
    if (Environment.UserInteractive)
      Console.Write(value);
  }
}


Also when I need reference type from value type.

For example:
struct Point
{
  public int x;
  public int y;
}

// As I am C++ programmer, this is what I need often
// as pointers are missing in 'safe' C# :) 
class RefPoint
{
  public Point pt = new Point();
  public int x 
  {
    get { return pt.x; }
    set { pt.x = value; }
  }
  public int y 
  {
    get { return pt.y; }
    set { pt.y = value; }
  }
}


This all should VAX be able to do.

Dusan

feline Posted - Jun 07 2012 : 9:48:06 PM
Is this something you do often? I can see how doing this manually is going to be quite slow, I am just wondering how useful this refactoring command would be.

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