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);
         }
     }
 }
 /// <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 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);
            }
        }
        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);
            }
        }
        /// <summary>
        /// Parse the properties.
        /// </summary>
        /// <param name="propertys">Array of the propoerties</param>
        /// <param name="dc">The base classifier, where the properties are.</param>
        private void parseProperty(PropertyInfo[] propertys, DoxClassifier dc)
        {
            foreach (PropertyInfo property in propertys)
            {
                DoxProperty dp = new DoxProperty();
                if(property.Name.First().Equals('<')|| property.Name.Contains("<>"))
                {
                    continue;
                }
                dp.Name = property.Name;
                dp.Identifier = dc.Name.Replace('+','.') + '.' + dp.Name;
                dp.Sealed = property.PropertyType.IsSealed;
                if (property.PropertyType.GenericTypeArguments.Length > 0)
                {
                    String type = property.PropertyType.Name.Substring(0, property.PropertyType.Name.Length - 2);
                    type = type + '<';
                    bool first = true;
                    foreach (var item in property.PropertyType.GenericTypeArguments)
                    {
                        if (first)
                        {
                            type = type + item.Name;
                            first = false;
                        }
                        else
                        {
                            type = type + ", " + item.Name;
                        }
                    }
                    type = type + '>';
                    dp.Definition = type;
                }
                else
                {
                    dp.Definition = property.PropertyType.Name;
                }
                String[] attributes = property.PropertyType.Attributes.ToString().Replace(" ", string.Empty).Split(',');
                foreach (string attr in attributes)
                {
                    switch (attr)
                    {
                        case "Public":
                        case "NestedPublic":
                            dp.ProtectionKind = ProtectionKind.Public;
                            break;
                        case "Protected":
                            dp.ProtectionKind = ProtectionKind.Protected;
                            break;
                        case "NestedPrivate":
                        case "Private":
                            dp.ProtectionKind = ProtectionKind.Private;
                            break;
                        case "Abstract":
                            dp.VirtualKind = VirtualKind.Abstract;
                            break;
                        case "Serializable":
                        case "Sealed":
                        case "AutoLayout":
                        case "AnsiClass":
                        case "Class":
                        case "SequentialLayout":
                        case "ClassSemanticsMask":
                        case "HasSecurity":
                        case "BeforeFieldInit":
                            break;
                        default:
                            this.Log(LogKind.Warning, attr + " can't be processed as attribute of attributes.");
                            break;
                    }
                }
                dc.Members.Add(dp);
                //String briefDescription = getDescription(dp.Identifier, DescriptionType.Brief);
                //String detailedDescription = getDescription(dp.Identifier, DescriptionType.Detailed);
                MemberIndex mi = new MemberIndex();
                mi.Identifier = dp.Identifier;
                mi.Kind = dp.Kind;
                mi.Member = dp;
                mi.Name = dp.Name;
                try
                {
                    this.Model.MemberRefs.Add(dp.Identifier, dp);
                    this.Index.MemberIndexRefs.Add(dp.Identifier, mi);
                }
                catch(ArgumentException ae)
                {
                    this.Log(LogKind.Error, ae.Message + " " + mi.Identifier);
                }

            }
        }
        private void parseMethod(MethodInfo[] methods, DoxClassifier dc)
        {
            foreach (MethodInfo method in methods)
            {
                if(method.Name.Length > 4)
                {
                    if(method.Name.Substring(0,4).Equals("get_") || method.Name.Substring(0,4).Equals("set_"))
                    {
                        continue;
                    }
                    else if (method.Name.First().Equals('<') || method.Name.Contains("<>"))
                    {
                        continue;
                    }
                }
                DoxMethod dp = new DoxMethod();
                dp.Name = method.Name;
                dp.Identifier = dc.Identifier.Replace('+','.') + "." + dp.Name;
                String xmlName = dp.Identifier;
                ParameterInfo[] parameters = method.GetParameters();

                if (method.ReturnType.GenericTypeArguments.Length > 0)
                {
                    String type = method.ReturnType.Name.Substring(0, method.ReturnType.Name.Length - 2);
                    type = type + '<';
                    bool first = true;
                    foreach (var item in method.ReturnType.GenericTypeArguments)
                    {
                        if (first)
                        {
                            type = type + item.Name;
                            first = false;
                        }
                        else
                        {
                            type = type + ", " + item.Name;
                        }
                    }
                    type = type + '>';
                    dp.Definition = type;
                }
                else
                {
                    dp.Definition = method.ReturnType.Name;
                }

                if(parameters.Length > 0)
                {
                    xmlName += "(";
                }
                foreach (ParameterInfo param in parameters)
                {
                    DoxLinkedTextItem dlti = new DoxLinkedTextItem();
                    if (param.ParameterType.GenericTypeArguments.Length > 0)
                    {
                        String type = param.ParameterType.Name.Substring(0, param.ParameterType.Name.Length - 2);
                        type = type + '<';
                        bool first = true;
                        foreach (var item in param.ParameterType.GenericTypeArguments)
                        {
                            if (first)
                            {
                                type = type + item.Name;
                                first = false;
                            }
                            else
                            {
                                type = type + ", " + item.Name;
                            }
                        }
                        type = type + '>';
                        dlti.Text = type;
                        dp.Identifier = dp.Identifier + '_' + type;
                    }
                    else
                    {
                        dlti.Text = param.ParameterType.Name;
                        dp.Identifier = dp.Identifier + '_' + dlti.Text;
                    }
                    if (param != parameters.Last())
                    {
                        if (param.ParameterType.FullName != null)
                        {
                            xmlName += param.ParameterType.FullName.Replace('+', '.') + ",";
                        }
                        else
                        {
                            xmlName += param.ParameterType.Name.Replace('+', '.') + ",";
                        }

                    }
                    else
                    {
                        if (param.ParameterType.FullName != null)
                        {
                            xmlName += param.ParameterType.FullName.Replace('+', '.') + ")";
                        }
                        else
                        {
                            xmlName += param.ParameterType.Name.Replace('+', '.') + ")";
                        }

                    }
                    DoxLinkedText dlt = new DoxLinkedText();
                    dlt.Items.Add(dlti);

                    DoxParam DPara = new DoxParam();
                    DPara.DeclarationName = param.Name;
                    DPara.Type = dlt;
                    dp.Params.Add(DPara);
                }

                String[] attributes = method.Attributes.ToString().Replace(" ", string.Empty).Split(',');
                foreach (string attr in attributes)
                {
                    switch (attr)
                    {
                        case "Abstract":
                            dp.VirtualKind = VirtualKind.Abstract;
                            break;
                        case "Final":
                            dp.Final = true;
                            break;
                        case "Public":
                            dp.ProtectionKind = ProtectionKind.Public;
                            break;
                        case "Protected":
                        case "Family":
                            dp.ProtectionKind = ProtectionKind.Protected;
                            break;
                        case "Private":
                            dp.ProtectionKind = ProtectionKind.Private;
                            break;
                        case "Static":
                            dp.Static = true;
                            break;
                        case "Virtual":
                            dp.VirtualKind = VirtualKind.Virtual;
                            break;
                        case "Serializable":
                        case "Sealed":
                        case "AutoLayout":
                        case "AnsiClass":
                        case "Class":
                        case "SequentialLayout":
                        case "BeforeFieldInit":
                        case "PrivateScope":
                        case "HideBySig":
                        case "SpecialName":
                        case "VtableLayoutMask":
                        case "Assembly":
                        case "CheckAccessOnOverride":
                            break;
                        default:
                            this.Log(LogKind.Warning, attr + " can't be processed as attribute of porpoerty.");
                            break;
                    }
                }
                dc.Members.Add(dp);
                getDescription(xmlName, DescriptionType.Detailed);
                getDescription(xmlName, DescriptionType.Brief);
                MemberIndex mi = new MemberIndex();
                mi.Identifier = dp.Identifier;
                mi.Kind = dp.Kind;
                mi.Member = dp;
                mi.Name = dp.Name;
                try
                {
                    this.Model.MemberRefs.Add(dp.Identifier, dp);
                }
                catch (Exception)
                {
                    continue;
                }
                this.Index.MemberIndexRefs.Add(dp.Identifier, mi);

            }
        }
 void IApiDocTemplateProcessor.Process(ClassifierListTemplate template)
 {
     List<DoxClassifier> classifiers;
     if (this.currentNamespace != null)
     {
         classifiers = this.currentNamespace.Classifiers.ToList();
     }
     else
     {
         classifiers =
             (from c in this.model.Compounds
             where c is DoxClassifier
             select (DoxClassifier)c).ToList();
     }
     int i = 0;
     while (i < classifiers.Count)
     {
         foreach (var ic in classifiers[i].InnerClassifiers)
         {
             if (!classifiers.Contains(ic)) classifiers.Add(ic);
         }
         ++i;
     }
     classifiers.RemoveAll(c => !SelectClassifier(c, template));
     classifiers = classifiers.OrderBy(c => c.Name).ToList();
     foreach (var c in classifiers)
     {
         this.currentClassifier = c;
         string name = generator.NormalizeName(c.Name);
         if (currentNamespace != null)
         {
             name = generator.NormalizeName(c.Name);
         }
         generator.PrintSection(c.Kind + ": " + name, c.Identifier);
         this.generator.NextSectionLevel();
         template.ProcessItems(this);
         this.generator.PreviousSectionLevel();
         this.currentClassifier = null;
     }
 }
 public void Generate()
 {
     this.currentNamespace = null;
     this.currentClassifier = null;
     this.currentMember = null;
     template.Process(this);
 }
 private static bool SelectClassifier(DoxClassifier c, ClassifierListTemplate template)
 {
     if (template is InterfaceListTemplate)
     {
         return c.Kind == CompoundKind.Interface;
     }
     else if (template is ClassListTemplate)
     {
         return c.Kind == CompoundKind.Class;
     }
     else if (template is StructListTemplate)
     {
         return c.Kind == CompoundKind.Struct;
     }
     else if (template is EnumListTemplate)
     {
         return c.Kind == CompoundKind.Enum;
     }
     else
     {
         return c.Kind == CompoundKind.Interface ||
                 c.Kind == CompoundKind.Class ||
                 c.Kind == CompoundKind.Struct ||
                 c.Kind == CompoundKind.Enum;
     }
 }