Thread: [csdoc-patches] CVS: csdoc/src/csdoc/MCSDoc AttributeDoc.cs,NONE,1.1 ChangeLog,1.10,1.11 DocTreeGene
Status: Planning
Brought to you by:
mastergaurav
From: Gaurav V. <mas...@us...> - 2003-04-01 16:04:19
|
Update of /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc In directory sc8-pr-cvs1:/tmp/cvs-serv22343 Modified Files: ChangeLog DocTreeGenerator.cs RootDoc.cs Added Files: AttributeDoc.cs Log Message: 2003-04-01 * AttributeDoc.cs : Oops! Forgot to add last time. * RootDoc.cs : Don't parse here. * DocTreeGenerator.cs : Making it come to use. --- NEW FILE --- /** * Project: Master C# Document Generator * Contact: mas...@us... * Web: http://csdoc.sourceforge.net * * Copyright: (C) 2003, Gaurav Vaish * */ using Mono.CSharp; using System; namespace MCSDoc { internal class AttributeDoc : ClassDoc, IAttributeDoc { private AccessFlags flags; private AttributeTargets targets; public AttributeDoc(Class klass) : base(klass) { if(!base.IsAttribute) throw new Exception("[AttributeDoc] Class is not an attribute"); } public AccessFlags Flags { get { throw new NotImplementedException() } } public AttributeTargets Targets { get { throw new NotImplementedException() } } } } Index: ChangeLog =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ChangeLog 28 Mar 2003 15:30:17 -0000 1.10 +++ ChangeLog 1 Apr 2003 16:04:09 -0000 1.11 @@ -1,4 +1,10 @@ +2003-04-01 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * AttributeDoc.cs : Oops! Forgot to add last time. + * RootDoc.cs : Don't parse here. + * DocTreeGenerator.cs : Making it come to use. + 2003-03-28 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * RootDoc.cs : Populated all. Will take a second Index: DocTreeGenerator.cs =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc/DocTreeGenerator.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DocTreeGenerator.cs 28 Mar 2003 10:17:40 -0000 1.4 +++ DocTreeGenerator.cs 1 Apr 2003 16:04:09 -0000 1.5 @@ -9,6 +9,7 @@ using Mono.CSharp; using System; +using System.Collections; namespace MCSDoc { @@ -17,16 +18,118 @@ private TypeContainer root; private RootDoc rootDoc; + private ArrayList allNamespaces; + private ArrayList allClasses; + private ArrayList allStructs; + private ArrayList allDelegates; + private ArrayList allEnums; + private ArrayList allInterfaces; + public DocTreeGenerator(TypeContainer root) { + if(root == null) + { + throw new ArgumentException("[DocTreeGenerator] Null root"); + } + this.root = root; - rootDoc = new RootDoc(root); - CreateTree(); + //rootDoc = new RootDoc(root); + ParseAndGenerate(); } - private void CreateTree() + private void ParseAndGenerate() { //rootDoc.Parse(root); + ParseContainers(root.Types); + ParseDelegates(root.Delegates); + ParseEnums(root.Enums); + ParseInterfaces(root.Interfaces); + //First need to populate [allNamespaces] + //GenerateTree(); + } + + private void ParseContainers(ArrayList containers) + { + if(containers != null && containers.Count > 0) + { + foreach(TypeContainer tc in containers) + { + ParseContainer(tc); + } + } + } + + private void ParseContainer(TypeContainer container) + { + if(containers != null) + { + if(container is Class) + { + Class c = (Class) container; + ClassDoc cd = null; + // Is there any better way, since + // [c.BaseType != typeof(System.Attribute)] + if(c.BaseType.ToString() == "System.Attribute") + { + cd = new AttributeDoc(c); + } else + { + cd = new ClassDoc(c); + } + allClasses.Add(cd); + } else if(container is Struct) + { + Struct s = (Struct) container; + sd = new StructDoc(s); + allStructs.Add(sd); + } + //Handle all inner types recursively + ParseContainers(container.Types); + ParseDelegates(container.Delegates); + ParseEnums(container.Enums); + ParseInterfaces(container.Interfaces); + } + } + + private void ParseDelegates(ArrayList delegates) + { + if(delegates != null && delegates.Count > 0) + { + foreach(Delegate deleg in delegates) + { + DelegateDoc dd = new DelegateDoc(deleg); + allDelegates.Add(dd); + } + } + } + + private void ParseEnums(ArrayList enums) + { + if(enums != null && enums.Count > 0) + { + foreach(Mono.CSharp.Enum eenum in enums) + { + EnumDoc ed = new EnumDoc(eenum); + allDelegates.Add(ed); + } + } + } + + private void ParseInterfaces(ArrayList interfaces) + { + if(interfaces != null && interfaces.Count > 0) + { + foreach(Interface interf in interfaces) + { + InterfaceDoc id = new InterfaceDoc(interf); + allInterfaces.Add(id); + } + } + } + + private void GenerateTree() + { + throw new NotImplementedException(); } public IRootDoc RootDoc Index: RootDoc.cs =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc/RootDoc.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- RootDoc.cs 28 Mar 2003 15:30:24 -0000 1.6 +++ RootDoc.cs 1 Apr 2003 16:04:09 -0000 1.7 @@ -26,7 +26,7 @@ public RootDoc(TypeContainer root) { - Parse(root); + //Parse(root); } private void Parse(TypeContainer root) @@ -72,8 +72,7 @@ } // process ClassDoc classes.Add(cd); - } - if(tc is Struct) + } else if(tc is Struct) { Struct s = (Struct)tc; StructDoc sd = new StructDoc(s); |