Ejemplo n.º 1
0
        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);
                }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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);
 }
        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);
        }