Beispiel #1
0
        public APIHierarchyNode AddRoot(APIFunction Function)
        {
            APIHierarchyNode RootNode = this;

            // Add a single chain down to the root
            for (; Function.Reimplements.Count == 1; Function = Function.Reimplements[0])
            {
                APIHierarchyNode NextNode = new APIHierarchyNode(Function.Reimplements[0].FullName + Utility.EscapeText("()"), Function.Reimplements[0].LinkPath, false);
                NextNode.Children.Add(RootNode);
                RootNode = NextNode;
            }

            // Add all the base functions
            APIHierarchyNode NewRootNode = new APIHierarchyNode();

            if (Function.Reimplements.Count == 0)
            {
                NewRootNode.Children.Add(RootNode);
            }
            else
            {
                foreach (APIFunction NextFunction in Function.Reimplements)
                {
                    NewRootNode.Children.Add(new APIHierarchyNode(NextFunction.FullName + Utility.EscapeText("()"), NextFunction.LinkPath, false));
                }
                NewRootNode.Children.Last().Children.Add(RootNode);
            }
            return(NewRootNode);
        }
Beispiel #2
0
        public override void PostLink()
        {
            // If we're missing a description for this function, copy it from whatever we reimplement
            List <APIFunction> FunctionStack = new List <APIFunction> {
                this
            };

            while (Utility.IsNullOrWhitespace(BriefDescription) && Utility.IsNullOrWhitespace(FullDescription) && FunctionStack.Count > 0)
            {
                // Remove the top function from the stack
                APIFunction Function = FunctionStack.Last();
                FunctionStack.RemoveAt(FunctionStack.Count - 1);
                FunctionStack.AddRange(Function.Reimplements);

                // Copy its descriptions
                BriefDescription = Function.BriefDescription;
                FullDescription  = Function.FullDescription;
            }

            // Create the hierarchy
            if (Reimplements.Count > 0 || ReimplementedBy.Count > 0)
            {
                APIHierarchyNode Node = new APIHierarchyNode(FullName + Utility.EscapeText("()"), false);
                Node.AddChildren(this);
                HierarchyNode = Node.AddRoot(this);
            }
        }
Beispiel #3
0
 public void AddChildren(APIFunction Function)
 {
     foreach (APIFunction ReimpFunction in Function.ReimplementedBy)
     {
         APIHierarchyNode ReimpNode = new APIHierarchyNode(ReimpFunction.FullName + Utility.EscapeText("()"), ReimpFunction.LinkPath, true);
         Children.Add(ReimpNode);
         ReimpNode.AddChildren(ReimpFunction);
     }
 }
Beispiel #4
0
        public APIFunction GetBaseImplementation()
        {
            APIFunction BaseFunction = this;

            while (BaseFunction.Reimplements.Count > 0)
            {
                BaseFunction = BaseFunction.Reimplements[0];
            }
            return(BaseFunction);
        }
        public override void WritePage(UdnManifest Manifest, string OutputPath)
        {
            using (UdnWriter Writer = new UdnWriter(OutputPath))
            {
                Writer.WritePageHeader(Name, PageCrumbs, "Overload list");

                Writer.EnterTag("[REGION:members]");
                APIFunction.WriteList(Writer, Overloads, Overloads.First().FunctionType != APIFunctionType.Constructor);
                Writer.LeaveTag("[/REGION]");
            }
        }
Beispiel #6
0
        public APIFunctionParam(APIFunction InFunction, XmlNode InNode)
        {
            Function = InFunction;
            Node     = InNode;

            // Set the name
            XmlNode NameNode = Node.SelectSingleNode("declname");

            if (NameNode != null)
            {
                Name = NameNode.InnerText;
            }
        }
