public static DoxygenCompound FromXml(XmlNode Node) { DoxygenCompound Compound = new DoxygenCompound(); Compound.Id = Node.Attributes["id"].Value; Compound.Kind = Node.Attributes["kind"].Value; Compound.Node = Node; XmlNode NameNode = Node.SelectSingleNode("compoundname"); Compound.Name = (NameNode == null) ? null : NameNode.InnerText; return Compound; }
public static DoxygenCompound FromXml(XmlNode Node) { DoxygenCompound Compound = new DoxygenCompound(); Compound.Id = Node.Attributes["id"].Value; Compound.Kind = Node.Attributes["kind"].Value; Compound.Node = Node; XmlNode NameNode = Node.SelectSingleNode("compoundname"); Compound.Name = (NameNode == null) ? null : NameNode.InnerText; return(Compound); }
protected static void ReadMembers(DoxygenModule Module, DoxygenCompound Compound, string NamePrefix, DoxygenEntity Parent, XmlNode NamespaceNode, List <DoxygenEntity> Entities) { using (XmlNodeList NodeList = Compound.Node.SelectNodes("sectiondef/memberdef")) { foreach (XmlNode Node in NodeList) { XmlNode NameNode = Node.SelectSingleNode("name"); string Name = NamePrefix + NameNode.InnerText; DoxygenEntity Entity = DoxygenEntity.FromXml(Module, Name, Node, NamespaceNode); Entity.Parent = Parent; Entities.Add(Entity); } } }
protected static void ReadMembers(DoxygenModule Module, DoxygenCompound Compound, string NamePrefix, DoxygenEntity Parent, XmlNode NamespaceNode, List<DoxygenEntity> Entities) { using (XmlNodeList NodeList = Compound.Node.SelectNodes("sectiondef/memberdef")) { foreach (XmlNode Node in NodeList) { XmlNode NameNode = Node.SelectSingleNode("name"); string Name = NamePrefix + NameNode.InnerText; DoxygenEntity Entity = DoxygenEntity.FromXml(Module, Name, Node, NamespaceNode); Entity.Parent = Parent; Entities.Add(Entity); } } }
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 == "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); }