protected virtual void GenerateMasterHeader(ServiceModel serviceModel)
        {
            using (var writer = this.GetTextWriterForFile(this.Options.ServiceModelInfo.Name + ".h"))
            {
                var headerWriter = new ObjectiveCodeGenerator(writer);

                var includeExpressions = serviceModel.Classes
                                         .Select(c => FickleExpression.Include(c.Name + ".h"))
                                         .Concat(serviceModel.Enums.Select(c => FickleExpression.Include(c.Name + ".h")))
                                         .Concat(serviceModel.Gateways.Select(c => FickleExpression.Include(c.Name + ".h")));

                var comment = new CommentExpression("This file is AUTO GENERATED");

                var commentGroup = new[] { comment }.ToStatementisedGroupedExpression();
                var headerGroup = includeExpressions.ToStatementisedGroupedExpression();

                var headerExpressions = new List <Expression>
                {
                    commentGroup,
                    headerGroup
                };

                headerWriter.Visit(headerExpressions.ToGroupedExpression(GroupedExpressionsExpressionStyle.Wide));
            }
        }
        protected override void GenerateEnum(CodeGenerationContext codeGenerationContext, TypeDefinitionExpression expression)
        {
            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".h"))
            {
                var enumFileExpression = EnumHeaderExpressionBinder.Bind(codeGenerationContext, expression);

                var codeGenerator = new ObjectiveCodeGenerator(writer);

                codeGenerator.Generate(enumFileExpression);
            }
        }
        protected override void GenerateEnum(CodeGenerationContext codeGenerationContext, TypeDefinitionExpression expression)
        {
            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".h"))
            {
                var enumFileExpression = EnumHeaderExpressionBinder.Bind(codeGenerationContext, expression);

                var codeGenerator = new ObjectiveCodeGenerator(writer);

                codeGenerator.Generate(enumFileExpression);
            }
        }
        protected override void GenerateClass(CodeGenerationContext codeGenerationContext, TypeDefinitionExpression expression)
        {
            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".h"))
            {
                var headerFileExpression = ClassHeaderExpressionBinder.Bind(codeGenerationContext, expression);

                var codeGenerator = new ObjectiveCodeGenerator(writer);

                codeGenerator.Generate(headerFileExpression);
            }

            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".m"))
            {
                var classFileExpression = ClassSourceExpressionBinder.Bind(codeGenerationContext, expression);

                var codeGenerator = new ObjectiveCodeGenerator(writer);

                codeGenerator.Generate(classFileExpression);
            }
        }
        protected override void GenerateClass(CodeGenerationContext codeGenerationContext, TypeDefinitionExpression expression)
        {
            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".h"))
            {
                var headerFileExpression = ClassHeaderExpressionBinder.Bind(codeGenerationContext, expression);

                var codeGenerator = new ObjectiveCodeGenerator(writer);

                codeGenerator.Generate(headerFileExpression);
            }

            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".m"))
            {
                var classFileExpression = ClassSourceExpressionBinder.Bind(codeGenerationContext, expression);

                var codeGenerator = new ObjectiveCodeGenerator(writer);

                codeGenerator.Generate(classFileExpression);
            }
        }
        protected override void GenerateGateway(CodeGenerationContext codeGenerationContext, TypeDefinitionExpression expression)
        {
            List <Expression> methods;

            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".m"))
            {
                var classFileExpression = GatewaySourceExpressionBinder.Bind(codeGenerationContext, expression);

                var codeGenerator = new ObjectiveCodeGenerator(writer);

                methods = ExpressionGatherer.Gather(classFileExpression, ServiceExpressionType.MethodDefinition);

                codeGenerator.Generate(classFileExpression);
            }

            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".h"))
            {
                var headerFileExpression = GatewayHeaderExpressionBinder.Bind(codeGenerationContext, expression, methods.Cast <MethodDefinitionExpression>().ToList());

                var codeGenerator = new ObjectiveCodeGenerator(writer);

                codeGenerator.Generate(headerFileExpression);
            }
        }
        protected override void GenerateGateway(CodeGenerationContext codeGenerationContext, TypeDefinitionExpression expression)
        {
            List<Expression> methods;

            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".m"))
            {
                var classFileExpression = GatewaySourceExpressionBinder.Bind(codeGenerationContext, expression);

                var codeGenerator = new ObjectiveCodeGenerator(writer);

                methods = ExpressionGatherer.Gather(classFileExpression, ServiceExpressionType.MethodDefinition);

                codeGenerator.Generate(classFileExpression);
            }

            using (var writer = this.GetTextWriterForFile(expression.Type.Name + ".h"))
            {
                var headerFileExpression = GatewayHeaderExpressionBinder.Bind(codeGenerationContext, expression, methods.Cast<MethodDefinitionExpression>().ToList());

                var codeGenerator = new ObjectiveCodeGenerator(writer);

                codeGenerator.Generate(headerFileExpression);
            }
        }
        protected virtual void GenerateMasterHeader(ServiceModel serviceModel)
        {
            using (var writer = this.GetTextWriterForFile(this.Options.ServiceModelInfo.Name + ".h"))
            {
                var headerWriter = new ObjectiveCodeGenerator(writer);

                var includeExpressions = serviceModel.Classes
                    .Select(c => FickleExpression.Include(c.Name + ".h"))
                    .Concat(serviceModel.Enums.Select(c => FickleExpression.Include(c.Name + ".h")))
                    .Concat(serviceModel.Gateways.Select(c => FickleExpression.Include(c.Name + ".h")));

                var comment = new CommentExpression("This file is AUTO GENERATED");

                var commentGroup = new[] { comment }.ToStatementisedGroupedExpression();
                var headerGroup = includeExpressions.ToStatementisedGroupedExpression();

                var headerExpressions = new List<Expression>
                {
                    commentGroup,
                    headerGroup
                };

                headerWriter.Visit(headerExpressions.ToGroupedExpression(GroupedExpressionsExpressionStyle.Wide));
            }
        }