Beispiel #7
0
        public APIFunctionParamSummary(APIFunction InFunction, XmlNode InNode)
        {
            Function = InFunction;
            Node     = InNode;

            foreach (XmlNode NameNode in Node.SelectNodes("parameternamelist/parametername"))
            {
                Names.Add(NameNode.InnerText);
            }

            XmlNode DescriptionNode = Node.SelectSingleNode("parameterdescription");

            Description = DescriptionNode.InnerText.TrimStart('-', ' ');
        }
Beispiel #8
0
        public static bool CreateParametersStruct(APIPage Parent, List <APIMember> Children, DoxygenEntity Entity)
        {
            string Name        = Entity.Name;
            int    ClassMaxIdx = Name.IndexOf("_event");

            if (ClassMaxIdx == -1)
            {
                return(false);
            }

            string    ClassName   = Name.Substring(0, ClassMaxIdx);
            APIRecord ClassRecord = Children.OfType <APIRecord>().FirstOrDefault(x => x.Name.EndsWith(ClassName) && x.Name.Length == ClassName.Length + 1);

            if (ClassRecord == null)
            {
                return(false);
            }

            if (!Name.EndsWith("_Parms"))
            {
                return(false);
            }
            int    MemberMinIdx = ClassMaxIdx + 6;
            int    MemberMaxIdx = Name.Length - 6;
            string MemberName   = Name.Substring(MemberMinIdx, MemberMaxIdx - MemberMinIdx);

            APIRecord Delegate = Children.OfType <APIRecord>().FirstOrDefault(x => x.Name == "F" + MemberName);

            if (Delegate != null)
            {
                Delegate.DelegateEventParameters = new APIEventParameters(Parent, Delegate, Entity);
                Children.Add(Delegate.DelegateEventParameters);
                return(true);
            }

            APIFunction Function = ClassRecord.Children.OfType <APIFunction>().FirstOrDefault(x => x.Name == MemberName);

            if (Function != null)
            {
                Function.EventParameters = new APIEventParameters(Parent, Function, Entity);
                Children.Add(Function.EventParameters);
                return(true);
            }

            return(false);
        }
Beispiel #9
0
		public APIFunctionGroup(APIPage InParent, APIFunctionKey InKey, IEnumerable<DoxygenEntity> InEntities) 
			: base(InParent, InKey.Name, Utility.MakeLinkPath(InParent.LinkPath, InKey.GetLinkName()))
		{
			FunctionType = InKey.Type;

			// Build a list of prototypes for each function node, to be used for sorting
			List<DoxygenEntity> Entities = new List<DoxygenEntity>(InEntities.OrderBy(x => x.Node.SelectNodes("param").Count));

			// Create the functions
			int LinkIndex = 1;
			foreach(DoxygenEntity Entity in Entities)
			{
				string NewLinkPath = Utility.MakeLinkPath(LinkPath, String.Format("{0}", LinkIndex));
				APIFunction Function = new APIFunction(this, Entity, InKey, NewLinkPath);
				Children.Add(Function);
				LinkIndex++;
			}
		}
        public APIFunctionGroup(APIPage InParent, APIFunctionKey InKey, IEnumerable <DoxygenEntity> InEntities)
            : base(InParent, InKey.Name, Utility.MakeLinkPath(InParent.LinkPath, InKey.GetLinkName()))
        {
            FunctionType = InKey.Type;

            // Build a list of prototypes for each function node, to be used for sorting
            List <DoxygenEntity> Entities = new List <DoxygenEntity>(InEntities.OrderBy(x => x.Node.SelectNodes("param").Count));

            // Create the functions
            int LinkIndex = 1;

            foreach (DoxygenEntity Entity in Entities)
            {
                string      NewLinkPath = Utility.MakeLinkPath(LinkPath, String.Format("{0}", LinkIndex));
                APIFunction Function    = new APIFunction(this, Entity, InKey, NewLinkPath);
                Children.Add(Function);
                LinkIndex++;
            }
        }
