1 // Mono.Util.CorCompare.MissingBase
4 // Piers Haken (piersh@friskit.com)
6 // (C) 2001-2002 Piers Haken
9 using System.Reflection;
10 using System.Collections;
12 namespace Mono.Util.CorCompare
15 /// Base class for all comparison items
18 /// created by - Piersh
19 /// created on - 3/3/2002 10:23:24 AM
21 public abstract class MissingBase
23 protected NodeStatus m_nodeStatus;
24 protected ArrayList rgAttributes;
25 protected NodeStatus nsAttributes;
28 /// The name of the element (eg "System.Xml")
30 public abstract string Name { get ; }
33 /// The type of the element (eg "namespace")
35 public abstract string Type { get; }
38 /// Generates an XmlElement describint this element
40 /// <param name="doc">The document in which to create the element</param>
41 /// <returns></returns>
42 public virtual XmlElement CreateXML (XmlDocument doc)
44 XmlElement eltMissing = doc.CreateElement (Type);
45 eltMissing.SetAttribute ("name", Name);
46 //Status.status.SetAttributes (eltMissing);
47 Status.SetAttributes (eltMissing);
49 XmlElement eltAttributes = MissingBase.CreateMemberCollectionElement ("attributes", rgAttributes, nsAttributes, doc);
50 if (eltAttributes != null)
51 eltMissing.AppendChild (eltAttributes);
56 public virtual NodeStatus Status
58 get { return m_nodeStatus; }
61 public abstract NodeStatus Analyze ();
64 /// Creates an XmlElement grouping together a set of sub-elements
66 /// <param name="name">the name of the element to create</param>
67 /// <param name="rgMembers">a list of sub-elements</param>
68 /// <param name="doc">the document in which to create the element</param>
69 /// <returns></returns>
70 public static XmlElement CreateMemberCollectionElement (string name, ArrayList rgMembers, NodeStatus ns, XmlDocument doc)
72 XmlElement element = null;
73 if (rgMembers != null && rgMembers.Count > 0)
75 element = doc.CreateElement(name);
76 foreach (MissingBase mm in rgMembers)
77 element.AppendChild (mm.CreateXML (doc));
79 //ns.SetAttributes (element);
83 protected void AddFakeAttribute (bool fMono, bool fMS, string strName)
87 MissingAttribute ma = new MissingAttribute (
88 (fMono) ? strName : null,
89 (fMS) ? strName : null);
91 rgAttributes.Add (ma);
92 nsAttributes.AddChildren (ma.Status);