Exemple #1
0
        public Stat AddStat(APIMember Member, string Name)
        {
            for (APIPage Page = Member; Page != null; Page = Page.Parent)
            {
                APIModule Module = Page as APIModule;
                if (Module != null)
                {
                    // Get the stats for this module
                    ModuleStats ModuleStatsInst;
                    if (!Modules.TryGetValue(Module.Name, out ModuleStatsInst))
                    {
                        ModuleStatsInst = new ModuleStats();
                        Modules.Add(Module.Name, ModuleStatsInst);
                    }

                    // Find the name of this stat
                    Stat StatInst;
                    if (!ModuleStatsInst.Stats.TryGetValue(Name, out StatInst))
                    {
                        StatInst = new Stat();
                        ModuleStatsInst.Stats.Add(Name, StatInst);
                    }

                    // Update the current
                    return(StatInst);
                }
            }
            return(null);
        }
        public void AddModule(APIModule Module)
        {
            // Find the description and category
            string ModuleSettingsPath = "Module." + Module.Name;
            string CategoryText = Program.Settings.FindValueOrDefault(ModuleSettingsPath + ".Category", null);

            // Build a module from all the members
            APIModuleCategory Category = String.IsNullOrEmpty(CategoryText)? this : AddCategory(CategoryText);
            Category.Modules.Add(Module);
        }
Exemple #3
0
        public void AddModule(APIModule Module)
        {
            // Find the description and category
            string ModuleSettingsPath = "Module." + Module.Name;
            string CategoryText       = Program.Settings.FindValueOrDefault(ModuleSettingsPath + ".Category", null);

            // Build a module from all the members
            APIModuleCategory Category = String.IsNullOrEmpty(CategoryText)? this : AddCategory(CategoryText);

            Category.Modules.Add(Module);
        }
Exemple #4
0
        public void WriteReferencesSection(UdnWriter Writer, DoxygenEntity Entity)
        {
            List <UdnListItem> Items = new List <UdnListItem>();

            // Get the module
            for (APIPage Page = this; Page != null; Page = Page.Parent)
            {
                APIModule Module = Page as APIModule;
                if (Module != null)
                {
                    Items.Add(new UdnListItem("Module", String.Format("[{0}]({1})", Module.Name, Module.LinkPath), null));
                    break;
                }
            }

            // Get the header file
            if (Entity.File != null)
            {
                string NormalizedFileName = GetNormalizedFileName(Entity.File);
                if (NormalizedFileName != null)
                {
                    Items.Add(new UdnListItem("Header", Utility.EscapeText(NormalizedFileName), null));
                }
            }

            // Get the source file
            if (Entity.BodyFile != null && Entity.BodyFile != Entity.File)
            {
                string NormalizedFileName = GetNormalizedFileName(Entity.BodyFile);
                if (NormalizedFileName != null)
                {
                    Items.Add(new UdnListItem("Source", Utility.EscapeText(NormalizedFileName), null));
                }
            }

            // Write the section
            if (Items.Count > 0)
            {
                Writer.EnterSection("references", "References");
                Writer.WriteList(Items);
                Writer.LeaveSection();
            }
        }
Exemple #5
0
        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);
        }
Exemple #7
0
		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;
		}
Exemple #8
0
        public APIIndex(List <DoxygenModule> InModules)
            : base(null, "API")
        {
            // Build a mapping of module names to modules
            Dictionary <string, DoxygenModule> NameToModuleMap = new Dictionary <string, DoxygenModule>();

            foreach (DoxygenModule Module in InModules)
            {
                NameToModuleMap.Add(Module.Name, Module);
            }

            // Add some default categories to fix the order
            APIModuleCategory RootCategory = new APIModuleCategory("Modules");

            RootCategory.Categories.Add(new APIModuleCategory("Runtime"));
            RootCategory.Categories.Add(new APIModuleCategory("Editor"));
            RootCategory.Categories.Add(new APIModuleCategory("Developer"));
            RootCategory.Categories.Add(new APIModuleCategory("Plugins"));

            // Add all of the modules to a category
            Dictionary <DoxygenModule, APIModuleCategory> ModuleToCategory = new Dictionary <DoxygenModule, APIModuleCategory>();

            foreach (DoxygenModule Module in InModules)
            {
                APIModuleCategory Category = FindRootCategoryByPath(RootCategory.Categories, Module.BaseSrcDir);
                ModuleToCategory.Add(Module, Category);
            }

            // Create all the index pages
            foreach (APIModuleCategory Category in RootCategory.Categories)
            {
                APIModuleIndex ChildModuleIndex = new APIModuleIndex(this, Category);
                ChildModuleIndexes.Add(ChildModuleIndex);
            }
            Pages.AddRange(ChildModuleIndexes);

            // Populate all the categories and create all the module pages
            foreach (KeyValuePair <DoxygenModule, APIModuleCategory> Pair in ModuleToCategory)
            {
                APIModuleIndex Parent = ChildModuleIndexes.First(x => x.Category == Pair.Value);

                APIModule Module = APIModule.Build(Parent, Pair.Key);
                Parent.Children.Add(Module);

                Pair.Value.Modules.Add(Module);
//				Pair.Value.AddModule(Module);
            }

            // Expand the Core section by default
            APIModuleCategory DefaultCategory = RootCategory.Categories[0].Categories.FirstOrDefault(x => x.Name == "Core Runtime Modules");

            if (DefaultCategory != null)
            {
                DefaultCategory.Expanded = true;
            }

            // Get all the members that were created as part of building the modules. After this point we'll only create index pages.
            List <APIMember> AllMembers = new List <APIMember>(GatherPages().OfType <APIMember>().OrderBy(x => x.FullName));

            foreach (APIMember Member in AllMembers)
            {
                Member.Link();
            }
            foreach (APIMember Member in AllMembers)
            {
                Member.PostLink();
            }

            // Create the quick start page
            GettingStarted = new APIGettingStarted(this);
            Pages.Add(GettingStarted);

            // Create an index of all the constants
            ConstantIndex = new APIConstantIndex(this, AllMembers);
            Pages.Add(ConstantIndex);

            // Create an index of all the functions
            FunctionIndex = new APIFunctionIndex(this, AllMembers.OfType <APIFunction>().Where(x => !(x.ScopeParent is APIRecord)));
            Pages.Add(FunctionIndex);

            // Create an index of all the enums
            EnumIndex = new APIEnumIndex(this, AllMembers);
            Pages.Add(EnumIndex);

            // Create an index of all the records
            RecordIndex = new APIRecordIndex(this, AllMembers);
            Pages.Add(RecordIndex);

            // Create an index of all the classes
            RecordHierarchy = APIHierarchy.Build(this, AllMembers.OfType <APIRecord>());
            Pages.Add(RecordHierarchy);
        }