Beispiel #11
0
        public APIFunctionParamSummary(APIFunction InFunction, XmlNode InNode)
        {
            Function = InFunction;
            Node = InNode;

            foreach (XmlNode NameNode in Node.SelectNodes("parameternamelist/parametername"))
            {
                Names.Add(NameNode.InnerText);
            }

            XmlNode DescriptionNode = Node.SelectSingleNode("parameterdescription");
            Description = DescriptionNode.InnerText.TrimStart('-', ' ');
        }
Beispiel #12
0
        public APIFunctionParam(APIFunction InFunction, XmlNode InNode)
        {
            Function = InFunction;
            Node = InNode;

            // Set the name
            XmlNode NameNode = Node.SelectSingleNode("declname");
            if (NameNode != null) Name = NameNode.InnerText;
        }
Beispiel #13
0
        public static List<APIMember> CreateChildren(APIPage Parent, IEnumerable<DoxygenEntity> Entities)
        {
            List<APIMember> Children = new List<APIMember>();
            Dictionary<APIFunctionKey, List<DoxygenEntity>> PendingFunctionGroups = new Dictionary<APIFunctionKey, List<DoxygenEntity>>();

            // List of autogenerated structs
            List<DoxygenEntity> GeneratedEntities = new List<DoxygenEntity>();

            // Parse the entities
            foreach (DoxygenEntity Entity in Entities)
            {
                if (Entity.Kind == "class" || Entity.Kind == "struct" || Entity.Kind == "union")
                {
                    if (Entity.Kind == "struct" && Entity.Name.Contains("_event") && Entity.Name.EndsWith("_Parms"))
                    {
                        GeneratedEntities.Add(Entity);
                    }
                    else
                    {
                        APIRecord Record = new APIRecord(Parent, Entity);
                        Record.Children.AddRange(CreateChildren(Record, Entity.Members));
                        Children.Add(Record);
                    }
                }
                else if (Entity.Kind == "function")
                {
                    APIFunctionKey FunctionKey = APIFunctionKey.FromEntity(Parent, Entity);
                    if (!Program.IgnoredFunctionMacros.Contains(FunctionKey.Name))
                    {
                        List<DoxygenEntity> EntityList;
                        if (!PendingFunctionGroups.TryGetValue(FunctionKey, out EntityList))
                        {
                            EntityList = new List<DoxygenEntity>();
                            PendingFunctionGroups.Add(FunctionKey, EntityList);
                        }
                        EntityList.Add(Entity);
                    }
                }
                else if (Entity.Kind == "variable")
                {
                    if (IsConstantVariable(Entity))
                    {
                        Children.Add(new APIConstantVariable(Parent, Entity));
                    }
                    else
                    {
                        Children.Add(new APIVariable(Parent, Entity.Node));
                    }
                }
                else if (Entity.Kind == "typedef")
                {
                    Children.Add(new APITypeDef(Parent, Entity.Node));
                }
                else if (Entity.Kind == "enum")
                {
                    if (Entity.Name != null && Entity.Name.StartsWith("@"))
                    {
                        // It's an enum constant
                        Children.AddRange(APIConstantEnum.Read(Parent, Entity));
                    }
                    else
                    {
                        // It's an enum
                        Children.Add(new APIEnum(Parent, Entity, Entity.Name));
                    }
                }
            }

            // Fixup the functions
            foreach (KeyValuePair<APIFunctionKey, List<DoxygenEntity>> PendingFunctionGroup in PendingFunctionGroups)
            {
                if (PendingFunctionGroup.Value.Count == 1)
                {
                    APIFunction Function = new APIFunction(Parent, PendingFunctionGroup.Value[0], PendingFunctionGroup.Key);
                    Children.Add(Function);
                }
                else
                {
                    APIFunctionGroup FunctionGroup = new APIFunctionGroup(Parent, PendingFunctionGroup.Key, PendingFunctionGroup.Value);
                    Children.Add(FunctionGroup);
                }
            }

            // Attach all the autogenerated structures to their parent functions
            foreach(DoxygenEntity Entity in GeneratedEntities)
            {
                if(!CreateParametersStruct(Parent, Children, Entity))
                {
                    APIRecord Record = new APIRecord(Parent, Entity);
                    Record.Children.AddRange(CreateChildren(Record, Entity.Members));
                    Children.Add(Record);
                }
            }

            // Sort the children by name
            Children.Sort((x, y) => String.Compare(x.Name, y.Name));
            return Children;
        }
