Ejemplo n.º 1
0
        public override void PostLink()
        {
            if (BaseRecords.Count > 0 || DerivedRecords.Count > 0)
            {
                // Create the full hierarchy
                APIHierarchyNode RootNode = new APIHierarchyNode("root", false);
                APIHierarchyNode NextNode = RootNode.AddRoot(this);
                NextNode.AddChildren(this);

                // If it's too big for displaying inline, create a separate page and link to it
                if (!Program.Settings.FindValueOrDefault("HierarchyPages.Classes", "").Split('\n').Contains(FullName))
                {
                    HierarchyPage = null;
                    HierarchyNode = RootNode;
                }
                else
                {
                    NextNode.LinkPath = LinkPath;

                    HierarchyPage = new APIHierarchy(this, Name + " Hierarchy", "Class hierarchy for " + Name, RootNode);
                    HierarchyNode = new APIHierarchyNode("root", false);

                    APIHierarchyNode LastNode       = HierarchyNode.AddRoot(this);
                    string           DerivedMessage = String.Format("+ {0} derived classes", NextNode.CountChildren());
                    LastNode.Children.Add(new APIHierarchyNode(DerivedMessage, HierarchyPage.LinkPath, true));
                }
            }
        }
Ejemplo n.º 2
0
		public override void PostLink()
		{
			if (BaseRecords.Count > 0 || DerivedRecords.Count > 0)
			{
				// Create the full hierarchy
				APIHierarchyNode RootNode = new APIHierarchyNode("root", false);
				APIHierarchyNode NextNode = RootNode.AddRoot(this);
				NextNode.AddChildren(this);

				// If it's too big for displaying inline, create a separate page and link to it
				if (!Program.Settings.FindValueOrDefault("HierarchyPages.Classes", "").Split('\n').Contains(FullName))
				{
					HierarchyPage = null;
					HierarchyNode = RootNode;
				}
				else
				{
					NextNode.LinkPath = LinkPath;

					HierarchyPage = new APIHierarchy(this, Name + " Hierarchy", "Class hierarchy for " + Name, RootNode);
					HierarchyNode = new APIHierarchyNode("root", false);

					APIHierarchyNode LastNode = HierarchyNode.AddRoot(this);
					string DerivedMessage = String.Format("+ {0} derived classes", NextNode.CountChildren());
					LastNode.Children.Add(new APIHierarchyNode(DerivedMessage, HierarchyPage.LinkPath, true));
				}
			}
		}
