Ejemplo n.º 1
0
        public DoxygenSourceFile FindSourceFile(string InFileName)
        {
            string NormalizedFileName = DoxygenSourceFile.NormalizeFileName(InFileName);

            foreach (DoxygenSourceFile SourceFile in SourceFiles)
            {
                if (SourceFile.NormalizedFileName == NormalizedFileName)
                {
                    return(SourceFile);
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        protected static DoxygenSourceFile ReadSourceFile(string BaseXmlDir, string CompoundId)
        {
            string XmlFileName = Path.Combine(BaseXmlDir, CompoundId + ".xml");

            XmlDocument Document;

            if (TryReadXmlDocument(XmlFileName, out Document))
            {
                DoxygenSourceFile SourceFile = DoxygenSourceFile.FromXml(Document.SelectSingleNode("doxygen/compounddef"));
                return(SourceFile);
            }
            else
            {
                Console.WriteLine("Couldn't read source document: '{0}'", XmlFileName);
                return(null);
            }
        }
Ejemplo n.º 3
0
        public static DoxygenSourceFile FromXml(XmlNode Node)
        {
            XmlNode LocationNode = Node.SelectSingleNode("location");

            if (LocationNode == null)
            {
                return(null);
            }

            DoxygenSourceFile SourceFile = new DoxygenSourceFile(LocationNode.Attributes["file"].InnerText);

            foreach (XmlNode CodeLineNode in Node.SelectNodes("programlisting/codeline"))
            {
                int CodeLineIdx = int.Parse(CodeLineNode.Attributes["lineno"].InnerText) - 1;
                while (CodeLineIdx >= SourceFile.Lines.Count)
                {
                    SourceFile.Lines.Add(null);
                }
                SourceFile.Lines[CodeLineIdx] = CodeLineNode;
            }
            return(SourceFile);
        }
Ejemplo n.º 4
0
        public static DoxygenModule TryRead(string Name, string BaseSrcDir, string BaseXmlDir)
        {
            // Load the index
            XmlDocument Document;

            if (!TryReadXmlDocument(Path.Combine(BaseXmlDir, "index.xml"), out Document))
            {
                return(null);
            }

            // Create all the compound entities
            List <string> CompoundIdList = new List <string>();

            using (XmlNodeList NodeList = Document.SelectNodes("doxygenindex/compound"))
            {
                foreach (XmlNode Node in NodeList)
                {
                    CompoundIdList.Add(Node.Attributes["refid"].Value);
                }
            }

            // Read all the compound id nodes
            List <DoxygenCompound> Compounds = new List <DoxygenCompound>();

            foreach (string CompoundId in CompoundIdList)
            {
                string      EntityPath = Path.Combine(BaseXmlDir, CompoundId + ".xml");
                XmlDocument EntityDocument;
                if (TryReadXmlDocument(EntityPath, out EntityDocument))
                {
                    Compounds.Add(DoxygenCompound.FromXml(EntityDocument.SelectSingleNode("doxygen/compounddef")));
                }
                else
                {
                    Console.WriteLine("Couldn't read entity document: '{0}'", EntityPath);
                }
            }

            // Create the module
            DoxygenModule Module = new DoxygenModule(Name, BaseSrcDir);

            // Create all the other namespaces
            Dictionary <string, DoxygenEntity> Scopes = new Dictionary <string, DoxygenEntity>();

            foreach (DoxygenCompound Compound in Compounds)
            {
                if (Compound.Kind == "file")
                {
                    ReadMembers(Module, Compound, "", null, null, Module.Entities);
                    DoxygenSourceFile SourceFile = DoxygenSourceFile.FromXml(Compound.Node);
                    if (SourceFile != null)
                    {
                        Module.SourceFiles.Add(SourceFile);
                    }
                }
                else if (Compound.Kind == "namespace")
                {
                    ReadMembers(Module, Compound, Compound.Name + "::", null, Compound.Node, Module.Entities);
                }
                else if (Compound.Kind == "class" || Compound.Kind == "struct" || Compound.Kind == "union")
                {
                    DoxygenEntity Entity = DoxygenEntity.FromXml(Module, Compound.Name, Compound.Node, null);
                    ReadMembers(Module, Compound, "", Entity, null, Entity.Members);
                    Scopes.Add(Entity.Name, Entity);
                }
            }

            // Go back over all the scopes and fixup their parents
            foreach (KeyValuePair <string, DoxygenEntity> Scope in Scopes)
            {
                int ScopeIdx = Scope.Key.LastIndexOf("::");
                if (ScopeIdx != -1 && Scopes.TryGetValue(Scope.Key.Substring(0, ScopeIdx), out Scope.Value.Parent))
                {
                    Scope.Value.Parent.Members.Add(Scope.Value);
                }
                else
                {
                    Module.Entities.Add(Scope.Value);
                }
            }

            // Create the module
            return(Module);
        }
Ejemplo n.º 5
0
        public static DoxygenSourceFile FromXml(XmlNode Node)
        {
            XmlNode LocationNode = Node.SelectSingleNode("location");
            if(LocationNode == null) return null;

            DoxygenSourceFile SourceFile = new DoxygenSourceFile(LocationNode.Attributes["file"].InnerText);
            foreach(XmlNode CodeLineNode in Node.SelectNodes("programlisting/codeline"))
            {
                int CodeLineIdx = int.Parse(CodeLineNode.Attributes["lineno"].InnerText) - 1;
                while(CodeLineIdx >= SourceFile.Lines.Count)
                {
                    SourceFile.Lines.Add(null);
                }
                SourceFile.Lines[CodeLineIdx] = CodeLineNode;
            }
            return SourceFile;
        }