Beispiel #14
0
        public static List <APIMember> CreateChildren(APIPage Parent, IEnumerable <DoxygenEntity> Entities)
        {
            List <APIMember> Children = new List <APIMember>();
            Dictionary <APIFunctionKey, List <DoxygenEntity> > PendingFunctionGroups = new Dictionary <APIFunctionKey, List <DoxygenEntity> >();

            // List of autogenerated structs
            List <DoxygenEntity> GeneratedEntities = new List <DoxygenEntity>();

            // Parse the entities
            foreach (DoxygenEntity Entity in Entities)
            {
                if (Entity.Kind == "class" || Entity.Kind == "struct" || Entity.Kind == "union")
                {
                    if (Entity.Kind == "struct" && Entity.Name.Contains("_event") && Entity.Name.EndsWith("_Parms"))
                    {
                        GeneratedEntities.Add(Entity);
                    }
                    else
                    {
                        APIRecord Record = new APIRecord(Parent, Entity);
                        Record.Children.AddRange(CreateChildren(Record, Entity.Members));
                        Children.Add(Record);
                    }
                }
                else if (Entity.Kind == "function")
                {
                    APIFunctionKey FunctionKey = APIFunctionKey.FromEntity(Parent, Entity);
                    if (!Program.IgnoredFunctionMacros.Contains(FunctionKey.Name))
                    {
                        List <DoxygenEntity> EntityList;
                        if (!PendingFunctionGroups.TryGetValue(FunctionKey, out EntityList))
                        {
                            EntityList = new List <DoxygenEntity>();
                            PendingFunctionGroups.Add(FunctionKey, EntityList);
                        }
                        EntityList.Add(Entity);
                    }
                }
                else if (Entity.Kind == "variable")
                {
                    if (IsConstantVariable(Entity))
                    {
                        Children.Add(new APIConstantVariable(Parent, Entity));
                    }
                    else
                    {
                        Children.Add(new APIVariable(Parent, Entity.Node));
                    }
                }
                else if (Entity.Kind == "typedef")
                {
                    Children.Add(new APITypeDef(Parent, Entity));
                }
                else if (Entity.Kind == "enum")
                {
                    if (Entity.Name != null && Entity.Name.StartsWith("@"))
                    {
                        // It's an enum constant
                        Children.AddRange(APIConstantEnum.Read(Parent, Entity));
                    }
                    else
                    {
                        // It's an enum
                        Children.Add(new APIEnum(Parent, Entity, Entity.Name));
                    }
                }
            }

            // Fixup the functions
            foreach (KeyValuePair <APIFunctionKey, List <DoxygenEntity> > PendingFunctionGroup in PendingFunctionGroups)
            {
                if (PendingFunctionGroup.Value.Count == 1)
                {
                    APIFunction Function = new APIFunction(Parent, PendingFunctionGroup.Value[0], PendingFunctionGroup.Key);
                    Children.Add(Function);
                }
                else
                {
                    APIFunctionGroup FunctionGroup = new APIFunctionGroup(Parent, PendingFunctionGroup.Key, PendingFunctionGroup.Value);
                    Children.Add(FunctionGroup);
                }
            }

            // Attach all the autogenerated structures to their parent functions
            foreach (DoxygenEntity Entity in GeneratedEntities)
            {
                if (!CreateParametersStruct(Parent, Children, Entity))
                {
                    APIRecord Record = new APIRecord(Parent, Entity);
                    Record.Children.AddRange(CreateChildren(Record, Entity.Members));
                    Children.Add(Record);
                }
            }

            // Sort the children by name
            Children.Sort((x, y) => String.Compare(x.Name, y.Name));
            return(Children);
        }
