Merge pull request #1099 from jsportaro/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
26                         var primitive = obj as PrimitiveValue;
27                         if (primitive != null)
28                                 return value == primitive.Value;
29
30                         return base.Equals (obj);
31                 }
32
33                 public override int GetHashCode () {
34                         return base.GetHashCode ();
35                 }
36
37                 public override string ToString () {
38                         object v = Value;
39
40                         return "PrimitiveValue<" + (v != null ? v.ToString () : "(null)") + ">";
41                 }
42
43                 public Value InvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments) {
44                         return ObjectMirror.InvokeMethod (vm, thread, method, this, arguments, InvokeOptions.None);
45                 }
46
47                 public Value InvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options) {
48                         return ObjectMirror.InvokeMethod (vm, thread, method, this, arguments, options);
49                 }
50
51                 public IAsyncResult BeginInvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
52                         return ObjectMirror.BeginInvokeMethod (vm, thread, method, this, arguments, options, callback, state);
53                 }
54
55                 public Value EndInvokeMethod (IAsyncResult asyncResult) {
56                         return ObjectMirror.EndInvokeMethodInternal (asyncResult);
57                 }
58         }
59 }