private void ParsePackages()
        {
            this.currentFileName = this.IndexFile;
            HtmlDocument document = new HtmlDocument();
            try
            {
                document.Load(currentFileName);
            }
            catch (Exception)
            {
                this.Log(LogKind.Error, "Can't open " + this.currentFileName + ".");
                return;
            }
            HtmlNode root = document.DocumentNode;

            // Get the HtmlNode, what represents the html tag
            HtmlNode htmlnode = root.ChildNodes.First(node => node.Name == "html");
            // Get the node, what represents the head tag
            HtmlNode headNode = null;
            try
            {
                headNode = htmlnode.ChildNodes.First(node => node.Name == "head");
            }
            // If the aren't any head tag, than the html is invalid or corrupted
            catch(InvalidOperationException)
            {
                this.Log(LogKind.Error, "Missing head tag in the html. Program is terminating.");
                return;
            }
            // Find the comment, where the version of the javadoc was writen
            HtmlNode versionnode = headNode.ChildNodes.First(node => node.Name == "#comment");
            String version = versionnode.InnerHtml;
            version = version.Split('(', ')')[1];
            this.Index.Version = version;

            HtmlNode bodyNode = null;
            try
            {
                bodyNode = htmlnode.ChildNodes.First(node => node.Name == "body");
            }
            // If the aren't any body tag, than the html is invalid or corrupted
            catch (InvalidOperationException)
            {
                this.Log(LogKind.Error, "Missing body tag in the html. Program is terminating.");
                return;
            }
            // Get the div tag, what contains the informations about the packages
            HtmlNode packageDivNode = null;
            try
            {
                packageDivNode = bodyNode.ChildNodes.First(node => node.Name == "div" && node.Attributes.FirstOrDefault(attr => attr.Name == "class" && attr.Value =="contentContainer")!=null);
            }
            // If the program can't find the package, than it exit with error.
            catch (InvalidOperationException)
            {
                this.Log(LogKind.Error, "Can't find the packages. Program is terminating.");
                return;
            }
            // Get the table, where is the data of the packages.
            HtmlNode packageTableNode = null;
            try
            {
                packageTableNode = packageDivNode.ChildNodes.First(node => node.Name == "table").ChildNodes.First(node => node.Name == "tbody");
            }
            catch (InvalidOperationException)
            {
                this.Log(LogKind.Error, "Can't find the data of the packages. Program is terminating.");
                return;
            }
            foreach (var packagerow in packageTableNode.ChildNodes.Where(node => node.Name == "tr"))
            {
                HtmlNode[] datas = packagerow.ChildNodes.Where(node => node.Name == "td").ToArray();
                CompoundIndex ci = new CompoundIndex();
                this.Index.Compounds.Add(ci);
                ci.Name = datas[0].ChildNodes.ElementAt(0).InnerHtml;
                ci.Identifier = ci.Name;
                ci.Kind = CompoundKind.Namespace;

                DoxNamespace c = new DoxNamespace();
                c.Identifier = ci.Identifier;
                c.Name = ci.Name;
                c.Kind = ci.Kind;

                this.ProcessPackages.Add(datas[0].ChildNodes.ElementAt(0).Attributes.ElementAt(0).Value);
                // NEED TO CHANGE!
                HtmlNode desc = datas[1].ChildNodes.FirstOrDefault(node => node.Name == "div" && node.Attributes.FirstOrDefault(attr => attr.Name == "class" && attr.Value == "block") != null);
                if(desc != null)
                {
                    String Description = normalizeHtml(desc.InnerText);
                    DocPara newPara = new DocPara();
                    DocText desc_text = new DocText();
                    desc_text.Text = Description;
                    newPara.Commands.Add(desc_text);
                    c.Description.Paragraphs.Add(newPara);
                }

                ci.Compound = c;

                this.Model.Compounds.Add(c);
                this.Index.CompoundIndexRefs.Add(ci.Identifier, ci);
                this.Model.CompoundRefs.Add(ci.Identifier, ci.Compound);
            }
            this.Log(LogKind.Info, "Processing of " + this.currentFileName + " has ended.");
        }
 public void addPararaphToFirstSection(DocPara newParagraph)
 {
     this.firstSection.Paragraphs.Add(newParagraph);
 }
 private Description getDescription(HtmlNode descNode)
 {
     Description retDescription = new Description();
     DocPara dp = new DocPara();
     DocText dt = new DocText();
     DocPara newPara;
     foreach (HtmlNode childnode in descNode.ChildNodes.Where(c => c.InnerText != "\r\n"))
     {
         switch (childnode.Name)
         {
             case "#text":
                 //if (newParagraph == true)
                 //{
                 //    newPara = new DocPara();
                 //    dt = new DocText();
                 //    dt.TextKind = DocTextKind.Plain;
                 //    dt.Text = childnode.InnerText.Replace("\r\n \r\n", "\n");
                 //    newPara.Commands.Add(dt);
                 //    dp.Commands.Add(newPara);
                 //    newParagraph = false;
                 //}
                 //else
                 //{
                     dt = new DocText();
                     dt.TextKind = DocTextKind.Plain;
                     dt.Text = childnode.InnerText.Replace("\r\n \r\n", "\n");
                     dp.Commands.Add(dt);
                 //}
                 break;
             case "dt":
                 newPara = new DocPara();
                 dt = new DocText();
                 dt.TextKind = DocTextKind.Verbatim;
                 dt.Text = childnode.InnerText.Replace("\r\n \r\n", "\n");
                 newPara.Commands.Add(dt);
                 dp.Commands.Add(newPara);
                 break;
             case "span":
                 dt = new DocText();
                 dt.TextKind = DocTextKind.Verbatim;
                 dt.Text = childnode.InnerText.Replace("\r\n \r\n", "\n");
                 dp.Commands.Add(dt);
                 break;
             case "code":
             case "i":
                 DocMarkup dm = new DocMarkup();
                 dm.MarkupKind = DocMarkupKind.Emphasis;
                 dt = new DocText();
                 dt.TextKind = DocTextKind.Plain;
                 dt.Text = childnode.InnerText.Replace("\r\n \r\n", "\n");
                 dm.Commands.Add(dt);
                 dp.Commands.Add(dm);
                 break;
             case "dd":
             case "div":
                 Description partialDescription = this.getDescription(childnode);
                 DocPara partialPara = new DocPara();
                 partialPara.Commands.AddRange(partialDescription.Paragraphs[0].Commands);
                 dp.Commands.Add(partialPara);
                 break;
             case "p":
                 newPara = new DocPara();
                 dp.Commands.Add(newPara);
                 //newParagraph = true;
                 break;
             case "a":
                 String path = childnode.Attributes[0].Value.Replace("../", string.Empty);
                 String package = path.Split('/')[0];
                 String obj = path.Replace(".html", string.Empty).Split('/')[1];
                 DocReference dref = new DocReference();
                 DocText dtx = new DocText();
                 newPara = new DocPara();
                 dtx.TextKind = DocTextKind.Plain;
                 if (path.Split('/').Length == 3)
                 {
                     String member = path.Split('/')[2];
                     dref.Member = this.Model.MemberRefs.Single(c => c.Key == package + "_" + obj + "_" + member).Value;
                     dtx.Text = member;
                 }
                 else
                 {
                     dref.Compound = this.Model.Compounds.Single(c => c.Identifier == package + "_" + obj);
                     dtx.Text = obj;
                 }
                 dref.Commands.Add(dtx);
                 dp.Commands.Add(dref);
                 break;
             case "pre":
                 dm = new DocMarkup();
                 dm.MarkupKind = DocMarkupKind.Emphasis;
                 dt = new DocText();
                 dt.TextKind = DocTextKind.Plain;
                 dt.Text = WebUtility.HtmlDecode(childnode.InnerText);
                 dm.Commands.Add(dt);
                 dp.Commands.Add(dm);
                 break;
             default:
                 break;
         }
     }
     retDescription.Paragraphs.Add(dp);
     return retDescription;
 }
 public void printInterfaces(bool detailed, DoxNamespace ns=null, List<DoxClassifier> Ininterfaces=null)
 {
     List<DoxClassifier> interfaces = null;
     if (Ininterfaces == null && ns != null)
     {
         interfaces = ns.Classifiers.Where(dc => dc.Kind == CompoundKind.Interface && dc.Members.Count > 0).OrderBy(c => c.Name).ToList();
     }
     else if(Ininterfaces != null)
     {
         interfaces = Ininterfaces;
     }
     else
     {
         Log("Error DPrint-2: printInterfaces method should get a Namespace or list of classifiers");
     }
     DocSect parentSect = this.currentsection;
     DocSect ds = new DocSect();
     DocTable dt = new DocTable();
     if (detailed == false)
     {
         ds.Title = "Interfaces: ";
         ds.Identifier = "";
         DocPara dp = new DocPara();
         ds.Paragraphs.Add(dp);
         dt.ColCount = 2;
         dt.RowCount = interfaces.Count + 1;
         header_row(dt);
         this.currentTable = dt;
     }
     foreach (DoxInterface di in interfaces)
     {
         if (di.Members.Count > 0)
         {
             printClassifier(di, detailed);
         }
     }
     if (detailed == false)
     {
         DocPara dp = new DocPara();
         dp.Commands.Add(dt);
         ds.Paragraphs.Add(dp);
         if (parentSect != null)
         {
             parentSect.Sections.Add(ds);
             this.currentsection = parentSect;
         }
         else
         {
             this.PrintDocCmd(ds);
         }
         this.currentTable = null;
     }
 }
        public void printMember(DoxMember dm, bool detailed)
        {
            DocTable dtable = null;
            if(detailed == true && dm.DetailedDescription == null)
            {
                return;
            }
            else if (detailed == true && dm.DetailedDescription.Paragraphs.Count == 0)
            {
                return;
            }

            if(detailed == true)
            {
                dtable = new DocTable();
                dtable.ColCount = 1;
                dtable.RowCount = 2;
            }
                DocTableRow dtr = new DocTableRow();
                DocTableCell dtc = new DocTableCell();
                DocPara dp = new DocPara();
                if (dm.ProtectionKind != null)
                {
                    DocText dt = new DocText();
                    dt.Text = dm.ProtectionKind.Value.ToString() + ' ';
                    dt.TextKind = DocTextKind.Plain;
                    dp.Commands.Add(dt);
                }
                if (dm.New == true)
                {
                    DocText dt = new DocText();
                    dt.Text = "new ";
                    dt.TextKind = DocTextKind.Plain;
                    dp.Commands.Add(dt);
                }
                if (dm.Final == true)
                {
                    DocText dt = new DocText();
                    dt.Text = "final ";
                    dt.TextKind = DocTextKind.Plain;
                    dp.Commands.Add(dt);
                }
                if (dm.Volatile == true)
                {
                    DocText dt = new DocText();
                    dt.Text = "volatile ";
                    dt.TextKind = DocTextKind.Plain;
                    dp.Commands.Add(dt);
                }
                if (dm.VirtualKind != null && dm.VirtualKind != VirtualKind.NonVirtual && dm.Kind != MemberKind.Function)
                {
                    DocText dt = new DocText();
                    dt.Text = dm.VirtualKind.ToString();
                    dt.TextKind = DocTextKind.Plain;
                    dp.Commands.Add(dt);
                }
                if (dm.Inline == true && dm.Kind != MemberKind.Function)
                {
                    DocText dt = new DocText();
                    dt.Text = "inline ";
                    dt.TextKind = DocTextKind.Plain;
                    dp.Commands.Add(dt);
                }
                if (dm.Static == true && dm.Kind != MemberKind.Function)
                {
                    DocText dt = new DocText();
                    dt.Text = "static ";
                    dt.TextKind = DocTextKind.Plain;
                    dp.Commands.Add(dt);
                }
                if (dm.Const == true)
                {
                    DocText dt = new DocText();
                    dt.Text = "contant ";
                    dt.TextKind = DocTextKind.Plain;
                    dp.Commands.Add(dt);
                }

                if (dm.Explicit == true)
                {
                    DocText dt = new DocText();
                    dt.Text = "explicit ";
                    dt.TextKind = DocTextKind.Plain;
                    dp.Commands.Add(dt);
                }

                if (dm.Definition != null)
                {
                    String[] texts = dm.Definition.Split(' ');
                    if (texts.Length > 1)
                    {
                        texts = texts.Take(texts.Count() - 1).ToArray();
                    }
                    for (int i = 0; i < texts.Length; i++ )
                    {
                        String item = texts[i];
                        item = item.Split('.').Last();
                        texts[i] = item;
                    }
                    String text = String.Join(" ", texts);
                    DocText dt = new DocText();
                    dt.Text = text;
                    dt.TextKind = DocTextKind.Plain;
                    dp.Commands.Add(dt);
                }

                if (detailed == false)
                {
                    dtc.Paragraphs.Add(dp);
                    dtr.Cells.Add(dtc);
                    dtc = new DocTableCell();
                    dp = new DocPara();
                }

                if (dm.Params.Count != 0)
                {
                    DocText dt = new DocText();
                    dt.TextKind = DocTextKind.Plain;
                    dt.Text = dm.Name + "(";
                    dp.Commands.Add(dt);
                    DocAnchor da = new DocAnchor();
                    da.Id = dm.Identifier;
                    dp.Commands.Add(da);
                    dt = new DocText();
                    dt.TextKind = DocTextKind.Plain;
                    for (int i = 0; i < dm.Params.Count; i++)
                    {
                        dt.Text = dm.Params[i].Type.Items[0].Text + " ";
                        dt.Text += dm.Params[i].DeclarationName + " ";
                        if (i != dm.Params.Count - 1)
                        {
                            dt.Text += ", ";
                        }
                    }
                    dt.Text += ")";
                    dp.Commands.Add(dt);
                }
                else if (dm.Kind == MemberKind.Function)
                {
                    DocText dt = new DocText();
                    dt.TextKind = DocTextKind.Plain;
                    dt.Text = dm.Name;
                    dp.Commands.Add(dt);
                    dt = new DocText();
                    dt.TextKind = DocTextKind.Plain;
                    dt.Text = "()";
                    dp.Commands.Add(dt);
                    DocAnchor da = new DocAnchor();
                    da.Id = dm.Identifier;
                    dp.Commands.Add(da);
                }
                else
                {
                    DocText dt = new DocText();
                    dt.TextKind = DocTextKind.Plain;
                    dt.Text = dm.Name;
                    dp.Commands.Add(dt);
                    DocAnchor da = new DocAnchor();
                    da.Id = dm.Identifier;
                    dp.Commands.Add(da);
                }
                if (detailed == false)
                {
                    if (dm.BriefDescription != null && dm.BriefDescription.Paragraphs.Count > 0)
                    {
                        dp.Commands.Add(new DocPara());
                        dp.Commands.AddRange(dm.BriefDescription.Paragraphs);
                    }
                    dtc.Paragraphs.Add(dp);
                    dtr.Cells.Add(dtc);
                    this.currentTable.Rows.Add(dtr);
                }
                else
                {
                    dtc.IsHeader = true;
                    dtc.Paragraphs.Add(dp);
                    dtr.Cells.Add(dtc);
                    dtable.Rows.Add(dtr);
                    dp = new DocPara();
                    dp.Commands.AddRange(dm.DetailedDescription.Paragraphs);
                    dtr = new DocTableRow();
                    dtc = new DocTableCell();
                    dtc.Paragraphs.Add(dp);
                    dtr.Cells.Add(dtc);
                    dtable.Rows.Add(dtr);
                    dp = new DocPara();
                    dp.Commands.Add(dtable);
                    DocSect ds = new DocSect();
                    ds.Paragraphs.Add(dp);
                    this.currentsection.Sections.Add(ds);
                }
        }
 /// <summary>
 /// Method, that responsible for the output of the fields
 /// </summary>
 /// <param name="detailed">Type of output</param>
 /// <param name="dc">If not null, than the method use the fields of this Classifier</param>
 /// <param name="InFileds">If isn't null, than the method use these fields</param>
 public void printFields(bool detailed, DoxClassifier dc=null, List<DoxMember> InFileds = null)
 {
     List<DoxMember> fields = null;
     if (InFileds == null && dc != null)
     {
         fields = dc.Members.Where(dm => dm.Kind == MemberKind.Variable).OrderBy(c => c.Name).ToList();
     }
     else if (InFileds != null)
     {
         fields = InFileds;
     }
     else
     {
        Log("Error DPrint-6: printFields method should get a DoxClassifier or list of DoxMembers");
     }
     if (fields.Count == 0)
     {
         return;
     }
     DocSect dsec = this.currentsection;
     DocSect ds = new DocSect();
     ds.Identifier = "";
     ds.Title = "Fields: ";
     DocTable dt = new DocTable();
     dt.ColCount = 2;
     dt.RowCount = fields.Count+1;
     rowindex = 1;
     header_row(dt);
     this.currentTable = dt;
     foreach (DoxField member in fields)
     {
         printField(member, false);
         rowindex++;
     }
     if (dsec != null)
     {
         DocPara dp = new DocPara();
         dp.Commands.Add(dt);
         ds.Paragraphs.Add(dp);
         dsec.Sections.Add(ds);
     }
     else
     {
         this.PrintDocCmd(ds);
     }
     if (detailed == true)
     {
         foreach (DoxField member in fields)
         {
             printField(member, true);
         }
     }
 }
        public void printInterface(DoxInterface di, bool detailed)
        {
            DocSect dsec = new DocSect();
            DocTable dt = new DocTable();
            bool endOfTable = true;
            if (detailed == false)
            {
                if (this.currentTable == null)
                {
                    dt.ColCount = 2;
                    dt.RowCount = 2;
                    header_row(dt);
                }
                else
                {
                    dt = this.currentTable;
                    endOfTable = false;
                }
                DocPara dp = new DocPara();
                dsec.Paragraphs.Add(dp);
                this.currentTable = dt;
            }
            printClassifier(di, detailed);
            if (detailed == false && endOfTable == true)
            {
                DocPara dp = new DocPara();
                dp.Commands.Add(dt);
                dsec.Paragraphs.Add(dp);
                this.PrintDocCmd(dsec);
                this.currentTable = null;

            }
        }
        public void printClassifiers(bool detailed, DoxNamespace ns = null, List<DoxClassifier> Inclassifiers = null)
        {
            List<DoxClassifier> classifiers = null;
            if (Inclassifiers == null && ns != null)
            {
                classifiers = ns.Classifiers.OrderBy(c => c.Name).ToList();
            }
            else if(Inclassifiers != null)
            {
                classifiers = Inclassifiers;
            }
            else
            {
                Log("Error DPrint-0: printClassifiers method should get a Namespace or list of classifiers");
            }
            DocSect parentSect = this.currentsection;
            DocSect ds = new DocSect();
            DocTable dt = new DocTable();
            if (detailed == false)
            {
                ds.Title = "Classifiers: ";
                ds.Identifier = "";
                DocPara dp = new DocPara();
                ds.Paragraphs.Add(dp);
                dt.ColCount = 2;
                dt.RowCount = classifiers.Count + 1;
                header_row(dt);
                this.currentTable = dt;
            }
            foreach (DoxClassifier classifier in classifiers.Where(classifier => classifier.Members.Count > 0))
            {
                printClassifier(classifier, detailed);

            }
            if (detailed == false)
            {
                DocPara dp = new DocPara();
                dp.Commands.Add(dt);
                ds.Paragraphs.Add(dp);
                if(parentSect != null)
                {
                    parentSect.Sections.Add(ds);
                    this.currentsection = parentSect;
                }
                else
                {
                    this.PrintDocCmd(ds);
                }
                this.currentTable = null;
            }
        }
 public void printEnumValues(bool detailed, DoxClassifier dev = null, List<DoxMember> InEnumVales = null)
 {
     List<DoxMember> enumValues = null;
     if (InEnumVales == null && dev != null)
     {
         enumValues = dev.Members.Where(dm => dm.Kind == MemberKind.EnumValue).OrderBy(c => c.Name).ToList();
     }
     else if (InEnumVales != null)
     {
         enumValues = InEnumVales;
     }
     else
     {
         Log("Error DPrint-8: printEnumValues method should get a DoxClassifier or list of DoxMembers");
     }
     if (enumValues.Count == 0)
     {
         return;
     }
     DocSect dsec = this.currentsection;
     DocSect ds = new DocSect();
     ds.Identifier = "";
     ds.Title = "Enum values: ";
     DocTable dt = new DocTable();
     dt.ColCount = 2;
     dt.RowCount = enumValues.Count + 1;
     rowindex = 1;
     header_row(dt);
     this.currentTable = dt;
     foreach (DoxEnumValue member in enumValues)
     {
         printEnumValue(member, false);
         rowindex++;
     }
     if (dsec != null)
     {
         DocPara dp = new DocPara();
         dp.Commands.Add(dt);
         ds.Paragraphs.Add(dp);
         dsec.Sections.Add(ds);
     }
     else
     {
         this.PrintDocCmd(ds);
     }
     if(detailed == true)
     {
         foreach (DoxEnumValue member in enumValues)
         {
             printEnumValue(member, detailed);
         }
     }
 }
