**** Merged from MCS ****
[mono-project.git] / mcs / tools / corcompare / MissingEvent.cs
blobfb037c2319b29e8e1d523b569a828b9a5ba2c3f4
1 // Mono.Util.CorCompare.MissingEvent
2 //
3 // Author(s):
4 // Nick Drochak (ndrochak@gol.com)
5 //
6 // (C) 2001-2002 Nick Drochak
8 using System;
9 using System.Reflection;
10 using System.Xml;
12 namespace Mono.Util.CorCompare {
14 /// <summary>
15 /// Represents a class event that is completely missing
16 /// </summary>
17 /// <remarks>
18 /// created by - Nick
19 /// created on - 2/24/2002 10:43:57 PM
20 /// </remarks>
21 class MissingEvent : MissingMember {
22 // e.g. <method name="Equals" status="missing"/>
23 public MissingEvent (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
24 MissingMethod mmAdd;
25 MissingMethod mmRemove;
26 MissingMethod mmRaise;
28 public override string Type {
29 get {
30 return "event";
34 public override NodeStatus Analyze ()
36 m_nodeStatus = base.Analyze ();
38 EventInfo eiMono = (EventInfo) mInfoMono;
39 EventInfo eiMS = (EventInfo) mInfoMS;
41 MemberInfo miAddMono, miRemoveMono, miRaiseMono;
42 if (eiMono == null)
43 miAddMono = miRemoveMono = miRaiseMono = null;
44 else
46 miAddMono = eiMono.GetAddMethod ();
47 miRemoveMono = eiMono.GetRemoveMethod ();
48 miRaiseMono = eiMono.GetRaiseMethod ();
51 MemberInfo miAddMS, miRemoveMS, miRaiseMS;
52 if (eiMS == null)
53 miAddMS = miRemoveMS = miRaiseMS = null;
54 else
56 miAddMS = eiMS.GetAddMethod ();
57 miRemoveMS = eiMS.GetRemoveMethod ();
58 miRaiseMS = eiMS.GetRaiseMethod ();
61 if (miAddMono != null || miAddMS != null)
63 mmAdd = new MissingMethod (miAddMono, miAddMS);
64 m_nodeStatus.AddChildren (mmAdd.Analyze ());
66 if (miRemoveMono != null || miRemoveMS != null)
68 mmRemove = new MissingMethod (miRemoveMono, miRemoveMS);
69 m_nodeStatus.AddChildren (mmRemove.Analyze ());
71 if (miRaiseMono != null || miRaiseMS != null)
73 mmRaise = new MissingMethod (miRemoveMono, miRemoveMS);
74 m_nodeStatus.AddChildren (mmRaise.Analyze ());
76 return m_nodeStatus;
79 public override XmlElement CreateXML (XmlDocument doc)
81 XmlElement eltMember = base.CreateXML (doc);
83 if (mInfoMono != null && mmRaise != null)
85 XmlElement eltAccessors = (XmlElement) eltMember.SelectSingleNode ("accessors");
86 if (eltAccessors == null)
88 eltAccessors = doc.CreateElement ("accessors");
89 eltMember.AppendChild (eltAccessors);
91 if (mmAdd != null)
93 XmlElement eltAdd = mmAdd.CreateXML (doc);
94 eltAccessors.AppendChild (eltAdd);
96 if (mmRemove != null)
98 XmlElement eltRemove = mmRemove.CreateXML (doc);
99 eltAccessors.AppendChild (eltRemove);
101 if (mmRaise != null)
103 XmlElement eltRaise = mmRaise.CreateXML (doc);
104 eltAccessors.AppendChild (eltRaise);
107 return eltMember;