private void VisitTypeDeclaration(TypeDeclarationSyntax node, Action visitBase)
        {
            if (SkipInnerTypeDeclaration(node))
            {
                return;
            }

            _inheritanceRelationsips.AddFrom(node);

            var modifiers = GetTypeModifiersText(node.Modifiers);
            var keyword   = (node.Modifiers.Any(SyntaxKind.AbstractKeyword) ? "abstract " : "")
                            + node.Keyword.ToString();

            var typeName  = TypeNameText.From(node);
            var name      = typeName.Identifier;
            var typeParam = typeName.TypeArguments;

            WriteLine($"{keyword} {name}{typeParam} {modifiers}{{");

            nestingDepth++;
            visitBase();
            nestingDepth--;

            WriteLine("}");
        }
        private void GenerateInnerTypeDeclarations()
        {
            foreach (var node in _innerTypeDeclarationNodes)
            {
                var generator = new ClassDiagramGenerator(writer, indent);
                generator.GenerateInternal(node);

                var outerTypeNode = node.Parent as BaseTypeDeclarationSyntax;
                var innerTypeNode = node as BaseTypeDeclarationSyntax;
                if (outerTypeNode != null && innerTypeNode != null)
                {
                    var outerTypeName = TypeNameText.From(outerTypeNode);
                    var innerTypeName = TypeNameText.From(innerTypeNode);
                    WriteLine($"{outerTypeName.Identifier} +-- {innerTypeName.Identifier}");
                }
            }
        }
        public void AddFrom(TypeDeclarationSyntax syntax)
        {
            if (syntax.BaseList == null)
            {
                return;
            }

            var subTypeName = TypeNameText.From(syntax);

            foreach (var typeStntax in syntax.BaseList.Types)
            {
                var typeNameSyntax = typeStntax.Type as SimpleNameSyntax;
                if (typeNameSyntax == null)
                {
                    continue;
                }
                var baseTypeName = TypeNameText.From(typeNameSyntax);
                _items.Add(new InheritanceRelationsip(baseTypeName, subTypeName));
            }
        }
        public override void VisitStructDeclaration(StructDeclarationSyntax node)
        {
            if (SkipInnerTypeDeclaration(node))
            {
                return;
            }

            _inheritanceRelationsips.AddFrom(node);

            var typeName  = TypeNameText.From(node);
            var name      = typeName.Identifier;
            var typeParam = typeName.TypeArguments;

            WriteLine($"class {name}{typeParam} <<struct>> {{");

            nestingDepth++;
            base.VisitStructDeclaration(node);
            nestingDepth--;

            WriteLine("}");
        }
 public InheritanceRelationsip(TypeNameText baseTypeName, TypeNameText subTypeName)
 {
     _baseTypeName = baseTypeName;
     _subTypeName = subTypeName;
 }
 public InheritanceRelationsip(TypeNameText baseTypeName, TypeNameText subTypeName)
 {
     _baseTypeName = baseTypeName;
     _subTypeName  = subTypeName;
 }