예제 #10
0
 private static void header_row(DocTable dt)
 {
     DocTableRow dtr = new DocTableRow();
     DocTableCell dtc = new DocTableCell();
     dtc.IsHeader = true;
     DocPara dp = new DocPara();
     dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = " " });
     dtc.Paragraphs.Add(dp);
     dtr.Cells.Add(dtc);
     dp = new DocPara();
     dtc = new DocTableCell();
     dtc.IsHeader = true;
     dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = "Name and Description" });
     dtc.Paragraphs.Add(dp);
     dtr.Cells.Add(dtc);
     dt.Rows.Add(dtr);
 }
예제 #11
0
        public void printClassifier(DoxClassifier dc, bool detailed)
        {
            if (detailed == true)
            {
                DocSect parentSect = this.currentsection;
                string name = NormalizeName(dc.Name);
                DocSect ds = new DocSect();
                ds.Title = dc.Kind + ": " + name;
                ds.Identifier = dc.Identifier;

                // Leírás
                if (dc.BriefDescription != null && dc.BriefDescription.Paragraphs.Count > 0)
                {
                    ds.Paragraphs.AddRange(dc.BriefDescription.Paragraphs);
                }
                else if(dc.Description != null)
                {
                    ds.Paragraphs.AddRange(dc.Description.Paragraphs);
                }
                this.currentsection = ds;
                printFields(detailed,dc);
                printProperties(detailed, dc);
                printMethods(detailed, dc);
                printEnumValues(detailed, dc);
                if (parentSect != null)
                {
                    parentSect.Sections.Add(ds);
                    this.currentsection = parentSect;
                }
                else
                {
                    this.PrintDocCmd(ds);
                }
            }
            else
            {
                DocTableRow dtr = new DocTableRow();
                DocTableCell dtc = new DocTableCell();
                DocPara dp = new DocPara();
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = dc.Name });
                dtc.Paragraphs.Add(dp);
                dtr.Cells.Add(dtc);
                dp = new DocPara();
                dtc = new DocTableCell();
                if (dc.BriefDescription != null && dc.BriefDescription.Paragraphs.Count > 0)
                {
                    dtc.Paragraphs.AddRange(dc.BriefDescription.Paragraphs);
                }
                else if( dc.Description != null)
                {
                    dtc.Paragraphs.AddRange(dc.Description.Paragraphs);
                }
                dtc.Paragraphs.Add(dp);
                dtr.Cells.Add(dtc);
                this.currentTable.Rows.Add(dtr);
            }
        }
