示例#1
0
        /// <inheritdoc />
        public bool Handle(CodeTypeDeclaration obj, Context ctx)
        {
            DeclarationType type = GeneralUtils.CheckAndGetDeclarationType(obj, ctx);

            if (!CanHandle(type)) //since i'm going to do part of the generation i must make sure i can handle the whole object
            {
                return(false);
            }

            GeneralUtils.HandleCollectionOnMultipleLines(obj.StartDirectives.Cast <CodeDirective>(),
                                                         ctx.HandlerProvider.DirectiveHandler, ctx, false);

            foreach (CodeCommentStatement comment in obj.Comments)
            {
                ctx.HandlerProvider.StatementHandler.Handle(comment, ctx);
                ctx.Writer.NewLine();
                ctx.Writer.Indent(ctx);
            }

            ctx.TypeDeclarationStack.Push(new Tuple <DeclarationType, CodeTypeDeclaration>(type, obj));

            HandleTypeDeclaration(obj, type, ctx);

            ctx.TypeDeclarationStack.Pop();

            GeneralUtils.HandleCollectionOnMultipleLines(obj.EndDirectives.Cast <CodeDirective>(),
                                                         ctx.HandlerProvider.DirectiveHandler, ctx, true);
            return(true);
        }