private void LoadEnum( UmlTypeHolder scope, EnumDecl decl, UsingBlock usings ) { // get cl from old classes, or create a new one UmlEnum en = null; foreach( UmlType ent in scope.Types ) { if( ent.name.Equals( decl.name.identifier ) && ent is UmlEnum ) { en = (UmlEnum)ent; break; } } if( en == null ) { en = new UmlEnum(); scope.Types.Add( en ); added_classes.Add( en ); } // register class classes[en] = decl; // fill with information en.Deleted = false; en.name = decl.name.identifier; }
private void LoadDelegate( UmlTypeHolder scope, DelegateNode decl, UsingBlock usings ) { // get cl from old classes, or create a new one UmlDelegate deleg = null; foreach( UmlType ent in scope.Types ) { if( ent.name.Equals( decl.name.identifier ) && ent is UmlDelegate ) { deleg = (UmlDelegate)ent; break; } } if( deleg == null ) { deleg = new UmlDelegate(); scope.Types.Add( deleg ); added_classes.Add( deleg ); } // register class classes[deleg] = decl; // fill with information deleg.Deleted = false; deleg.name = decl.name.identifier; }
private void FillNamespace( UmlNamespace curr, NamespaceDecl nsnode, UsingBlock usings ) { if( nsnode != null && nsnode.members != null ) { usings = create_Usings( nsnode, usings, curr ); foreach( Node n in nsnode.members.nodes ) { switch( n.kind ) { case Kind.Interface: case Kind.Struct: case Kind.Class: LoadClass( curr, (ClassDecl)n, usings ); break; case Kind.Delegate: LoadDelegate( curr, (DelegateNode)n, usings ); break; case Kind.Enum: LoadEnum( curr, (EnumDecl)n, usings ); break; case Kind.Namespace: NamespaceDecl nsdecl = (NamespaceDecl)n; FillNamespace( EnsureNamespaceCreated( curr, nsdecl.name.identifier ), nsdecl, usings ); break; } } } }
private void LoadClass( UmlTypeHolder scope, ClassDecl decl, UsingBlock usings ) { // get cl from old classes, or create a new one UmlClass cl = null; foreach( UmlType ent in scope.Types ) { if( ent.name.Equals( decl.name.identifier ) && ent is UmlClass ) { cl = (UmlClass)ent; break; } } if( cl == null ) { cl = new UmlClass(); scope.Types.Add( cl ); added_classes.Add( cl ); } // register class classes[cl] = decl; // fill with information switch( decl.kind ) { case Kind.Class: cl.kind = UmlKind.Class; break; case Kind.Interface: cl.kind = UmlKind.Interface; break; case Kind.Struct: cl.kind = UmlKind.Struct; break; } cl.name = decl.name.identifier; cl.using_chain = usings; cl.Deleted = false; cl.IsAbstract = ( decl.modifiers != null && (decl.modifiers.value & (int)Modifiers.Abstract) != 0 ); FillClassWithTypes( cl, decl ); }
private UsingBlock create_Usings( NamespaceDecl node, UsingBlock prev, UmlNamespace assoc_with ) { if( node.usings != null && node.usings.nodes.Count > 0 ) { UsingBlock newblock = new UsingBlock(); newblock.parent = prev; newblock.list = new ArrayList(); newblock.aliases = new Hashtable(); newblock.related = assoc_with; foreach( UsingNode un in node.usings.nodes ) { if( un.alias_id != null ) newblock.aliases[un.alias_id.identifier] = un.type_name.identifier; else newblock.list.Add( un.type_name.identifier ); } return newblock; } return prev; }