Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MissingEvent.cs « corcompare « tools « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fb037c2319b29e8e1d523b569a828b9a5ba2c3f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Mono.Util.CorCompare.MissingEvent
//
// Author(s):
//   Nick Drochak (ndrochak@gol.com)
//
// (C) 2001-2002 Nick Drochak

using System;
using System.Reflection;
using System.Xml;

namespace Mono.Util.CorCompare {

	/// <summary>
	/// 	Represents a class event that is completely missing
	/// </summary>
	/// <remarks>
	/// 	created by - Nick
	/// 	created on - 2/24/2002 10:43:57 PM
	/// </remarks>
	class MissingEvent : MissingMember {
		// e.g. <method name="Equals" status="missing"/>
		public MissingEvent (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
		MissingMethod mmAdd;
		MissingMethod mmRemove;
		MissingMethod mmRaise;

		public override string Type {
			get {
				return "event";
			}
		}

		public override NodeStatus Analyze ()
		{
			m_nodeStatus = base.Analyze ();

			EventInfo eiMono = (EventInfo) mInfoMono;
			EventInfo eiMS   = (EventInfo) mInfoMS;

			MemberInfo miAddMono, miRemoveMono, miRaiseMono;
			if (eiMono == null)
				miAddMono = miRemoveMono = miRaiseMono = null;
			else
			{
				miAddMono = eiMono.GetAddMethod ();
				miRemoveMono = eiMono.GetRemoveMethod ();
				miRaiseMono = eiMono.GetRaiseMethod ();
			}

			MemberInfo miAddMS, miRemoveMS, miRaiseMS;
			if (eiMS == null)
				miAddMS = miRemoveMS = miRaiseMS = null;
			else
			{
				miAddMS = eiMS.GetAddMethod ();
				miRemoveMS = eiMS.GetRemoveMethod ();
				miRaiseMS = eiMS.GetRaiseMethod ();
			}

			if (miAddMono != null || miAddMS != null)
			{
				mmAdd = new MissingMethod (miAddMono, miAddMS);
				m_nodeStatus.AddChildren (mmAdd.Analyze ());
			}
			if (miRemoveMono != null || miRemoveMS != null)
			{
				mmRemove = new MissingMethod (miRemoveMono, miRemoveMS);
				m_nodeStatus.AddChildren (mmRemove.Analyze ());
			}
			if (miRaiseMono != null || miRaiseMS != null)
			{
				mmRaise = new MissingMethod (miRemoveMono, miRemoveMS);
				m_nodeStatus.AddChildren (mmRaise.Analyze ());
			}
			return m_nodeStatus;
		}

		public override XmlElement CreateXML (XmlDocument doc)
		{
			XmlElement eltMember = base.CreateXML (doc);

			if (mInfoMono != null && mmRaise != null)
			{
				XmlElement eltAccessors = (XmlElement) eltMember.SelectSingleNode ("accessors");
				if (eltAccessors == null)
				{
					eltAccessors = doc.CreateElement ("accessors");
					eltMember.AppendChild (eltAccessors);
				}
				if (mmAdd != null)
				{
					XmlElement eltAdd = mmAdd.CreateXML (doc);
					eltAccessors.AppendChild (eltAdd);
				}
				if (mmRemove != null)
				{
					XmlElement eltRemove = mmRemove.CreateXML (doc);
					eltAccessors.AppendChild (eltRemove);
				}
				if (mmRaise != null)
				{
					XmlElement eltRaise = mmRaise.CreateXML (doc);
					eltAccessors.AppendChild (eltRaise);
				}
			}
			return eltMember;
		}
	}
}