Ejemplo n.º 3
0
        public override void WritePage(UdnManifest Manifest, string OutputPath)
        {
            using (UdnWriter Writer = new UdnWriter(OutputPath))
            {
                Writer.WritePageHeader(FullName, PageCrumbs, BriefDescription);

                // Write the warnings
                if (Warnings.Count > 0)
                {
                    Writer.EnterTag("[REGION:warning]");
                    Writer.WriteLine("**Warnings**");
                    foreach (string Warning in Warnings)
                    {
                        Writer.WriteLine("* " + Warning);
                    }
                    Writer.LeaveTag("[/REGION]");
                }

                // Write the virtual hierarchy
                if (HierarchyNode != null)
                {
                    Writer.EnterSection("overrides", "Override Hierarchy");
                    Writer.EnterTag("[REGION:hierarchy]");
                    APIHierarchy.WriteHierarchy(Writer, HierarchyNode, "hrch");
                    Writer.LeaveTag("[/REGION]");
                    Writer.LeaveSection();
                }

                // Write the syntax
                Writer.EnterSection("syntax", "Syntax");
                WriteSyntax(Writer);
                Writer.LeaveSection();

                // Write the description
                if (!Utility.IsNullOrWhitespace(FullDescription))
                {
                    Writer.EnterSection("description", "Remarks");
                    Writer.WriteLine(FullDescription);
                    Writer.LeaveSection();
                }

                // Enter the body
                Writer.EnterRegion("syntax");

                // Write the return type
                if (!Utility.IsNullOrWhitespace(ReturnDescription))
                {
                    Writer.EnterSection("returns", "Returns");
                    Writer.WriteLine(ReturnDescription);
                    Writer.LeaveSection();
                }

                // Write the parameters
                if (ParameterSummaries.Count > 0)
                {
                    Writer.WriteListSection("params", "Parameters", "Parameter", "Description", ParameterSummaries.Select(x => x.GetListItem()));
                }

                // Leave the body
                Writer.LeaveRegion();

                // Write the marshalling struct
                if (EventParameters != null)
                {
                    Writer.EnterSection("marshalling", "Marshalling");
                    Writer.WriteLine("May be called as an event using [{0}]({1}) as parameter frame.", EventParameters.Name, EventParameters.LinkPath);
                    Writer.LeaveSection();
                }

                // Write the template specializations
                if (TemplateSpecializations.Count > 0)
                {
                    Writer.EnterSection("specializations", "Specializations");
                    foreach (APIFunction Specialization in TemplateSpecializations)
                    {
                        Writer.WriteLine("[{0}]({1})  ", Specialization.Name, Specialization.LinkPath);
                    }
                    Writer.LeaveSection();
                }

                //Write code snippets
                WriteSnippetSection(Writer, SnippetText);

                // Write the @see directives
                WriteSeeAlsoSection(Writer, SeeAlso);

                // Write the reference info
                WriteReferencesSection(Writer, Entity);
            }
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        public override void WritePage(UdnManifest Manifest, string OutputPath)
        {
            using (UdnWriter Writer = new UdnWriter(OutputPath))
            {
                Writer.WritePageHeader(Name, PageCrumbs, BriefDescription);

                // Write the hierarchy
                if (HierarchyNode != null)
                {
                    Writer.EnterSection("hierarchy", "Inheritance Hierarchy");
                    Writer.EnterTag("[REGION:hierarchy]");
                    APIHierarchy.WriteHierarchy(Writer, HierarchyNode, "hrch");
                    Writer.LeaveTag("[/REGION]");
                    Writer.LeaveSection();
                }

                // Write the record definition
                if (!Utility.IsNullOrWhitespace(Definition))
                {
                    Writer.EnterSection("syntax", "Syntax");
                    WriteDefinition(Writer);
                    Writer.LeaveSection();
                }

                // Write the class description
                if (!Utility.IsNullOrWhitespace(FullDescription))
                {
                    Writer.EnterSection("description", "Remarks");
                    Writer.WriteLine(FullDescription.Replace("<", "&lt;").Replace(">", "&gt;"));
                    Writer.LeaveSection();
                }

                // Write the main body section
                Writer.EnterRegion("syntax");

                // Build a list of all the functions
                List <APIFunction> AllFunctions = new List <APIFunction>();
                AllFunctions.AddRange(Children.OfType <APIFunction>().Where(x => x.Protection != APIProtection.Private && !x.IsDeprecated()));
                AllFunctions.AddRange(Children.OfType <APIFunctionGroup>().SelectMany(x => x.Children.OfType <APIFunction>()).Where(x => x.Protection != APIProtection.Private && !x.IsDeprecated()));
                AllFunctions.Sort((x, y) => String.Compare(x.Name, y.Name));

                // Write all the specializations
                if (TemplateSpecializations.Count > 0)
                {
                    Writer.EnterSection("specializations", "Specializations");
                    foreach (APIRecord Specialization in TemplateSpecializations)
                    {
                        Writer.WriteLine("[{0}]({1})  ", Specialization.Name, Specialization.LinkPath);
                    }
                    Writer.LeaveSection();
                }

                // Write all the variables
                APIVariable.WriteListSection(Writer, "variables", "Variables", Children.OfType <APIVariable>().Where(x => x.Protection != APIProtection.Private && !x.IsDeprecated()).OrderBy(x => x.Name));

                // Write all the constructors
                if (!APIFunction.WriteListSection(Writer, "constructor", "Constructors", AllFunctions.Where(x => x.FunctionType == APIFunctionType.Constructor).OrderBy(x => x.LinkPath), false) && HasAnyPrivateFunction(Name))
                {
                    Writer.EnterSection("constructor", "Constructors");
                    Writer.WriteLine("No constructors are accessible with public or protected access.");
                    Writer.LeaveSection();
                }

                // Write all the destructors
                if (!APIFunction.WriteListSection(Writer, "destructor", "Destructors", AllFunctions.Where(x => x.FunctionType == APIFunctionType.Destructor), false) && HasAnyPrivateFunction("~" + Name))
                {
                    Writer.EnterSection("destructors", "Destructors");
                    Writer.WriteLine("No destructors are accessible with public or protected access.");
                    Writer.LeaveSection();
                }

                // Find a list of base classes
                List <APIRecord> AllBaseRecords = new List <APIRecord>();
                FindAllBaseRecords(AllBaseRecords);

                // Build a list of functions for each base record
                List <APIFunction>[] AllBaseFunctions = AllBaseRecords.Select(x => new List <APIFunction>()).ToArray();
                foreach (APIFunction Function in AllFunctions.Where(x => x.FunctionType == APIFunctionType.Normal && !x.IsExecFunction()))
                {
                    int BaseRecordIdx = AllBaseRecords.IndexOf(Function.GetBaseImplementation().FindParent <APIRecord>());
                    AllBaseFunctions[Math.Max(0, BaseRecordIdx)].Add(Function);
                }

                // Write the functions
                for (int Idx = 0; Idx < AllBaseFunctions.Length; Idx++)
                {
                    List <APIFunction> BaseFunctions = AllBaseFunctions[Idx];
                    if (BaseFunctions.Count > 0)
                    {
                        string Id    = String.Format("functions_{0}", Idx);
                        string Label = (Idx == 0) ? "Functions" : String.Format("Overridden from {0}", AllBaseRecords[Idx].Name);
                        APIFunction.WriteListSection(Writer, Id, Label, AllBaseFunctions[Idx], true);
                    }
                }

                // Write the operator list
                APIFunction.WriteListSection(Writer, "operators", "Operators", AllFunctions.Where(x => x.FunctionType == APIFunctionType.UnaryOperator || x.FunctionType == APIFunctionType.BinaryOperator), true);

                // Write all the inner structures
                Writer.WriteListSection("classes", "Classes", "Name", "Description", Children.OfType <APIRecord>().Where(x => x.Protection != APIProtection.Private).OrderBy(x => x.Name).Select(x => x.GetListItem()));

                // Write all the enums
                Writer.WriteListSection("enums", "Enums", "Name", "Description", Children.OfType <APIEnum>().OrderBy(x => x.Name).Select(x => x.GetListItem()));

                // Write all the typedefs
                Writer.WriteListSection("typedefs", "Typedefs", "Name", "Description", Children.OfType <APITypeDef>().Select(x => x.GetListItem()));

                // Write all the constants
                Writer.WriteListSection("constants", "Constants", "Name", "Description", Children.OfType <APIConstant>().Select(x => x.GetListItem()));

                // Leave the body
                Writer.LeaveRegion();

                // Write the marshalling parameters
                if (DelegateEventParameters != null)
                {
                    Writer.EnterSection("marshalling", "Marshalling");
                    Writer.WriteLine("Parameters are marshalled using [{0}]({1})", DelegateEventParameters.FullName, DelegateEventParameters.LinkPath);
                    Writer.LeaveSection();
                }

                // Write the @see directives
                WriteSeeAlsoSection(Writer, SeeAlso);

                // Write the references
                WriteReferencesSection(Writer, Entity);
            }
        }
Ejemplo n.º 6
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);
            }

            // Create a module category tree
            APIModuleCategory RootCategory = new APIModuleCategory(null);
            RootCategory.AddModules(InModules.Select(x => new KeyValuePair<string, string>(x.Name, x.BaseSrcDir)).ToArray());
            Debug.Assert(RootCategory.MinorModules.Count == 0 && RootCategory.MajorModules.Count == 0);

            // Create all the index pages
            foreach (APIModuleCategory Category in RootCategory.Categories)
            {
                if (!Category.IsEmpty)
                {
                    APIModuleIndex ModuleIndex = new APIModuleIndex(this, Category, InModules);
                    ModuleIndexes.Add(ModuleIndex);
                }
            }
            Pages.AddRange(ModuleIndexes);

            // 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 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 types
            TypeIndex = new APITypeIndex(this, AllMembers);
            Pages.Add(TypeIndex);

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

            // Create all the quick links
            foreach (string QuickLinkPath in QuickLinkPaths)
            {
                APIMember Member = AllMembers.FirstOrDefault(x => x.LinkPath == QuickLinkPath);
                if (Member != null) QuickLinks.Add(Member);
            }
        }
Ejemplo n.º 7
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);
		}