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
24 /// The name of the element (eg "System.Xml")
26 public abstract string Name { get ; }
29 /// The type of the element (eg "namespace")
31 public abstract string Type { get; }
34 /// Generates an XmlElement describint this element
36 /// <param name="doc">The document in which to create the element</param>
37 /// <returns></returns>
38 public virtual XmlElement CreateXML (XmlDocument doc)
40 XmlElement eltMissing = doc.CreateElement (Type);
41 eltMissing.SetAttribute ("name", Name);
42 eltMissing.SetAttribute ("status", Status);
46 /// The CompletionType of this element (eg Missing)
48 public virtual CompletionTypes Completion
50 get { return CompletionTypes.Missing; }
54 /// A textual representation of this element's completion
56 public virtual string Status
62 case CompletionTypes.Missing:
64 case CompletionTypes.Todo:
66 case CompletionTypes.Complete:
69 throw new Exception ("Invalid CompletionType: "+Completion.ToString ());
75 /// Creates an XmlElement grouping together a set of sub-elements
77 /// <param name="name">the name of the element to create</param>
78 /// <param name="rgMembers">a list of sub-elements</param>
79 /// <param name="ci">the completion info (unused)</param>
80 /// <param name="doc">the document in which to create the element</param>
81 /// <returns></returns>
82 public static XmlElement CreateMemberCollectionElement (string name, ArrayList rgMembers, CompletionInfo ci, XmlDocument doc)
84 XmlElement element = null;
85 if (rgMembers != null && rgMembers.Count > 0)
87 element = doc.CreateElement(name);
88 CompletionInfo ciMember = new CompletionInfo ();
89 foreach (MissingBase mm in rgMembers)
91 element.AppendChild (mm.CreateXML (doc));
92 ciMember.Add (mm.Completion);
94 ciMember.SetAttributes (element);