Beispiel #1
0
        private void DocumentQtProperty(Declaration property)
        {
            if (!this.propertyNodes.ContainsKey(property.OriginalName))
            {
                return;
            }
            var qualifiedName = property.GetQualifiedName(decl => decl.OriginalName, decl => decl.Namespace);
            var node          = this.propertyNodes[property.OriginalName].Find(c => c.FullName == qualifiedName);

            if (node != null && node.HRef != null)
            {
                var link = node.HRef.Split('#');
                var file = link[0];
                if (this.membersDocumentation.ContainsKey(file))
                {
                    var typeDocs    = this.membersDocumentation[file];
                    var key         = $"{property.OriginalName}-prop";
                    var containsKey = typeDocs.ContainsKey(key);
                    if (!containsKey)
                    {
                        key         = property.OriginalName;
                        containsKey = typeDocs.ContainsKey(key);
                    }
                    if (containsKey)
                    {
                        var docs  = typeDocs[key];
                        var start = docs.FindIndex(n => n.InnerText == "Access functions:");
                        start = start >= 0 ? start : docs.FindIndex(n => n.InnerText == "Notifier signal:");
                        var end = docs.FindLastIndex(n => n.Name == "div");
                        if (start >= 0 && end >= 0)
                        {
                            for (var i = end; i >= start; i--)
                            {
                                docs.RemoveAt(i);
                            }
                            if (string.IsNullOrWhiteSpace(docs[start - 1].OuterHtml))
                            {
                                docs.RemoveAt(start - 1);
                            }
                        }
                        var text = ConstructDocumentText(docs.Skip(1));
                        property.Comment = new RawComment {
                            BriefText = StripTags(text)
                        };
                    }
                }
            }
        }
Beispiel #2
0
 private void DocumentQtProperty(Declaration property)
 {
     if (!this.propertyNodes.ContainsKey(property.Name))
     {
         return;
     }
     var qualifiedName = property.GetQualifiedName(decl => decl.OriginalName, decl => decl.Namespace);
     var node = this.propertyNodes[property.Name].Find(
         c => c.Attribute("fullname").Value == qualifiedName);
     if (node != null && node.Attribute("href") != null)
     {
         var link = node.Attribute("href").Value.Split('#');
         var file = link[0];
         if (this.membersDocumentation.ContainsKey(file))
         {
             var typeDocs = this.membersDocumentation[file];
             var key = string.Format("{0}-prop", property.Name);
             var containsKey = typeDocs.ContainsKey(key);
             if (!containsKey)
             {
                 key = property.Name;
                 containsKey = typeDocs.ContainsKey(key);
             }
             if (containsKey)
             {
                 var docs = typeDocs[key];
                 var start = docs.FindIndex(n => n.InnerText == "Access functions:");
                 start = start >= 0 ? start : docs.FindIndex(n => n.InnerText == "Notifier signal:");
                 var end = docs.FindLastIndex(n => n.Name == "div");
                 if (start >= 0 && end >= 0)
                 {
                     for (var i = end; i >= start; i--)
                     {
                         docs.RemoveAt(i);
                     }
                     if (string.IsNullOrWhiteSpace(docs[start - 1].OuterHtml))
                     {
                         docs.RemoveAt(start - 1);
                     }
                 }
                 var text = ConstructDocumentText(docs.Skip(1));
                 property.Comment = new RawComment { BriefText = StripTags(text) };
             }
         }
     }
 }