~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ikvm/debugger/win/TargetType.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Collections.Generic;
 
3
using System.Text;
 
4
using Debugger.MetaData;
 
5
 
 
6
namespace ikvm.debugger.win
 
7
{
 
8
    internal class TargetType
 
9
    {
 
10
        private static int typeIdCounter;
 
11
        private static Dictionary<int, TargetType> typeList = new Dictionary<int, TargetType>();
 
12
 
 
13
        private readonly int typeId;
 
14
        private readonly DebugType type;
 
15
 
 
16
        internal TargetType(DebugType type)
 
17
        {
 
18
            this.typeId = ++typeIdCounter;
 
19
            this.type = type;
 
20
            typeList.Add(typeId, this);
 
21
        }
 
22
 
 
23
        internal static TargetType GetTargetType(int typeId)
 
24
        {
 
25
            return typeList[typeId];
 
26
        }
 
27
 
 
28
        internal int TypeId
 
29
        {
 
30
            get { return typeId; }
 
31
        }
 
32
 
 
33
        internal bool Identical(DebugType type)
 
34
        {
 
35
            return this.type.Equals(type);
 
36
        }
 
37
 
 
38
        internal String GetJniSignature()
 
39
        {
 
40
            //TODO if it is not a class
 
41
            return 'L' + type.Name.Replace('.', '/') + ';';
 
42
        }
 
43
 
 
44
        internal IList<TargetMethod> GetMethods()
 
45
        {
 
46
            List<TargetMethod> result = new List<TargetMethod>();
 
47
            IList<MethodInfo> methods = type.GetMethods(BindingFlags.All);
 
48
            foreach (MethodInfo method in methods)
 
49
            {
 
50
                result.Add(new TargetMethod(method));
 
51
            }
 
52
            return result;
 
53
        }
 
54
    }
 
55
 
 
56
 
 
57
}