예제 #12
0
        public void printNameSpace(DoxNamespace ns, Boolean detailed)
        {
            if (detailed == true)
            {
                string name = NormalizeName(ns.Name);
                DocSect parentsec = this.currentsection;
                DocSect ds = new DocSect();
                ds.Title = "Namespace: " + name;
                ds.Identifier = ns.Identifier;
                if (ns.BriefDescription != null && ns.BriefDescription.Paragraphs.Count > 0)
                {
                    ds.Paragraphs.AddRange(ns.BriefDescription.Paragraphs);
                }
                else if(ns.Description != null)
                {
                    ds.Paragraphs.AddRange(ns.Description.Paragraphs);
                }
                this.currentsection = ds;

                this.printClasses(detailed, ns);
                this.printInterfaces(detailed, ns);
                this.printStructs(detailed, ns);
                this.printEnums(detailed, ns);

                parentsec.Sections.Add(ds);
            }
            else
            {
                DocTableRow dtr = new DocTableRow();
                DocTableCell dtc = new DocTableCell();
                DocPara dp = new DocPara();
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = ns.Name });
                dtc.Paragraphs.Add(dp);
                dtr.Cells.Add(dtc);
                dp = new DocPara();
                dtc = new DocTableCell();
                if (ns.BriefDescription != null && ns.BriefDescription.Paragraphs.Count > 0)
                {
                    dtc.Paragraphs.AddRange(ns.BriefDescription.Paragraphs);
                }
                else if(ns.Description != null)
                {
                    dtc.Paragraphs.AddRange(ns.Description.Paragraphs);
                }
                dtc.Paragraphs.Add(dp);
                dtr.Cells.Add(dtc);
                this.currentTable.Rows.Add(dtr);
            }
        }