Beispiel #15
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);
            }
        }
Beispiel #16
0
        public override void Link()
        {
            // Get the description
            ParseBriefAndFullDescription(Node, out BriefDescription, out FullDescription);

            // Try to link autogenerated exec functions to their original implementation
            if (Utility.IsNullOrWhitespace(BriefDescription) && Utility.IsNullOrWhitespace(FullDescription) && Name.Length >= 5 && Name.StartsWith("exec") && Char.IsUpper(Name[4]))
            {
                APIRecord ParentRecord = Parent as APIRecord;
                if (ParentRecord != null)
                {
                    APIMember TargetMember = ParentRecord.Children.OfType <APIFunction>().FirstOrDefault(x => x.Name == Name.Substring(4));
                    if (TargetMember == null)
                    {
                        TargetMember = ParentRecord.Children.OfType <APIFunctionGroup>().FirstOrDefault(x => x.Name == Name.Substring(4));
                    }
                    if (TargetMember != null)
                    {
                        BriefDescription = String.Format("Wrapper for [{0}]({1}).", TargetMember.Name, TargetMember.LinkPath);
                    }
                }
            }

            // Get the @see directives
            ParseSeeAlso(Node, SeeAlso);

            string RealKeyName = (Entity.Parent != null) ? (Entity.Parent.Name + "::" + Entity.Name) : Entity.Name;

            SnippetText = APISnippets.LoadSnippetTextForSymbol(RealKeyName);

            // Get the modifiers
            IsVirtual = Node.Attributes.GetNamedItem("virt").InnerText == "virtual";
            IsStatic  = Node.Attributes.GetNamedItem("static").InnerText == "yes";

            // Get the metadata
            MetadataDirective = MetadataCache.FindMetadataForMember(Node, "UFUNCTION");

            // Get the template parameters
            TemplateSignature = ParseTemplateSignature(Node);

            // If it's a specialization, add it to the parent class
            if (bIsTemplateSpecialization)
            {
                int StripIdx = FullName.LastIndexOf('<');
                if (StripIdx != -1)
                {
                    APIFunction OriginalTemplateFunction;
                    if (TemplateFunctions.TryGetValue(FullName.Substring(0, StripIdx), out OriginalTemplateFunction))
                    {
                        OriginalTemplateFunction.TemplateSpecializations.Add(this);
                    }
                }
            }

            // Get the parameter declaration nodes
            XmlNodeList ParameterNodes = Node.SelectNodes("param");

            foreach (XmlNode ParameterNode in ParameterNodes)
            {
                Parameters.Add(new APIFunctionParam(this, ParameterNode));
            }

            // If the only parameter is "void", don't bother including it
            if (Parameters.Count == 1 && Parameters[0].Node.SelectSingleNode("type").InnerText == "void")
            {
                Parameters.Clear();
            }

            // Get the parameter description nodes
            XmlNodeList ParameterItemNodes = Node.SelectNodes("detaileddescription/para/parameterlist/parameteritem");

            foreach (XmlNode ParameterItemNode in ParameterItemNodes)
            {
                ParameterSummaries.Add(new APIFunctionParamSummary(this, ParameterItemNode));
            }

            // Get the return type
            XmlNode ReturnTypeNode = Node.SelectSingleNode("type");

            ReturnType = RemoveElaborations(ConvertToMarkdown(ReturnTypeNode));

            // Parse the reimplements list
            using (XmlNodeList ReimplementsList = Node.SelectNodes("reimplements"))
            {
                foreach (XmlNode ReimplementsNode in ReimplementsList)
                {
                    APIFunction Function = ResolveRefLink(ReimplementsNode.Attributes["refid"].Value) as APIFunction;
                    if (Function != null)
                    {
                        Reimplements.Add(Function);
                    }
                }
            }

            // Parse the reimplemented-by list
            using (XmlNodeList ReimplementedByList = Node.SelectNodes("reimplementedby"))
            {
                foreach (XmlNode ReimplementedByNode in ReimplementedByList)
                {
                    APIFunction Function = ResolveRefLink(ReimplementedByNode.Attributes["refid"].Value) as APIFunction;
                    if (Function != null)
                    {
                        ReimplementedBy.Add(Function);
                    }
                }
            }

            // Parse any other notes
            XmlNodeList SimpleNodes = Node.SelectNodes("detaileddescription/para/simplesect");

            foreach (XmlNode node in SimpleNodes)
            {
                switch (node.Attributes.GetNamedItem("kind").InnerText)
                {
                case "return":
                    ReturnDescription = ConvertToMarkdown(node.SelectSingleNode("para"));
                    break;

                case "warning":
                    Warnings.Add(ConvertToMarkdown(node.SelectSingleNode("para")).TrimStart(':'));
                    break;
                }
            }

            // Parse the source lines

            /*
             * XmlNode LocationNode = Node.SelectSingleNode("location");
             * if(LocationNode != null)
             * {
             *      XmlAttribute BodyFileAttribute = LocationNode.Attributes["bodyfile"];
             *      if(BodyFileAttribute != null)
             *      {
             *              string BodyFile = BodyFileAttribute.Value;
             *              if(!BodyFile.ToLowerInvariant().Split('\\', '/').Any(x => Program.ExcludeSourceDirectoriesHash.Contains(x)))
             *              {
             *                      SourceFile File = SourceFileCache.Read(BodyFile);
             *                      if (File != null)
             *                      {
             *                              int BodyStart = Math.Min(Math.Max(Int32.Parse(LocationNode.Attributes["bodystart"].Value) - 1, 0), File.LineOffsets.Length - 1);
             *                              int BodyStartOffset = File.LineOffsets[BodyStart];
             *
             *                              int BodyEnd = Math.Min(Int32.Parse(LocationNode.Attributes["bodyend"].Value), File.LineOffsets.Length - 1);
             *                              int BodyEndOffset = File.LineOffsets[BodyEnd];
             *
             *                              SourceLines = File.Text.Substring(BodyStartOffset, BodyEndOffset - BodyStartOffset).Split('\n');
             *                      }
             *              }
             *      }
             * }
             */
        }
        public APIHierarchyNode AddRoot(APIFunction Function)
        {
            APIHierarchyNode RootNode = this;

            // Add a single chain down to the root
            for(; Function.Reimplements.Count == 1; Function = Function.Reimplements[0])
            {
                APIHierarchyNode NextNode = new APIHierarchyNode(Function.Reimplements[0].FullName + Utility.EscapeText("()"), Function.Reimplements[0].LinkPath, false);
                NextNode.Children.Add(RootNode);
                RootNode = NextNode;
            }

            // Add all the base functions
            APIHierarchyNode NewRootNode = new APIHierarchyNode();
            if (Function.Reimplements.Count == 0)
            {
                NewRootNode.Children.Add(RootNode);
            }
            else
            {
                foreach(APIFunction NextFunction in Function.Reimplements)
                {
                    NewRootNode.Children.Add(new APIHierarchyNode(NextFunction.FullName + Utility.EscapeText("()"), NextFunction.LinkPath, false));
                }
                NewRootNode.Children.Last().Children.Add(RootNode);
            }
            return NewRootNode;
        }
Beispiel #18
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 void AddChildren(APIFunction Function)
 {
     foreach (APIFunction ReimpFunction in Function.ReimplementedBy)
     {
         APIHierarchyNode ReimpNode = new APIHierarchyNode(ReimpFunction.FullName + Utility.EscapeText("()"), ReimpFunction.LinkPath, true);
         Children.Add(ReimpNode);
         ReimpNode.AddChildren(ReimpFunction);
     }
 }