public APIEventParameters(APIPage InParent, APIMember InAttachedTo, DoxygenEntity InEntity)
     : base(InParent, InEntity.Name)
 {
     AttachedTo = InAttachedTo;
     Entity = InEntity;
     AddRefLink(Entity.Id, this);
 }
Exemple #2
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 APIEventParameters(APIPage InParent, APIMember InAttachedTo, DoxygenEntity InEntity)
     : base(InParent, InEntity.Name)
 {
     AttachedTo = InAttachedTo;
     Entity     = InEntity;
     AddRefLink(Entity.Id, this);
 }
Exemple #4
0
        public void WriteListItem(UdnWriter Writer, bool bWithType)
        {
            // Enter the object
            Writer.EnterObject(bWithType? "FunctionListItemWithType" : "FunctionListItem");

            // Get all the icons
            List <Icon> ItemIcons = new List <Icon> {
                Icons.Function[(int)Protection]
            };

            if (IsStatic)
            {
                ItemIcons.Add(Icons.StaticFunction);
            }
            if (IsVirtual)
            {
                ItemIcons.Add(Icons.VirtualFunction);
            }
            if (MetadataDirective != null)
            {
                ItemIcons.Add(Icons.ReflectedFunction);
                ItemIcons.AddRange(MetadataDirective.Icons);
            }
            Writer.WriteParam("icons", ItemIcons);

            // Write the return type
            Writer.WriteParam("type", Markdown.Truncate(ReturnType, 12, "..."));

            // Write the name
            if (Parameters.Count == 0)
            {
                Writer.WriteParam("name", Name + "()");
                Writer.WriteParam("arguments", "");
            }
            else
            {
                Writer.WriteParam("name", Name);
                Writer.EnterParam("arguments");
                if (Parameters.Count > 0)
                {
                    Writer.WriteEscapedLine("(  ");
                    for (int Idx = 0; Idx < Parameters.Count; Idx++)
                    {
                        string Separator  = (Idx + 1 == Parameters.Count) ? "" : ",";
                        string Definition = Markdown.Truncate(APIMember.RemoveElaborations(Parameters[Idx].Definition), 35, "...");
                        Writer.WriteLine(UdnWriter.TabSpaces + Definition + Separator + "  ");
                    }
                    Writer.WriteEscapedLine(")  ");
                }
                Writer.LeaveParam();
            }

            // Write the other parameters
            Writer.WriteParam("link", "[RELATIVE:" + LinkPath + "]");
            Writer.WriteParam("description", BriefDescription);

            // Leave the object
            Writer.LeaveObject();
        }
        public override void Link()
        {
            // Parse the metadata
            MetadataDirective = MetadataCache.FindMetadataForMember(Node, "UPROPERTY");

            ParseBriefAndFullDescription(Node, out BriefDescription, out FullDescription);

            XmlNode BitfieldNode = Node.SelectSingleNode("bitfield");

            if (BitfieldNode != null)
            {
                Bitfield = BitfieldNode.InnerText;
            }
            IsMutable = Node.Attributes.GetNamedItem("mutable").InnerText == "yes";
            IsStatic  = Node.Attributes.GetNamedItem("static").InnerText == "yes";

            XmlNode DefNode = Node.SelectSingleNode("definition");

            if (DefNode != null)
            {
                Definition = ConvertToMarkdown(DefNode);
            }

            XmlNode type = Node.SelectSingleNode("type");

            Type = APIMember.RemoveElaborations(ConvertToMarkdown(type));

            XmlNode ArgsStringNode = Node.SelectSingleNode("argsstring");

            if (ArgsStringNode != null)
            {
                ArgsString = ConvertToMarkdown(ArgsStringNode);
            }

            IsolatedType = Type;
            if (!String.IsNullOrEmpty(ArgsString))
            {
                IsolatedType += ArgsString;
            }
            if (!String.IsNullOrEmpty(Bitfield))
            {
                IsolatedType += ": " + Bitfield;
            }
            AbbreviatedType = Markdown.Truncate(IsolatedType, 15, "...");

            XmlNodeList SimpleNodes = Node.SelectNodes("detaileddescription/para/simplesect");

            foreach (XmlNode node in SimpleNodes)
            {
                switch (node.Attributes.GetNamedItem("kind").InnerText)
                {
                case "warning":
                    Warnings.Add(ConvertToMarkdown(node.SelectSingleNode("para")).TrimStart(':'));
                    break;
                }
            }

            SnippetText = APISnippets.LoadSnippetTextForSymbol(FullName);
        }
 public static void AddRefLink(string RefId, APIMember Member)
 {
     if (RefIdToMember.ContainsKey(RefId))
     {
         Console.WriteLine("Entity defined twice - {0} ({1})", Member.FullName, RefId);
     }
     else
     {
         RefIdToMember.Add(RefId, Member);
     }
 }
