ArgStringWithoutTypes() 공개 메소드

public ArgStringWithoutTypes ( ) : string
리턴 string
예제 #1
0
        public void ParseSectionDefElement(Symbol parent, XmlElement e)
        {
            foreach(XmlElement child in e.ChildNodes)
            {
                if (child.Name == "memberdef")
                {
                    Symbol member = new Symbol();
                    member.parent = parent;
                    member.id = child.GetAttribute("id");
                    member.kind = child.GetAttribute("kind");
                    member.visibilityLevel = ParseVisibilityLevel(child.GetAttribute("prot"));
                    member.isStatic = (child.GetAttribute("static") == "yes");
                    member.isConst = (child.GetAttribute("const") == "yes");
                    member.isMutable = (child.GetAttribute("mutable") == "yes");
                    member.isExplicit = (child.GetAttribute("explicit") == "yes");
                    member.virtualness = ParseVirtualness(child.GetAttribute("virt"));
                    member.type = GetXmlElementChildNodeValue(child, "type", true);
                    member.fullDefinition = GetXmlElementChildNodeValue(child, "definition");
                    member.argList = GetXmlElementChildNodeValue(child, "argsstring");

                    // Sanitate return type of certain MathGeoLib constructs
                    if (member.kind == "function")
                    {
                        member.type = member.type.Replace("CONST_WIN32", "");
                        member.type = member.type.Replace("MUST_USE_RESULT", "");
                    }

                    member.classMemberIndexTitle = member.name = GetXmlElementChildNodeValue(child, "name");
                    if (member.name.StartsWith("@"))
                        continue; // Doxygen creates items with names starting with '@' at least for unnamed unions, ignore those altogether.
                    symbols[member.id] = member;
                    //symbolsByName[member.name] = member;
                    parent.children.Add(member);

                    // Function parameters.
                    foreach(XmlElement param in child.ChildNodes.OfType<XmlElement>())
                        if (param.Name == "param")
                        {
                            Parameter p = new Parameter();
                            if (member.kind == "define") // This is a #define macro.
                            {
                                p.type = "";
                                p.name = GetXmlElementChildNodeValue(param, "defname");
                            }
                            else // This is a real function
                            {
                                p.type = GetXmlElementChildNodeValue(param, "type", true);
                                p.name = GetXmlElementChildNodeValue(param, "declname");
                                p.defaultValue = GetXmlElementChildNodeValue(param, "defval", true);
                            }
                            member.parameters.Add(p);
                        }

                    // Enum special handling
                    if (member.kind == "enum")
                    {
                        int lastEnumInitializer = -1;

                        foreach (XmlElement value in child.ChildNodes.OfType<XmlElement>())
                        {
                            if (value.Name == "enumvalue")
                            {
                                Symbol valueSymbol = new Symbol();
                                valueSymbol.parent = member;
                                valueSymbol.id = value.GetAttribute("id");
                                valueSymbol.name = GetXmlElementChildNodeValue(value, "name", true);
                                valueSymbol.kind = "enumvalue";
                                valueSymbol.value = GetXmlElementChildNodeValue(value, "initializer", true).Replace("= ", "");
                                if (valueSymbol.value.Length == 0)
                                {
                                    ++lastEnumInitializer;
                                    valueSymbol.value = lastEnumInitializer.ToString();
                                }
                                else
                                    Int32.TryParse(valueSymbol.value, out lastEnumInitializer);
                                member.children.Add(valueSymbol);
                            }
                        }
                        enumsByName[member.name] = member;
                    }

                    // If this is a #define macro, get the macro body code.
                    if (member.kind == "define")
                    {
                        member.macroBody = GetXmlElementChildNodeValue(child, "initializer");
                        // Create the argList from scratch, because it is not present in the xml in same form than for functions.
                        member.argList = member.ArgStringWithoutTypes();
                    }

                    // Function parameter comments.
                    List<XmlElement> parameters = child.AllGrandChildElementsOfTypeAndAttribute("parameterlist", "kind", "param");
                    if (parameters != null && parameters.Count > 0)
                    {
                        foreach (XmlElement paramNode in parameters.OfType<XmlElement>())
                        {
                            foreach (XmlElement param in paramNode.ChildNodes.OfType<XmlElement>())
                            {
                                if (param.Name == "parameteritem")
                                {
                                    string paramName = param.FirstChildElementOfType("parameternamelist").FirstChildElementOfType("parametername").InnerText.Trim();
                                    Parameter p = member.FindParamByName(paramName);
                                    if (p != null)
                                        p.comment = param.FirstChildElementOfType("parameterdescription").InnerText;
                                }
                            }
                            // Remove the parameterlist from the detailed description node so that it won't appear in the 'detailedDescription' documentation string.
                            // The detailed description is created manually.
                            paramNode.ParentNode.RemoveChild(paramNode);
                        }
                    }

                    // TODOs ^ BUGs 
                    List<XmlElement> xrefsects = child.AllGrandChildElementsOfType("xrefsect");
                    if (xrefsects != null)
                    {
                        foreach (XmlElement elem in xrefsects)
                        {
                            if (GetXmlElementChildNodeValue(elem, "xreftitle") == "Todo")
                                member.todos.Add(GetXmlElementChildNodeValue(elem, "xrefdescription"));
                            if (GetXmlElementChildNodeValue(elem, "xreftitle") == "Bug")
                                member.bugs.Add(GetXmlElementChildNodeValue(elem, "xrefdescription"));
                            elem.ParentNode.RemoveChild(elem);
                        }
                    }

                    // @notes.
                    List<XmlElement> notesects = child.AllGrandChildElementsOfTypeAndAttribute("simplesect", "kind", "note");
                    if (notesects != null)
                    {
                        foreach (XmlElement elem in notesects)
                        {
                            member.notes.Add(elem.InnerText);
                            elem.ParentNode.RemoveChild(elem);
                        }
                    }

                    // Function return value.
                    XmlElement retVal = child.FirstGrandChildElementOfTypeAndAttribute("simplesect", "kind", "return");
                    if (retVal != null)
                    {
                        member.returnComment = retVal.InnerText;
                        retVal.ParentNode.RemoveChild(retVal);
                    }

                    // The "see also" section.
                    XmlElement see = child.FirstGrandChildElementOfTypeAndAttribute("simplesect", "kind", "see");
                    if (see != null)
                    {
                        member.seeAlsoDocumentation = see.InnerXml;
                        see.ParentNode.RemoveChild(see);
                    }

                    member.briefDescription = GetXmlElementChildNodeValue(child, "briefdescription").Trim();
                    member.inbodyDescription = GetXmlElementChildNodeValue(child, "inbodydescription").Trim();
                    member.detailedDescription = GetXmlElementChildNodeValue(child, "detaileddescription").Trim();
                    XmlElement loc = child.FirstChildElementOfType("location");
                    if (loc != null)
                    {
                        member.sourceFilename = loc.GetAttribute("bodyfile");
                        int.TryParse(loc.GetAttribute("bodystart"), out member.sourceFileStartLine);
                        int.TryParse(loc.GetAttribute("bodyend"), out member.sourceFileEndLine);
                        if (member.sourceFileEndLine == -1)
                            member.sourceFileEndLine = member.sourceFileStartLine;
                    }
                    ProcessDocGeneratorCommentDirectives(member);

                    ///\todo Add location.
                }
            }            
        }
