Add new mkbundle tool
[mono.git] / mcs / tools / corcompare / MissingEvent.cs
index 3f012745598d174474dc3f4e5721159039fab415..fb037c2319b29e8e1d523b569a828b9a5ba2c3f4 100644 (file)
-// Mono.Util.CorCompare.MissingEvent\r
-//\r
-// Author(s):\r
-//   Nick Drochak (ndrochak@gol.com)\r
-//\r
-// (C) 2001-2002 Nick Drochak\r
-\r
-using System;\r
-using System.Reflection;\r
-\r
-namespace Mono.Util.CorCompare {\r
-\r
-       /// <summary>\r
-       ///     Represents a class event that is completely missing\r
-       /// </summary>\r
-       /// <remarks>\r
-       ///     created by - Nick\r
-       ///     created on - 2/24/2002 10:43:57 PM\r
-       /// </remarks>\r
-       class MissingEvent : IMissingMember {\r
-               // e.g. <method name="Equals" status="missing"/>\r
-               MemberInfo mInfo;\r
-\r
-               public MissingEvent(MemberInfo info) {\r
-                       mInfo = info;\r
-               }\r
-\r
-               public string Name {\r
-                       get {\r
-                               return mInfo.Name;\r
-                       }\r
-               }\r
-\r
-               public virtual string Status {\r
-                       get {\r
-                               return "missing";\r
-                       }\r
-               }\r
-\r
-               public string Type {\r
-                       get {\r
-                               return "event";\r
-                       }\r
-               }\r
-       }\r
-}\r
+// 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;
+               }
+       }
+}