示例#1
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();
        }
示例#2
0
        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);
        }