Merge pull request #347 from JamesB7/master
[mono.git] / mcs / class / Mono.Debugger.Soft / Mono.Debugger.Soft / PrimitiveValue.cs
1 using System;
2 using System.Collections.Generic;
3
4 namespace Mono.Debugger.Soft
5 {
6         /*
7          * Represents a value of a primitive type in the debuggee
8          */
9         public class PrimitiveValue : Value {
10                 object value;
11
12                 public PrimitiveValue (VirtualMachine vm, object value) : base (vm, 0) {
13                         this.value = value;
14                 }
15
16                 public object Value {
17                         get {
18                                 return value;
19                         }
20                 }
21
22                 public override bool Equals (object obj) {
23                         if (value == obj)
24                                 return true;
25                         if (obj != null && obj is PrimitiveValue)
26                                 return value == (obj as PrimitiveValue).Value;
27                         return base.Equals (obj);
28                 }
29
30                 public override int GetHashCode () {
31                         return base.GetHashCode ();
32                 }
33
34                 public override string ToString () {
35                         object v = Value;
36
37                         return "PrimitiveValue<" + (v != null ? v.ToString () : "(null)") + ">";
38                 }
39
40                 public Value InvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments) {
41                         return ObjectMirror.InvokeMethod (vm, thread, method, this, arguments, InvokeOptions.None);
42                 }
43
44                 public Value InvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options) {
45                         return ObjectMirror.InvokeMethod (vm, thread, method, this, arguments, options);
46                 }
47
48                 public IAsyncResult BeginInvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
49                         return ObjectMirror.BeginInvokeMethod (vm, thread, method, this, arguments, options, callback, state);
50                 }
51
52                 public Value EndInvokeMethod (IAsyncResult asyncResult) {
53                         return ObjectMirror.EndInvokeMethodInternal (asyncResult);
54                 }
55         }
56 }