[csdoc-patches] CVS: csdoc/src/csdoc/MCSDoc NamespaceDoc.cs,NONE,1.1 ChangeLog,1.8,1.9 ClassDoc.cs,1
Status: Planning
Brought to you by:
mastergaurav
Update of /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc
In directory sc8-pr-cvs1:/tmp/cvs-serv7726
Modified Files:
ChangeLog ClassDoc.cs IAttributeDoc.cs IContainerDoc.cs
IInterfaceDoc.cs INamespaceDoc.cs RootDoc.cs
Added Files:
NamespaceDoc.cs
Log Message:
2003-03-28
* ClassDoc.cs : Parse() - Some impl.
* RootDoc.cs : PopulateTypeContainers - Init Impl.
* NamespaceDoc.cs : Initial implementation.
* INamespaceDoc.cs : No Attributes to a namespace. Ok!
* IAttributeDoc.cs,
* IInterfaceDoc.cs,
* IContainerDoc.cs : Name { get; } - Added.
* IAttributeDoc.cs : Now derives from IContainerDoc
--- NEW FILE ---
/**
* Project: Master C# Document Generator
* Contact: mas...@us...
* Web: http://csdoc.sourceforge.net
*
* Copyright: (C) 2003, Gaurav Vaish
*
*/
using System;
using System.Collections;
using Mono.CSharp;
namespace MCSDoc
{
internal class NamespaceDoc : INamespaceDoc
{
private string comments;
private string name;
ArrayList classes = new ArrayList();
ArrayList structs = new ArrayList();
ArrayList delegates = new ArrayList();
ArrayList enums = new ArrayList();
ArrayList interfaces = new ArrayList();
public NamespaceDoc(string name)
{
this.name = name;
}
public NamespaceDoc(string name, string filename) : this(name)
{
throw new NotImplementedException();
}
public void AddClassDoc(IClassDoc doc)
{
classes.Add(doc);
}
public void AddStructDoc(IStructDoc doc)
{
structs.Add(doc);
}
public void SetDelegateDoc(IDelegateDoc doc)
{
delegates.Add(doc);
}
public void SetEnumDoc(IEnumDoc doc)
{
enums.Add(doc);
}
public void AddInterfaceDoc(IInterfaceDoc doc)
{
interfaces.Add(doc);
}
public string Comments
{
get
{
return comments;
}
}
public IClassDoc[] Classes
{
get
{
return (IClassDoc[]) classes.ToArray(typeof(IClassDoc));
}
}
public IDelegateDoc[] Delegates
{
get
{
return (IDelegateDoc[]) delegates.ToArray(typeof(IDelegateDoc));
}
}
public IEnumDoc[] Enums
{
get
{
return (IEnumDoc[]) enums.ToArray(typeof(IEnumDoc));
}
}
public IInterfaceDoc[] Interfaces
{
get
{
return (IInterfaceDoc[]) interfaces.ToArray(typeof(IInterfaceDoc));
}
}
public IStructDoc[] Structs
{
get
{
return (IStructDoc[]) interfaces.ToArray(typeof(IStructDoc));
}
}
}
}
Index: ChangeLog
===================================================================
RCS file: /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc/ChangeLog,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ChangeLog 28 Mar 2003 10:17:40 -0000 1.8
+++ ChangeLog 28 Mar 2003 14:23:53 -0000 1.9
@@ -1,6 +1,17 @@
2003-03-28 Gaurav Vaish <mastergaurav AT users DOT sf DOT net>
+ * ClassDoc.cs : Parse() - Some impl.
+ * RootDoc.cs : PopulateTypeContainers - Init Impl.
+ * NamespaceDoc.cs : Initial implementation.
+ * INamespaceDoc.cs : No Attributes to a namespace. Ok!
+ * IAttributeDoc.cs,
+ * IInterfaceDoc.cs,
+ * IContainerDoc.cs : Name { get; } - Added.
+ * IAttributeDoc.cs : Now derives from IContainerDoc
+
+2003-03-28 Gaurav Vaish <mastergaurav AT users DOT sf DOT net>
+
* RootDoc.cs : Stubbed PopulateXXXX methods
* DocTreeGenerator.cs : Looks like won't need it in future
Index: ClassDoc.cs
===================================================================
RCS file: /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc/ClassDoc.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ClassDoc.cs 27 Mar 2003 17:57:17 -0000 1.2
+++ ClassDoc.cs 28 Mar 2003 14:23:55 -0000 1.3
@@ -15,10 +15,11 @@
{
public class ClassDoc : IClassDoc
{
- private Class klass;
- private bool isException;
- private bool isAttribute;
-
+ private Class klass;
+ private string name;
+ private bool isException = false;
+ private bool isAttribute = false;
+
private IClassDoc baseClass = null;
private IInterfaceDoc[] interfaces = null;
private IContainerDoc container = null;
@@ -29,7 +30,7 @@
// need to Set - BaseClass, Interfaces, Container
throw new NotImplementedException();
}
-
+
private void Parse()
{
/*
@@ -39,6 +40,19 @@
//
}
*/
+ if(klass.BaseType != null)
+ {
+ isAttribute = klass.BaseType.IsSubclassOf(typeof(Attribute));
+ isException = klass.BaseType.IsSubclassOf(typeof(Exception));
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
}
public bool IsContained
@@ -80,7 +94,7 @@
return interfaces;
}
}
-
+
public IContainerDoc Container
{
get
Index: IAttributeDoc.cs
===================================================================
RCS file: /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc/IAttributeDoc.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IAttributeDoc.cs 22 Mar 2003 07:43:45 -0000 1.1
+++ IAttributeDoc.cs 28 Mar 2003 14:23:55 -0000 1.2
@@ -12,15 +12,9 @@
namespace MCSDoc
{
- public interface IAttributeDoc
+ public interface IAttributeDoc : IClassDoc
{
- string Comments { get; }
- AccessFlags Flags { get; }
+ AccessFlags Flags { get; }
AttributeTargets Targets { get; }
-
- IAttributeDoc[] Attributes { get; }
- IMethodDoc[] Methods { get; }
- IPropertyDoc[] Properties { get; }
- IMemberDoc[] Members { get; }
}
}
Index: IContainerDoc.cs
===================================================================
RCS file: /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc/IContainerDoc.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IContainerDoc.cs 27 Mar 2003 17:57:18 -0000 1.2
+++ IContainerDoc.cs 28 Mar 2003 14:23:55 -0000 1.3
@@ -14,6 +14,7 @@
public interface IContainerDoc
{
string Comments { get; }
+ string Name { get; }
AccessFlags Flags { get; }
bool IsContained { get; }
Index: IInterfaceDoc.cs
===================================================================
RCS file: /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc/IInterfaceDoc.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IInterfaceDoc.cs 22 Mar 2003 07:43:45 -0000 1.1
+++ IInterfaceDoc.cs 28 Mar 2003 14:23:55 -0000 1.2
@@ -14,6 +14,7 @@
public interface IInterfaceDoc
{
string Comments { get; }
+ string Name { get; }
AccessFlags Flags { get; }
IAttributeDoc[] Attributes { get; }
Index: INamespaceDoc.cs
===================================================================
RCS file: /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc/INamespaceDoc.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- INamespaceDoc.cs 9 Mar 2003 15:17:29 -0000 1.2
+++ INamespaceDoc.cs 28 Mar 2003 14:23:56 -0000 1.3
@@ -13,9 +13,9 @@
{
public interface INamespaceDoc
{
- string Comments { get; }
+ string Comments { get; }
+ string Name { get; }
- IAttributeDoc[] Attributes { get; }
IClassDoc[] Classes { get; }
IDelegateDoc[] Delegates { get; }
IEnumDoc[] Enums { get; }
Index: RootDoc.cs
===================================================================
RCS file: /cvsroot/csdoc/csdoc/src/csdoc/MCSDoc/RootDoc.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RootDoc.cs 28 Mar 2003 10:17:40 -0000 1.4
+++ RootDoc.cs 28 Mar 2003 14:23:57 -0000 1.5
@@ -8,18 +8,21 @@
*/
using System;
+using System.Collections;
using Mono.CSharp;
namespace MCSDoc
{
internal class RootDoc : IRootDoc
{
- INamespaceDoc[] namespaces;
- IClassDoc[] classes;
- IStructDoc[] structs;
- IDelegateDoc[] delegates;
- IEnumDoc[] enums;
- IInterfaceDoc[] interfaces;
+ INamespaceDoc[] namespaces = null;
+ IClassDoc[] classes = null;
+ IStructDoc[] structs = null;
+ IDelegateDoc[] delegates = null;
+ IEnumDoc[] enums = null;
+ IInterfaceDoc[] interfaces = null;
+
+ ArrayList namespaceList = new ArrayList();
public RootDoc(TypeContainer root)
{
@@ -28,12 +31,86 @@
private void Parse(TypeContainer root)
{
+ PopulateContainers(root.Types);
throw new NotImplementedException();
}
+ private void PopulateNamespaces()
+ {
+ if(namespaceList.Count > 0)
+ {
+ //namespaces = (INamespaceDoc[]) namespaceList.ToArray(typeof(INamespaceDoc));
+ }
+ }
+
private void PopulateContainers(ArrayList containers)
{
- //classes and structs
+ if(containers != null || containers.Count > 0)
+ {
+ ArrayList classes = new ArrayList();
+ ArrayList structs = new ArrayList();
+
+ foreach(TypeContainer tc in containers)
+ {
+ if(tc is Class)
+ {
+ Class c = (Class)tc;
+ ClassDoc cd = new ClassDoc(c);
+ if(c.Namespace != null && c.Namespace.Name.Length > 0)
+ {
+ HandleNamespaceClass(c, cd);
+ }
+ // process ClassDoc
+ classes.Add(cd);
+ }
+ if(tc is Struct)
+ {
+ Struct s = (Struct)tc;
+ StructDoc sd = new StructDoc(s);
+ if(s.Namespace != null && s.Namespace.Name.Length > 0)
+ {
+ HandleNamespaceStruct(s, sd);
+ }
+ // process StructDoc
+ structs.Add(sd);
+ }
+ PopulateInners(tc.Types);
+ }
+ }
+ }
+
+ private NamespaceDoc NamespaceLookup(string name)
+ {
+ foreach(NamespaceDoc current in namespaceList)
+ {
+ if(current.Name == name)
+ return current;
+ }
+ return null;
+ }
+
+ private void HandleNamespaceClass(Class klass, ClassDoc doc)
+ {
+ NamespaceDoc nsd = NamespaceLookup(klass.Namespace.Name);
+ if(nsd == null)
+ {
+ nsd = new NamespaceDoc(klass.Namespace.Name);
+ }
+ nsd.AddClassDoc(doc);
+ }
+
+ private void HandleNamespaceStruct(Struct esstruct, StructDoc doc)
+ {
+ NamespaceDoc nsd = NamespaceLookup(esstruct.Namespace.Name);
+ if(nsd == null)
+ {
+ nsd = new NamespaceDoc(esstruct.Namespace.Name);
+ }
+ nsd.AddStructDoc(doc);
+ }
+
+ private void PopulateInners(ArrayList types)
+ {
throw new NotImplementedException();
}
|