1 // Mono.Util.CorCompare.MissingProperty
4 // Nick Drochak (ndrochak@gol.com)
6 // (C) 2001-2002 Nick Drochak
9 using System.Reflection;
13 namespace Mono.Util.CorCompare {
16 /// Represents a missing property from a class
20 /// created on - 2/20/2002 10:43:57 PM
22 class MissingProperty : MissingMember
24 // e.g. <property name="Length" status="missing"/>
25 public MissingProperty (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
27 public override string Type
29 get { return "property"; }
32 protected MissingMethod mmGet;
33 protected MissingMethod mmSet;
35 public override NodeStatus Analyze ()
37 m_nodeStatus = base.Analyze ();
39 PropertyInfo piMono = (PropertyInfo) mInfoMono;
40 PropertyInfo piMS = (PropertyInfo) mInfoMS;
42 MemberInfo miGetMono, miSetMono;
44 miGetMono = miSetMono = null;
47 miGetMono = piMono.GetGetMethod ();
48 miSetMono = piMono.GetSetMethod ();
51 MemberInfo miGetMS, miSetMS;
53 miGetMS = miSetMS = null;
56 miGetMS = piMS.GetGetMethod ();
57 miSetMS = piMS.GetSetMethod ();
60 if (miGetMono != null || miGetMS != null)
62 mmGet = new MissingMethod (miGetMono, miGetMS);
63 m_nodeStatus.AddChildren (mmGet.Analyze ());
65 if (miSetMono != null || miSetMS != null)
67 mmSet = new MissingMethod (miSetMono, miSetMS);
68 m_nodeStatus.AddChildren (mmSet.Analyze ());
71 if (piMono != null && piMS != null)
73 string strTypeMono = piMono.PropertyType.FullName;
74 string strTypeMS = piMS.PropertyType.FullName;
75 if (strTypeMono != strTypeMS)
76 Status.AddWarning ("Invalid type: is '"+strTypeMono+"', should be '"+strTypeMS+"'");
82 public override XmlElement CreateXML (XmlDocument doc)
84 XmlElement eltMember = base.CreateXML (doc);
86 if (mInfoMono != null) // missing
88 if (mmGet != null || mmSet != null)
90 XmlElement eltAccessors = doc.CreateElement ("accessors");
91 eltMember.AppendChild (eltAccessors);
95 XmlElement eltGet = mmGet.CreateXML (doc);
96 eltAccessors.AppendChild (eltGet);
100 XmlElement eltSet = mmSet.CreateXML (doc);
101 eltAccessors.AppendChild (eltSet);