예제 #13
0
        public void printNameScapes(Boolean detailed, List<Compound> inList = null)
        {
            List<Compound> NameSpaces;
            if (inList == null)
            {
                NameSpaces = Model.Compounds.Where(comp => comp.Kind == CompoundKind.Namespace).OrderBy(ns => ns.Name).ToList();

            }
            else
            {
                NameSpaces = inList;
            }
            DocSect ds = new DocSect();
            DocTable dt = new DocTable();
            this.currentsection = ds;
            if (detailed == false)
            {
                ds.Title = "Namespaces: ";
                ds.Identifier = "";
                DocPara dp = new DocPara();
                ds.Paragraphs.Add(dp);
                dt.ColCount = 2;
                dt.RowCount = NameSpaces.Count + 1;
                header_row(dt);
                this.currentTable = dt;
            }
            foreach (DoxNamespace Namespace in NameSpaces)
            {
                if (Namespace.Classifiers.Count > 0)
                {
                    this.printNameSpace(Namespace, detailed);
                }
            }
            if(detailed == false)
            {
                DocPara dp = new DocPara();
                dp.Commands.Add(dt);
                ds.Paragraphs.Add(dp);
                this.currentTable = null;
            }
            this.PrintDocCmd(ds);
        }
예제 #14
0
        public void printMembers(bool detailed, DoxClassifier dc=null, List<DoxMember> InMembers =null)
        {
            List<DoxMember> members = null;
            if (InMembers == null && dc != null)
            {
                members = dc.Members.OrderBy(c => c.Name).ToList();
            }
            else if (InMembers != null)
            {
                members = InMembers;
            }
            else
            {
                Log("Error DPrint-5: printMembers method should get a DoxClassifier or list of DoxMembers");
            }

            if(members.Count == 0)
            {
                return;
            }
            DocSect dsec = this.currentsection;
            DocSect ds = new DocSect();
            ds.Identifier = "";
            ds.Title = "Members: ";
            DocTable dt = new DocTable();
            dt.ColCount = 2;
            dt.RowCount = members.Count+1;
            rowindex = 1;
            header_row(dt);
            this.currentTable = dt;
            this.currentsection = ds;
            foreach (DoxMember member in members)
            {
                printMember(member,detailed);
                rowindex++;
            }
            if(dsec != null)
            {
                DocPara dp = new DocPara();
                dp.Commands.Add(dt);
                ds.Paragraphs.Add(dp);
                dsec.Sections.Add(ds);
                this.currentsection = dsec;
            }
            else
            {
                this.PrintDocCmd(ds);
            }
        }
        static void GetTruePropertys(DoxMember m, DocTableRow dtr, DocTable des)
        {
            DocPara dp = new DocPara();
            DocTableCell dtc = new DocTableCell(); //! Cell of the table
            DocTableRow desdtr = new DocTableRow(); //! First row of the description
            DocTableCell desdtc = new DocTableCell(); //! Cell of the description

            if (m.ProtectionKind != null)
            {
                dp.Commands.Add(new DocText()
                {
                    TextKind = DocTextKind.Plain,
                    Text = m.ProtectionKind.Value.ToString() + ' '
                });
            }
            if(m.New == true)
            {
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = "New " });
            }
            if (m.Final == true)
            {
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = "Final " });
            }
            if(m.Volatile == true)
            {
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = "Volatile " });
            }
            if(m.VirtualKind != null && m.VirtualKind != VirtualKind.NonVirtual)
            {
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = m.VirtualKind.ToString()+ ' ' });
            }
            if (m.Inline == true && m.Kind != MemberKind.Function)
            {
                 dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = "Inline " });
            }
            if (m.Static == true)
            {
                dp.Commands.Add(new DocText()
                {
                    TextKind = DocTextKind.Plain,
                    Text = "Static "
                });
            }
            if (m.Const == true)
            {
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = "Constant " });
            }

            if (m.Explicit == true)
            {
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = "Explicit  "});
            }

            if(m.Definition != null)
            {
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = m.Definition });
            }
            dtc.Paragraphs.Add(dp); //Add the data of the first columb
            dtr.Cells.Add(dtc);
            DocPara dp_des = new DocPara();
            foreach (var cmd in dp.Commands)
            {
                dp_des.Commands.Add(cmd);
            }

            dtc = new DocTableCell();
            dp = new DocPara();

            if (m.Params.Count != 0)
            {
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = m.Name + "(" });
                dp.Commands.Add(new DocAnchor() { Id = m.Identifier });

                for (int i = 0; i < m.Params.Count; i++)
                {
                    dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = m.Params[i].Type.Items[0].Text + " " });
                    dp.Commands.Add(new DocText()
                    {
                        TextKind = DocTextKind.Plain,
                        Text = m.Params[i].DeclarationName + " "
                    });
                    if (i != m.Params.Count - 1)
                    {
                        dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = ", " });
                    }
                }
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = ")" });
            }
            else if (m.Kind == MemberKind.Function)
            {
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = m.Name });
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = "()" });
                dp.Commands.Add(new DocAnchor() { Id = m.Identifier });
            }
            else
            {
                dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = m.Name });
                dp.Commands.Add(new DocAnchor() { Id = m.Identifier });
            }
            foreach (var cmd in dp.Commands)
            {
                dp_des.Commands.Add(cmd);
            }
            dtc.Paragraphs.Add(dp);
            desdtc.Paragraphs.Add(dp_des);
            desdtc.IsHeader = true;
            desdtr.Cells.Add(desdtc);
            des.Rows.Add(desdtr);

            dp = new DocPara();
            dp_des = new DocPara();
            desdtc = new DocTableCell();
            desdtr = new DocTableRow();

            if (m.BriefDescription != null && m.BriefDescription.Paragraphs.Count != 0)
            {
                for (int i = 0; i < m.BriefDescription.Paragraphs.Count; i++)
                {
                    dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = "\n" });
                    for (int j = 0; j < m.BriefDescription.Paragraphs[i].Commands.Count; j++)
                    {
                        dp.Commands.Add(m.BriefDescription.Paragraphs[i].Commands[j]);
                    }
                }
                if (m.DetailedDescription != null && m.DetailedDescription.Paragraphs.Count != 0)
                {
                    for (int i = 0; i < m.DetailedDescription.Paragraphs.Count; i++)
                    {
                        for (int j = 0; j < m.DetailedDescription.Paragraphs[i].Commands.Count; j++)
                        {
                            dp_des.Commands.Add(m.DetailedDescription.Paragraphs[i].Commands[j]);
                        }
                    }
                }
            }
            else if (m.DetailedDescription != null && m.DetailedDescription.Paragraphs.Count != 0)
            {
                for (int i = 0; i < m.DetailedDescription.Paragraphs.Count; i++)
                {
                    for (int j = 0; j < m.DetailedDescription.Paragraphs[i].Commands.Count; j++)
                    {
                        if (m.Kind != MemberKind.Function)
                        {
                            dp.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = "\n" });
                            dp.Commands.Add(m.DetailedDescription.Paragraphs[i].Commands[j]);
                        }
                        dp_des.Commands.Add(m.DetailedDescription.Paragraphs[i].Commands[j]);
                    }
                }
            }
            dtc.Paragraphs.Add(dp);
            dtr.Cells.Add(dtc);
            if (dp_des.Commands.Count == 0)
            {
                des.ColCount = 0;
                return;
            }
            desdtc.Paragraphs.Add(dp_des);
            desdtr.Cells.Add(desdtc);
            des.Rows.Add(desdtr);
        }
        void IApiDocTemplateProcessor.Process(MethodListTemplate template)
        {
            //((IApiDocTemplateProcessor)this).Process((MemberListTemplate)template);
            if (this.currentClassifier == null) return;
            List<DoxMember> members = this.currentClassifier.Members.ToList();
            members.RemoveAll(m => !SelectMember(m, template));
            members = members.OrderBy(m => m.Kind).ThenBy(m => m.Name).ToList();
            List<DocTable> tables = new List<DocTable>();
            DocPara dpara = new DocPara();
            DocTable dt = new DocTable();
            header_row(dt);
            foreach (var m in members)
            {
                DocTable desdt = new DocTable(); //! DocTable to the description
                desdt.RowCount = 2;
                desdt.ColCount = 1;
                DocTableRow dtr = new DocTableRow();
                if (members.Count > 0)
                {
                    dt.RowCount = members.Count+1;
                }
                else
                {
                    break;
                }
                dt.ColCount = 2;
                this.currentMember = m;
                GetTruePropertys(m, dtr,desdt);
                dt.Rows.Add(dtr);
                if (desdt.ColCount != 0)
                {
                    tables.Add(desdt);
                }
                template.ProcessItems(this);
                this.currentMember = null;

            }
            if (members.Count > 0)
            {
                generator.PrintDocCmd(dt);
                dpara.Commands.Add(new DocText() { TextKind = DocTextKind.Plain, Text = "" });
                generator.PrintDocCmd(dpara);
                System.Threading.Thread.Sleep(100);
                for (int i = 0; i < tables.Count; i++)
                {
                    generator.PrintDocCmd(tables[i]);
                    generator.PrintDocCmd(dpara);
                }
            }
        }