// Mono.Util.CorCompare.MissingBase // // Author(s): // Piers Haken (piersh@friskit.com) // // (C) 2001-2002 Piers Haken using System; using System.Xml; using System.Reflection; using System.Collections; namespace Mono.Util.CorCompare { /// /// Base class for all comparison items /// /// /// created by - Piersh /// created on - 3/3/2002 10:23:24 AM /// public abstract class MissingBase { /// /// The name of the element (eg "System.Xml") /// public abstract string Name { get ; } /// /// The type of the element (eg "namespace") /// public abstract string Type { get; } /// /// Generates an XmlElement describint this element /// /// The document in which to create the element /// public virtual XmlElement CreateXML (XmlDocument doc) { XmlElement eltMissing = doc.CreateElement (Type); eltMissing.SetAttribute ("name", Name); eltMissing.SetAttribute ("status", Status); return eltMissing; } /// /// The CompletionType of this element (eg Missing) /// public virtual CompletionTypes Completion { get { return CompletionTypes.Missing; } } /// /// A textual representation of this element's completion /// public virtual string Status { get { switch (Completion) { case CompletionTypes.Missing: return "missing"; case CompletionTypes.Todo: return "todo"; case CompletionTypes.Complete: return "complete"; default: throw new Exception ("Invalid CompletionType: "+Completion.ToString ()); } } } /// /// Creates an XmlElement grouping together a set of sub-elements /// /// the name of the element to create /// a list of sub-elements /// the completion info (unused) /// the document in which to create the element /// public static XmlElement CreateMemberCollectionElement (string name, ArrayList rgMembers, CompletionInfo ci, XmlDocument doc) { XmlElement element = null; if (rgMembers != null && rgMembers.Count > 0) { element = doc.CreateElement(name); CompletionInfo ciMember = new CompletionInfo (); foreach (MissingBase mm in rgMembers) { element.AppendChild (mm.CreateXML (doc)); ciMember.Add (mm.Completion); } ciMember.SetAttributes (element); } return element; } } }