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

github.com/mono/api-doc-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mdoc/Mono.Documentation/Updater/Frameworks/FrameworkTypeEntry.cs')
-rw-r--r--mdoc/Mono.Documentation/Updater/Frameworks/FrameworkTypeEntry.cs80
1 files changed, 80 insertions, 0 deletions
diff --git a/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkTypeEntry.cs b/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkTypeEntry.cs
new file mode 100644
index 00000000..67bcee86
--- /dev/null
+++ b/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkTypeEntry.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using Mono.Cecil;
+using Mono.Cecil.Rocks;
+
+namespace Mono.Documentation.Updater.Frameworks
+{
+ class FrameworkTypeEntry : IComparable<FrameworkTypeEntry>
+ {
+ SortedSet<string> members = new SortedSet<string> ();
+ SortedSet<string> memberscsharpsig = new SortedSet<string> ();
+
+ ILFullMemberFormatter formatter = new ILFullMemberFormatter ();
+
+ FrameworkEntry fx;
+
+ public static FrameworkTypeEntry Empty = new EmptyTypeEntry (FrameworkEntry.Empty) { Name = "Empty" };
+
+ public FrameworkTypeEntry (FrameworkEntry fx)
+ {
+ this.fx = fx;
+ }
+
+ public string Id { get; set; }
+ public string Name { get; set; }
+ public string Namespace { get; set; }
+ public FrameworkEntry Framework { get { return fx; } }
+
+ public ISet<string> Members {
+ get {
+ return this.members;
+ }
+ }
+
+ public virtual void ProcessMember (MemberReference member)
+ {
+ var resolvedMember = member.Resolve ();
+ if (resolvedMember != null) {
+ var docid = DocCommentId.GetDocCommentId (resolvedMember);
+ members.Add (docid);
+ }
+ else
+ members.Add (member.FullName);
+
+ // this is for lookup purposes
+ try {
+ memberscsharpsig.Add(formatter.GetDeclaration(member));
+ }
+ catch {}
+ }
+
+ public bool ContainsCSharpSig (string sig)
+ {
+ return memberscsharpsig.Contains (sig);
+ }
+
+ public override string ToString () => $"{this.Name} in {this.fx.Name}";
+
+ public int CompareTo (FrameworkTypeEntry other)
+ {
+ if (other == null) return -1;
+ if (this.Name == null) return 1;
+
+ return string.Compare (this.Name, other.Name, StringComparison.CurrentCulture);
+ }
+
+ public override bool Equals (object obj)
+ {
+ FrameworkTypeEntry other = obj as FrameworkTypeEntry;
+ if (other == null) return false;
+ return this.Name.Equals (other.Name);
+ }
+
+ class EmptyTypeEntry : FrameworkTypeEntry
+ {
+ public EmptyTypeEntry (FrameworkEntry fx) : base (fx) { }
+ public override void ProcessMember (MemberReference member) { }
+ }
+ }
+}