예제 #2
0
        public void ParseSectionDefElement(Symbol parent, XmlElement e)
        {
            foreach (XmlElement child in e.ChildNodes)
            {
                if (child.Name == "memberdef")
                {
                    Symbol member = new Symbol();
                    member.parent          = parent;
                    member.id              = child.GetAttribute("id");
                    member.kind            = child.GetAttribute("kind");
                    member.visibilityLevel = ParseVisibilityLevel(child.GetAttribute("prot"));
                    member.isStatic        = (child.GetAttribute("static") == "yes");
                    member.isConst         = (child.GetAttribute("const") == "yes");
                    member.isMutable       = (child.GetAttribute("mutable") == "yes");
                    member.isExplicit      = (child.GetAttribute("explicit") == "yes");
                    member.virtualness     = ParseVirtualness(child.GetAttribute("virt"));
                    member.type            = GetXmlElementChildNodeValue(child, "type", true);
                    member.fullDefinition  = GetXmlElementChildNodeValue(child, "definition");
                    member.argList         = GetXmlElementChildNodeValue(child, "argsstring");

                    // Sanitate return type of certain MathGeoLib constructs
                    if (member.kind == "function")
                    {
                        member.type = member.type.Replace("CONST_WIN32", "");
                        member.type = member.type.Replace("MUST_USE_RESULT", "");
                    }

                    member.classMemberIndexTitle = member.name = GetXmlElementChildNodeValue(child, "name");
                    if (member.name.StartsWith("@"))
                    {
                        continue; // Doxygen creates items with names starting with '@' at least for unnamed unions, ignore those altogether.
                    }
                    symbols[member.id] = member;
//                    symbolsByName[member.name] = member;
                    parent.children.Add(member);

                    // Function parameters.
                    foreach (XmlElement param in child.ChildNodes.OfType <XmlElement>())
                    {
                        if (param.Name == "param")
                        {
                            Parameter p = new Parameter();
                            if (member.kind == "define") // This is a #define macro.
                            {
                                p.type = "";
                                p.name = GetXmlElementChildNodeValue(param, "defname");
                            }
                            else // This is a real function
                            {
                                p.type = GetXmlElementChildNodeValue(param, "type", true);
                                p.name = GetXmlElementChildNodeValue(param, "declname");
                            }
                            member.parameters.Add(p);
                        }
                    }

                    // If this is a #define macro, get the macro body code.
                    if (member.kind == "define")
                    {
                        member.macroBody = GetXmlElementChildNodeValue(child, "initializer");
                        // Create the argList from scratch, because it is not present in the xml in same form than for functions.
                        member.argList = member.ArgStringWithoutTypes();
                    }

                    // Function parameter comments.
                    List <XmlElement> parameters = child.AllGrandChildElementsOfTypeAndAttribute("parameterlist", "kind", "param");
                    if (parameters != null && parameters.Count > 0)
                    {
                        foreach (XmlElement paramNode in parameters.OfType <XmlElement>())
                        {
                            foreach (XmlElement param in paramNode.ChildNodes.OfType <XmlElement>())
                            {
                                if (param.Name == "parameteritem")
                                {
                                    string    paramName = param.FirstChildElementOfType("parameternamelist").FirstChildElementOfType("parametername").InnerText.Trim();
                                    Parameter p         = member.FindParamByName(paramName);
                                    if (p != null)
                                    {
                                        p.comment = param.FirstChildElementOfType("parameterdescription").InnerText;
                                    }
                                }
                            }
                            // Remove the parameterlist from the detailed description node so that it won't appear in the 'detailedDescription' documentation string.
                            // The detailed description is created manually.
                            paramNode.ParentNode.RemoveChild(paramNode);
                        }
                    }

                    // TODOs ^ BUGs
                    List <XmlElement> xrefsects = child.AllGrandChildElementsOfType("xrefsect");
                    if (xrefsects != null)
                    {
                        foreach (XmlElement elem in xrefsects)
                        {
                            if (GetXmlElementChildNodeValue(elem, "xreftitle") == "Todo")
                            {
                                member.todos.Add(GetXmlElementChildNodeValue(elem, "xrefdescription"));
                            }
                            if (GetXmlElementChildNodeValue(elem, "xreftitle") == "Bug")
                            {
                                member.bugs.Add(GetXmlElementChildNodeValue(elem, "xrefdescription"));
                            }
                            elem.ParentNode.RemoveChild(elem);
                        }
                    }

                    // @notes.
                    List <XmlElement> notesects = child.AllGrandChildElementsOfTypeAndAttribute("simplesect", "kind", "note");
                    if (notesects != null)
                    {
                        foreach (XmlElement elem in notesects)
                        {
                            member.notes.Add(elem.InnerText);
                            elem.ParentNode.RemoveChild(elem);
                        }
                    }

                    // Function return value.
                    XmlElement retVal = child.FirstGrandChildElementOfTypeAndAttribute("simplesect", "kind", "return");
                    if (retVal != null)
                    {
                        member.returnComment = retVal.InnerText;
                        retVal.ParentNode.RemoveChild(retVal);
                    }

                    // The "see also" section.
                    XmlElement see = child.FirstGrandChildElementOfTypeAndAttribute("simplesect", "kind", "see");
                    if (see != null)
                    {
                        member.seeAlsoDocumentation = see.InnerXml;
                        see.ParentNode.RemoveChild(see);
                    }

                    member.briefDescription    = GetXmlElementChildNodeValue(child, "briefdescription").Trim();
                    member.inbodyDescription   = GetXmlElementChildNodeValue(child, "inbodydescription").Trim();
                    member.detailedDescription = GetXmlElementChildNodeValue(child, "detaileddescription").Trim();
                    XmlElement loc = child.FirstChildElementOfType("location");
                    if (loc != null)
                    {
                        member.sourceFilename = loc.GetAttribute("bodyfile");
                        int.TryParse(loc.GetAttribute("bodystart"), out member.sourceFileStartLine);
                        int.TryParse(loc.GetAttribute("bodyend"), out member.sourceFileEndLine);
                        if (member.sourceFileEndLine == -1)
                        {
                            member.sourceFileEndLine = member.sourceFileStartLine;
                        }
                    }
                    ProcessDocGeneratorCommentDirectives(member);

                    ///\todo Add location.
                }
            }
        }