Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Toshok <toshok@novell.com>2007-12-27 21:28:51 +0300
committerChris Toshok <toshok@novell.com>2007-12-27 21:28:51 +0300
commit80257d8f114a6b818ffb02cd2d4a4a5e09d2b87a (patch)
tree96c9e6846c1458ee81a8b486dcf24aebe9b72870 /gui-compare/MasterMetadata.cs
parentb065dc0858ea755320f0fcc27fd22b20fee6e787 (diff)
* CecilMetadata.cs: rename Utils to CecilUtils. Also, fix the broken
logic that was resulting in private properties being included in the list of properties (and therefore showing up as extras). * MasterMetadata.cs: abstract out a lot of the list creation stuff into a Utils class, like we do in CecilMetadata.cs Call it MasterUtils. svn path=/trunk/mono-tools/; revision=91958
Diffstat (limited to 'gui-compare/MasterMetadata.cs')
-rw-r--r--gui-compare/MasterMetadata.cs280
1 files changed, 156 insertions, 124 deletions
diff --git a/gui-compare/MasterMetadata.cs b/gui-compare/MasterMetadata.cs
index c0842bbb..8b442484 100644
--- a/gui-compare/MasterMetadata.cs
+++ b/gui-compare/MasterMetadata.cs
@@ -7,6 +7,73 @@ using Gtk;
namespace GuiCompare {
+ static class MasterUtils {
+ public static void PopulateMethodList (XMLMethods methods, List<CompNamed> method_list)
+ {
+ foreach (object key in methods.keys.Keys) {
+ XMLMethods.SignatureFlags signatureFlags = (methods.signatureFlags != null &&
+ methods.signatureFlags.ContainsKey (key) ?
+ (XMLMethods.SignatureFlags) methods.signatureFlags [key] :
+ XMLMethods.SignatureFlags.None);
+
+ XMLParameters parameters = (methods.parameters == null ? null
+ : (XMLParameters)methods.parameters[key]);
+ XMLGenericMethodConstraints genericConstraints = (methods.genericConstraints == null ? null
+ : (XMLGenericMethodConstraints)methods.genericConstraints[key]);
+ XMLAttributes attributes = (methods.attributeMap == null ? null
+ : (XMLAttributes)methods.attributeMap[key]);
+ method_list.Add (new MasterMethod ((string)methods.keys[key],
+ signatureFlags,
+ parameters,
+ genericConstraints,
+ attributes));
+ }
+ }
+
+ public static void PopulateMemberLists (XMLClass xml_cls,
+ List<CompNamed> interface_list,
+ List<CompNamed> constructor_list,
+ List<CompNamed> method_list,
+ List<CompNamed> property_list,
+ List<CompNamed> field_list,
+ List<CompNamed> event_list)
+ {
+ if (interface_list != null && xml_cls.interfaces != null) {
+ foreach (object i in xml_cls.interfaces.keys.Keys) {
+ interface_list.Add (new MasterInterface ((string)xml_cls.interfaces.keys[i]));
+ }
+ }
+
+ if (constructor_list != null && xml_cls.constructors != null) {
+ PopulateMethodList (xml_cls.constructors, constructor_list);
+ }
+
+ if (method_list != null && xml_cls.methods != null) {
+ PopulateMethodList (xml_cls.methods, method_list);
+ }
+
+ if (property_list != null && xml_cls.properties != null) {
+ foreach (object key in xml_cls.properties.keys.Keys) {
+ property_list.Add (new MasterProperty ((string)xml_cls.properties.keys[key],
+ (XMLMethods)xml_cls.properties.nameToMethod[key]));
+ }
+ }
+
+ if (field_list != null && xml_cls.fields != null) {
+ foreach (object key in xml_cls.fields.keys.Keys) {
+ field_list.Add (new MasterField ((string)xml_cls.fields.keys[key]));
+ }
+ }
+
+ if (event_list != null && xml_cls.events != null) {
+ foreach (object key in xml_cls.events.keys.Keys) {
+ event_list.Add (new MasterEvent ((string)xml_cls.events.keys[key],
+ (string)xml_cls.events.eventTypes[key]));
+ }
+ }
+ }
+ }
+
public class MasterAssembly : CompAssembly {
public MasterAssembly (string path)
: base (path)
@@ -46,7 +113,7 @@ namespace GuiCompare {
else if (cls.type == "delegate")
delegate_list.Add (new MasterDelegate (cls));
else if (cls.type == "interface")
- interface_list.Add (new MasterInterface (cls.name));
+ interface_list.Add (new MasterInterface (cls));
else if (cls.type == "struct")
struct_list.Add (new MasterClass (cls, CompType.Struct));
}
@@ -87,45 +154,64 @@ namespace GuiCompare {
}
public class MasterInterface : CompInterface {
+ public MasterInterface (XMLClass xml_cls)
+ : base (xml_cls.name)
+ {
+ interfaces = new List<CompNamed>();
+ constructors = new List<CompNamed>();
+ methods = new List<CompNamed>();
+ properties = new List<CompNamed>();
+ fields = new List<CompNamed>();
+ events = new List<CompNamed>();
+
+ MasterUtils.PopulateMemberLists (xml_cls,
+ interfaces,
+ constructors,
+ methods,
+ properties,
+ fields,
+ events);
+ }
+
public MasterInterface (string name)
: base (name)
{
+ interfaces = new List<CompNamed>();
+ constructors = new List<CompNamed>();
+ methods = new List<CompNamed>();
+ properties = new List<CompNamed>();
+ fields = new List<CompNamed>();
+ events = new List<CompNamed>();
}
public override List<CompNamed> GetInterfaces ()
{
- // XXX
- return new List<CompNamed>();
+ return interfaces;
}
public override List<CompNamed> GetMethods ()
{
- // XXX
- return new List<CompNamed>();
+ return methods;
}
public override List<CompNamed> GetConstructors ()
{
- // XXX
- return new List<CompNamed>();
+ return constructors;
}
public override List<CompNamed> GetProperties()
{
- // XXX
- return new List<CompNamed>();
+ return properties;
}
public override List<CompNamed> GetFields()
{
- // XXX
- return new List<CompNamed>();
+ return fields;
}
public override List<CompNamed> GetEvents()
{
- // XXX
- return new List<CompNamed>();
+ return events;
}
public override List<CompNamed> GetAttributes ()
@@ -133,6 +219,13 @@ namespace GuiCompare {
// XXX
return new List<CompNamed>();
}
+
+ List<CompNamed> interfaces;
+ List<CompNamed> constructors;
+ List<CompNamed> methods;
+ List<CompNamed> properties;
+ List<CompNamed> fields;
+ List<CompNamed> events;
}
public class MasterDelegate : CompDelegate {
@@ -150,18 +243,22 @@ namespace GuiCompare {
: base (cls.name)
{
xml_cls = cls;
+
+ fields = new List<CompNamed>();
+
+ MasterUtils.PopulateMemberLists (xml_cls,
+ null,
+ null,
+ null,
+ null,
+ fields,
+ null);
+
}
public override List<CompNamed> GetFields()
{
- List<CompNamed> rv = new List<CompNamed>();
- if (xml_cls.fields != null) {
- foreach (object key in xml_cls.fields.keys.Keys) {
- rv.Add (new MasterField ((string)xml_cls.fields.keys[key]));
- }
- }
-
- return rv;
+ return fields;
}
public override List<CompNamed> GetAttributes ()
@@ -170,7 +267,7 @@ namespace GuiCompare {
return new List<CompNamed>();
}
-
+ List<CompNamed> fields;
XMLClass xml_cls;
}
@@ -179,101 +276,51 @@ namespace GuiCompare {
: base (cls.name, type)
{
xml_cls = cls;
+
+ interfaces = new List<CompNamed>();
+ constructors = new List<CompNamed>();
+ methods = new List<CompNamed>();
+ properties = new List<CompNamed>();
+ fields = new List<CompNamed>();
+ events = new List<CompNamed>();
+
+ MasterUtils.PopulateMemberLists (xml_cls,
+ interfaces,
+ constructors,
+ methods,
+ properties,
+ fields,
+ events);
}
public override List<CompNamed> GetInterfaces ()
{
- List<CompNamed> rv = new List<CompNamed>();
-
- if (xml_cls.interfaces != null) {
- foreach (object i in xml_cls.interfaces.keys.Keys) {
- rv.Add (new MasterInterface ((string)xml_cls.interfaces.keys[i]));
- }
- }
-
-
- return rv;
+ return interfaces;
}
public override List<CompNamed> GetMethods()
{
- List<CompNamed> rv = new List<CompNamed>();
- if (xml_cls.methods != null) {
- foreach (object key in xml_cls.methods.keys.Keys) {
- XMLMethods.SignatureFlags signatureFlags = (xml_cls.methods.signatureFlags != null &&
- xml_cls.methods.signatureFlags.ContainsKey (key) ?
- (XMLMethods.SignatureFlags) xml_cls.methods.signatureFlags [key] :
- XMLMethods.SignatureFlags.None);
-
- XMLParameters parameters = (xml_cls.methods.parameters == null ? null
- : (XMLParameters)xml_cls.methods.parameters[key]);
- XMLGenericMethodConstraints genericConstraints = (xml_cls.methods.genericConstraints == null ? null
- : (XMLGenericMethodConstraints)xml_cls.methods.genericConstraints[key]);
- XMLAttributes attributes = (xml_cls.methods.attributeMap == null ? null
- : (XMLAttributes)xml_cls.methods.attributeMap[key]);
- rv.Add (new MasterMethod ((string)xml_cls.methods.keys[key],
- signatureFlags,
- parameters,
- genericConstraints,
- attributes));
- }
- }
-
- return rv;
+ return methods;
}
public override List<CompNamed> GetConstructors()
{
- List<CompNamed> rv = new List<CompNamed>();
- if (xml_cls.constructors != null) {
- foreach (object key in xml_cls.constructors.keys.Keys) {
- rv.Add (new MasterMethod ((string)xml_cls.constructors.keys[key],
- (XMLConstructors.SignatureFlags)xml_cls.constructors.signatureFlags[key],
- (XMLParameters)xml_cls.constructors.parameters[key],
- (XMLGenericMethodConstraints)xml_cls.constructors.genericConstraints[key],
- (XMLAttributes)xml_cls.constructors.attributeMap[key]));
- }
- }
-
- return rv;
+ return constructors;
}
public override List<CompNamed> GetProperties()
{
- List<CompNamed> rv = new List<CompNamed>();
- if (xml_cls.properties != null) {
- foreach (object key in xml_cls.properties.keys.Keys) {
- rv.Add (new MasterProperty ((string)xml_cls.properties.keys[key],
- (XMLMethods)xml_cls.properties.nameToMethod[key]));
- }
- }
-
- return rv;
+ return properties;
}
public override List<CompNamed> GetFields()
{
- List<CompNamed> rv = new List<CompNamed>();
- if (xml_cls.fields != null) {
- foreach (object key in xml_cls.fields.keys.Keys) {
- rv.Add (new MasterField ((string)xml_cls.fields.keys[key]));
- }
- }
-
- return rv;
+ return fields;
}
public override List<CompNamed> GetEvents()
{
- List<CompNamed> rv = new List<CompNamed>();
- if (xml_cls.events != null) {
- foreach (object key in xml_cls.events.keys.Keys) {
- rv.Add (new MasterEvent ((string)xml_cls.events.keys[key],
- (string)xml_cls.events.eventTypes[key]));
- }
- }
-
- return rv;
+ return events;
}
public override List<CompNamed> GetAttributes ()
@@ -316,7 +363,14 @@ namespace GuiCompare {
}
XMLClass xml_cls;
- }
+
+ List<CompNamed> interfaces;
+ List<CompNamed> constructors;
+ List<CompNamed> methods;
+ List<CompNamed> properties;
+ List<CompNamed> fields;
+ List<CompNamed> events;
+}
public class MasterEvent : CompEvent {
public MasterEvent (string name,
@@ -347,10 +401,12 @@ namespace GuiCompare {
}
public class MasterProperty : CompProperty {
- public MasterProperty (string name, XMLMethods methods)
+ public MasterProperty (string name, XMLMethods xml_methods)
: base (name)
- {
- this.methods = methods;
+ {
+ methods = new List<CompNamed>();
+
+ MasterUtils.PopulateMethodList (xml_methods, methods);
}
public override List<CompNamed> GetAttributes ()
@@ -361,36 +417,12 @@ namespace GuiCompare {
public override List<CompNamed> GetMethods()
{
- List<CompNamed> method_list = new List<CompNamed>();
-
- if (methods != null) {
- foreach (object key in methods.keys.Keys) {
- XMLMethods.SignatureFlags signatureFlags = (methods.signatureFlags != null &&
- methods.signatureFlags.ContainsKey (key) ?
- (XMLMethods.SignatureFlags) methods.signatureFlags [key] :
- XMLMethods.SignatureFlags.None);
-
- XMLParameters parameters = (methods.parameters == null ? null
- : (XMLParameters)methods.parameters[key]);
- XMLGenericMethodConstraints genericConstraints = (methods.genericConstraints == null ? null
- : (XMLGenericMethodConstraints)methods.genericConstraints[key]);
- XMLAttributes attributes = (methods.attributeMap == null ? null
- : (XMLAttributes)methods.attributeMap[key]);
- method_list.Add (new MasterMethod ((string)methods.keys[key],
- signatureFlags,
- parameters,
- genericConstraints,
- attributes));
- }
- }
-
- return method_list;
+ return methods;
}
-
- XMLMethods methods;
+
+ List<CompNamed> methods;
}
- // XXX more stuff is needed here besides the name
public class MasterMethod : CompMethod {
public MasterMethod (string name,
XMLMethods.SignatureFlags signatureFlags,