Exemple #7
0
 public static void AddRefLink(string RefId, APIMember Member)
 {
     if (RefIdToMember.ContainsKey(RefId))
     {
         Console.WriteLine("Entity defined twice - {0} ({1})", Member.FullName, RefId);
     }
     else
     {
         RefIdToMember.Add(RefId, Member);
     }
 }
Exemple #8
0
        private static List <KeyValuePair <XmlNode, APIRecord> > ParseRelatives(XmlNode ParentNode, string XPath)
        {
            List <KeyValuePair <XmlNode, APIRecord> > Records = new List <KeyValuePair <XmlNode, APIRecord> >();

            using (XmlNodeList NodeList = ParentNode.SelectNodes(XPath))
            {
                foreach (XmlNode Node in NodeList)
                {
                    XmlAttribute RefAttribute = Node.Attributes["refid"];
                    APIMember    Member       = (RefAttribute != null)? ResolveRefLink(RefAttribute.Value) : null;
                    Records.Add(new KeyValuePair <XmlNode, APIRecord>(Node, Member as APIRecord));
                }
            }
            return(Records);
        }
Exemple #9
0
        public void AddStat(APIMember Member, string Name, string BriefDescription, string DetailedDescription)
        {
            Stat NewStat = AddStat(Member, Name);

            if (NewStat != null)
            {
                if (Utility.IsNullOrWhitespace(BriefDescription) && Utility.IsNullOrWhitespace(DetailedDescription))
                {
                    NewStat.NumUndocumented++;
                }
                else
                {
                    NewStat.NumDocumented++;
                }
            }
        }
Exemple #10
0
        public static string ResolveDoxygenLink(string RefId)
        {
            APIMember Member = ResolveRefLink(RefId);

            return((Member == null) ? null : Member.LinkPath);
        }
Exemple #11
0
 public Entry(APIMember Member)
 {
     Name     = Member.FullName;
     SortName = Name;
     LinkPath = Member.LinkPath;
 }
Exemple #12
0
		public void AddStat(APIMember Member, string Name, string BriefDescription, string DetailedDescription)
		{
			Stat NewStat = AddStat(Member, Name);
			if (NewStat != null)
			{
				if(Utility.IsNullOrWhitespace(BriefDescription) && Utility.IsNullOrWhitespace(DetailedDescription))
				{
					NewStat.NumUndocumented++;
				}
				else
				{
					NewStat.NumDocumented++;
				}
			}
		}
Exemple #13
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 void Link()
 {
     APIMember.ParseBriefAndFullDescription(Node, out BriefDescription, out FullDescription);
 }
Exemple #15
0
			public Entry(APIMember Member)
			{
				Name = Member.FullName;
				SortName = Name;
				LinkPath = Member.LinkPath;
			}
        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 #17
0
 public static void FindAllMatchingParents(APIMember Member, List<APIMember> Members, string[] FilterPaths)
 {
     if (Utility.MatchPath(Member.LinkPath + "\\", FilterPaths))
     {
         Members.Add(Member);
     }
     else
     {
         foreach (APIMember Child in Member.Children)
         {
             FindAllMatchingParents(Child, Members, FilterPaths);
         }
     }
 }
Exemple #18
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;
		}
Exemple #19
0
        public static void FindAllMembers(APIMember Member, List<APIMember> Members)
        {
            Members.Add(Member);

            foreach (APIMember Child in Member.Children)
            {
                FindAllMembers(Child, Members);
            }
        }