public override void AddToManifest(UdnManifest Manifest) { string FilterPath = Name; for (APIFilter Filter = Parent as APIFilter; Filter != null; Filter = Filter.Parent as APIFilter) { FilterPath = Filter.Name + "." + FilterPath; } Manifest.Add("Filter:" + FilterPath, this); foreach (APIFilter Filter in Filters) { Filter.AddToManifest(Manifest); } foreach (APIMember Member in Members) { Member.AddToManifest(Manifest); } }
public override void WritePage(UdnManifest Manifest, string OutputPath) { using (UdnWriter Writer = new UdnWriter(OutputPath)) { Writer.WritePageHeader(Name, PageCrumbs, ""); List <APIMember> FilteredMembers = Members; // Get the name of the withheld section APIModule Module = FindParent <APIModule>(); if (Module != null) { string UnlistedEntries = Program.Settings.FindValue("Module." + Module.Name + ".Unlisted"); if (UnlistedEntries != null) { HashSet <APIPage> UnlistedPages = new HashSet <APIPage>(UnlistedEntries.Split('\n').Select(x => Manifest.Find(x.Trim()))); FilteredMembers = new List <APIMember>(FilteredMembers.Where(x => !UnlistedPages.Contains(x))); } } // Find all the records, sorted by name List <APIRecord> AllRecords = new List <APIRecord>(FilteredMembers.OfType <APIRecord>().Where(x => !x.bIsTemplateSpecialization).OrderBy(x => x.Name)); // Find all the functions, sorted by name List <APIFunction> AllFunctions = new List <APIFunction>(); AllFunctions.AddRange(FilteredMembers.OfType <APIFunction>().Where(x => !x.bIsTemplateSpecialization)); AllFunctions.AddRange(FilteredMembers.OfType <APIFunctionGroup>().SelectMany(x => x.Children.OfType <APIFunction>()).Where(x => !x.bIsTemplateSpecialization)); AllFunctions.Sort((x, y) => (x.Name.CompareTo(y.Name))); // Enter the module template Writer.EnterTag("[OBJECT:Filter]"); // Write the class list Writer.EnterTag("[PARAM:filters]"); APIFilter.WriteListSection(Writer, "filters", "Filters", Filters.OrderBy(x => x.Name)); Writer.LeaveTag("[/PARAM]"); // Write the class list Writer.EnterTag("[PARAM:classes]"); Writer.WriteListSection("classes", "Classes", "Name", "Description", AllRecords.Select(x => x.GetListItem())); Writer.LeaveTag("[/PARAM]"); // Write all the constants Writer.EnterTag("[PARAM:constants]"); Writer.WriteListSection("constants", "Constants", "Name", "Description", FilteredMembers.OfType <APIConstant>().Select(x => x.GetListItem())); Writer.LeaveTag("[/PARAM]"); // Write the typedef list Writer.EnterTag("[PARAM:typedefs]"); Writer.WriteListSection("typedefs", "Typedefs", "Name", "Description", FilteredMembers.OfType <APITypeDef>().Select(x => x.GetListItem())); Writer.LeaveTag("[/PARAM]"); // Write the enum list Writer.EnterTag("[PARAM:enums]"); Writer.WriteListSection("enums", "Enums", "Name", "Description", FilteredMembers.OfType <APIEnum>().OrderBy(x => x.Name).Select(x => x.GetListItem())); Writer.LeaveTag("[/PARAM]"); // Write the function list Writer.EnterTag("[PARAM:functions]"); APIFunction.WriteListSection(Writer, "functions", "Functions", AllFunctions, true); Writer.LeaveTag("[/PARAM]"); // Write the variable list Writer.EnterTag("[PARAM:variables]"); APIVariable.WriteListSection(Writer, "variables", "Variables", FilteredMembers.OfType <APIVariable>()); Writer.LeaveTag("[/PARAM]"); // Close the module template Writer.LeaveTag("[/OBJECT]"); } }
public static APIModule Build(APIPage InParent, DoxygenModule InModule) { // Find the description and category string ModuleSettingsPath = "Module." + InModule.Name; string Description = Program.Settings.FindValueOrDefault(ModuleSettingsPath + ".Description", ""); // Get the filter settings IniSection FilterSection = Program.Settings.FindSection(ModuleSettingsPath + ".Filter"); IniSection WithholdSection = Program.Settings.FindSection(ModuleSettingsPath + ".Withhold"); // Build a module from all the members APIModule Module = new APIModule(InParent, InModule.Name, Description); // Normalize the base directory string NormalizedBaseSrcDir = Path.GetFullPath(InModule.BaseSrcDir).ToLowerInvariant(); if (!NormalizedBaseSrcDir.EndsWith("\\")) { NormalizedBaseSrcDir += "\\"; } // Separate the members into categories, based on their path underneath the module source directory Dictionary <APIFilter, List <DoxygenEntity> > MembersByFilter = new Dictionary <APIFilter, List <DoxygenEntity> >(); foreach (DoxygenEntity Entity in InModule.Entities) { string FilterPath = null; // Try to get the filter path from the ini section if (FilterSection != null) { FilterPath = FilterSection.Find(Entity.Name); } // If we didn't have one set explicitly, generate one from the subdirectory if (FilterPath == null) { string EntityFile = String.IsNullOrEmpty(Entity.File)? "" : Path.GetFullPath(Entity.File); if (EntityFile.ToLowerInvariant().StartsWith(NormalizedBaseSrcDir)) { int MinIndex = EntityFile.IndexOf('\\', NormalizedBaseSrcDir.Length); if (MinIndex == -1) { FilterPath = ""; } else if (IsVisibleFolder(EntityFile.Substring(NormalizedBaseSrcDir.Length, MinIndex - NormalizedBaseSrcDir.Length))) { int MaxIndex = EntityFile.LastIndexOf('\\'); FilterPath = EntityFile.Substring(MinIndex + 1, Math.Max(MaxIndex - MinIndex - 1, 0)); } } } // Add this entity to the right filters if (FilterPath != null) { // Create all the categories for this entry APIFilter ParentFilter = Module; if (FilterPath.Length > 0) { string[] Folders = FilterPath.Split('\\'); for (int Idx = 0; Idx < Folders.Length; Idx++) { APIFilter NextFilter = ParentFilter.Filters.FirstOrDefault(x => String.Compare(x.Name, Folders[Idx], true) == 0); if (NextFilter == null) { NextFilter = new APIFilter(ParentFilter, Folders[Idx]); ParentFilter.Filters.Add(NextFilter); } ParentFilter = NextFilter; } } // Add this entity to the pending list for this filter Utility.AddToDictionaryList(ParentFilter, Entity, MembersByFilter); } } // Try to fixup all of the filters foreach (KeyValuePair <APIFilter, List <DoxygenEntity> > Members in MembersByFilter) { APIFilter Filter = Members.Key; Filter.Members.AddRange(APIMember.CreateChildren(Filter, Members.Value)); } return(Module); }
public static APIModule Build(APIPage InParent, DoxygenModule InModule) { // Find the description and category string ModuleSettingsPath = "Module." + InModule.Name; string Description = Program.Settings.FindValueOrDefault(ModuleSettingsPath + ".Description", ""); // Get the filter settings IniSection FilterSection = Program.Settings.FindSection(ModuleSettingsPath + ".Filter"); IniSection WithholdSection = Program.Settings.FindSection(ModuleSettingsPath + ".Withhold"); // Build a module from all the members APIModule Module = new APIModule(InParent, InModule.Name, Description); // Normalize the base directory string NormalizedBaseSrcDir = Path.GetFullPath(InModule.BaseSrcDir).ToLowerInvariant(); if (!NormalizedBaseSrcDir.EndsWith("\\")) NormalizedBaseSrcDir += "\\"; // Separate the members into categories, based on their path underneath the module source directory Dictionary<APIFilter, List<DoxygenEntity>> MembersByFilter = new Dictionary<APIFilter,List<DoxygenEntity>>(); foreach (DoxygenEntity Entity in InModule.Entities) { string FilterPath = null; // Try to get the filter path from the ini section if (FilterSection != null) { FilterPath = FilterSection.Find(Entity.Name); } // If we didn't have one set explicitly, generate one from the subdirectory if(FilterPath == null) { string EntityFile = String.IsNullOrEmpty(Entity.File)? "" : Path.GetFullPath(Entity.File); if(EntityFile.ToLowerInvariant().StartsWith(NormalizedBaseSrcDir)) { int MinIndex = EntityFile.IndexOf('\\', NormalizedBaseSrcDir.Length); if(MinIndex == -1) { FilterPath = ""; } else if (IsVisibleFolder(EntityFile.Substring(NormalizedBaseSrcDir.Length, MinIndex - NormalizedBaseSrcDir.Length))) { int MaxIndex = EntityFile.LastIndexOf('\\'); FilterPath = EntityFile.Substring(MinIndex + 1, Math.Max(MaxIndex - MinIndex - 1, 0)); } } } // Add this entity to the right filters if(FilterPath != null) { // Create all the categories for this entry APIFilter ParentFilter = Module; if (FilterPath.Length > 0) { string[] Folders = FilterPath.Split('\\'); for (int Idx = 0; Idx < Folders.Length; Idx++) { APIFilter NextFilter = ParentFilter.Filters.FirstOrDefault(x => String.Compare(x.Name, Folders[Idx], true) == 0); if (NextFilter == null) { NextFilter = new APIFilter(ParentFilter, Folders[Idx]); ParentFilter.Filters.Add(NextFilter); } ParentFilter = NextFilter; } } // Add this entity to the pending list for this filter Utility.AddToDictionaryList(ParentFilter, Entity, MembersByFilter); } } // Try to fixup all of the filters foreach (KeyValuePair<APIFilter, List<DoxygenEntity>> Members in MembersByFilter) { APIFilter Filter = Members.Key; Filter.Members.AddRange(APIMember.CreateChildren(Filter, Members.Value)); } return Module; }