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:
authorJoel Martinez <joelmartinez@gmail.com>2017-09-28 23:20:38 +0300
committerJoel Martinez <joelmartinez@gmail.com>2017-10-02 23:41:00 +0300
commit8822f7729c04ba22acbe9a9f1141d181ed725b6a (patch)
tree83f3e3c99e6cca9a1080c003e5c273e86eb1be8a /mdoc/Mono.Documentation/Updater/Frameworks/FrameworkTypeEntry.cs
parente7b7f22e6a82a7ec02962b8a18700fe4616839df (diff)
mdoc: reformatting the MDocUpdater source code.
We are changing our coding standards, and starting with the update subcommand. This moves many classes into their own code files and namespaces to better organize the source code.
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) { }
+ }
+ }
+}